Verify that the timestamp is set before trying to use it

This commit is contained in:
magico13
2021-08-07 13:23:28 -04:00
parent 51ee3ef9cc
commit fb110cf0f4
2 changed files with 7 additions and 4 deletions

View File

@@ -248,14 +248,17 @@ async def update_sensors(vue, scales):
None, vue.get_devices_usage, device_gids, utcnow, scale
)
if channels:
reset_datetime = None
for channel in channels:
reset_datetime = None
id = make_channel_id(channel, scale)
info = find_device_info_for_channel(channel)
if scale in [Scale.DAY.value, Scale.MONTH.value]:
epochSeconds = channel.timestamp
timestamp = datetime.fromtimestamp(epochSeconds, timezone.utc)
reset_datetime = timestamp
if epochSeconds:
timestamp = datetime.fromtimestamp(
epochSeconds, timezone.utc
)
reset_datetime = timestamp
data[id] = {
"device_gid": channel.device_gid,

View File

@@ -9,5 +9,5 @@
"homekit": {},
"dependencies": [],
"codeowners": ["@magico13"],
"version": "0.6.0"
"version": "0.6.1"
}