Skip to content

Commit

Permalink
Merge pull request #193 from MTrab:Fix-updated-property
Browse files Browse the repository at this point in the history
Use correct timezone data in 'updated' property
  • Loading branch information
MTrab authored Nov 23, 2023
2 parents 573b938 + 2bc91cb commit 568cfd4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pyworxcloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,15 @@ def _decode_data(self, device: DeviceHandler) -> None:

if "cfg" in data:
try:
if "dt" in data["cfg"]:
dt_split = data["cfg"]["dt"].split("/")
date = f"{dt_split[2]}-{dt_split[1]}-{dt_split[0]}"

device.updated = (
date + "T" + data["cfg"]["tm"] + "Z"
if "dt" in data["cfg"]
else data["dat"]["tm"]
)
# if "dt" in data["cfg"]:
# dt_split = data["cfg"]["dt"].split("/")
# date = f"{dt_split[2]}-{dt_split[1]}-{dt_split[0]}"

# device.updated = (
# date + "T" + data["cfg"]["tm"] + "Z"
# if "dt" in data["cfg"]
# else data["dat"]["tm"]
# )
device.rainsensor.delay = int(data["cfg"]["rd"])

# Fetch wheel torque
Expand Down Expand Up @@ -664,6 +664,7 @@ def _decode_data(self, device: DeviceHandler) -> None:
except KeyError:
invalid_data = True

device.updated = device.last_status["timestamp"]
convert_to_time(
device.name, device, device.time_zone, callback=self.update_attribute
)
Expand Down

0 comments on commit 568cfd4

Please sign in to comment.