Use last successful update instead of last update

This commit is contained in:
Gabriel Augendre 2020-07-29 09:42:29 +02:00
parent c9746b957f
commit 3b6c4cfbb0
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4

View file

@ -53,7 +53,7 @@ def main():
def format_temp(data: dict) -> str: def format_temp(data: dict) -> str:
name = data["attributes"]["friendly_name"].lower().replace("temperature", "").strip() name = data["attributes"]["friendly_name"].lower().replace("temperature", "").strip()
diff = pendulum.parse(data["last_updated"]).diff_for_humans(locale="fr") diff = pendulum.parse(data["attributes"]["last_successful_update"]).diff_for_humans(locale="fr")
return f"{name} : {data['state']}{data['attributes']['unit_of_measurement']} ({diff})" return f"{name} : {data['state']}{data['attributes']['unit_of_measurement']} ({diff})"