mirror of
https://github.com/magico13/ha-emporia-vue.git
synced 2026-01-09 20:37:59 -05:00
Verify that the timestamp is set before trying to use it
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
"homekit": {},
|
||||
"dependencies": [],
|
||||
"codeowners": ["@magico13"],
|
||||
"version": "0.6.0"
|
||||
"version": "0.6.1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user