Ik had niet eerst in het topic gekeken. Ik heb daarom zelf voor het volgende gegaan:vliegnerd schreef op donderdag 10 april 2025 @ 18:36:
[...]
Ik zet utc_time om naar leesbare tijd met:
code:
1 2 3 4 5template: - sensor: - name: "Itho WPU time" state: > {{ states('sensor.itho_wpu_utc_time') | int | timestamp_custom("%d.%m.%Y %H:%M:%S") }}
YAML:
1
2
3
4
5
6
7
| mqtt: sensor: - name: "WPU time" unique_id: "wpu_time" state_topic: "ithowpu/ithostatus" device_class: "timestamp" value_template: "{{ (value_json['UTC time'] | int | timestamp_utc | as_datetime).replace(tzinfo=now().tzinfo) }}" |
Met device_class: timestamp wilt Home Assistant ook een tijdzone erbij. De verschillende template functies corrigeerden steeds voor het tijdzoneverschil. Daarom uiteindelijk maar voor UTC gegaan plus het goedzetten van de tijdzone (zonder dat de tijd wordt aangepast).
En de reden voor dit alles is dat de WPU tijd flink verkeerd stond. Minimaal 20 minuten ofzo. Ik wil een notificatie maken/krijgen wanneer de tijd teveel afwijkt.
/f/image/nIbluRh1g89LqKx34Y2ZzxL1.png?f=fotoalbum_large)
/f/image/Xzas5XdmLQelAtICURCXQ98y.png?f=fotoalbum_large)
/f/image/GnyH8A3pKvYtS0RkZOQOCaPU.png?f=fotoalbum_large)
/f/image/bRYlruqnZxYyWTw8cdsHg18N.png?f=fotoalbum_large)
:strip_exif()/f/image/q4fLNrqJCqYNOAMgdhwqFS6G.jpg?f=fotoalbum_large)
:strip_exif()/f/image/7OqKMQ2nzH3xJeCTpqDnIJsN.jpg?f=fotoalbum_large)
:strip_exif()/f/image/J1ooYMS5Rc5bSGNP3dlpRlDk.jpg?f=fotoalbum_large)
:strip_exif()/f/image/LCskYMjspMPjZU9ZXcSprJHU.jpg?f=fotoalbum_large)
:strip_exif()/f/image/xkBHMDDesful0EYlyFpEL7D9.jpg?f=fotoalbum_large)
:strip_exif()/f/image/6UGF596OPuGIe35mcjf4XvqT.jpg?f=fotoalbum_large)
:strip_exif()/f/image/WkQn6m2dkAQqpwy69YgZXqtI.jpg?f=fotoalbum_large)
:strip_exif()/f/image/sSQNXnLbtBoSBiOb13eezR7J.png?f=user_large)
:strip_exif()/f/image/gfX9tb4hhwEM0b7IDgLJrJey.jpg?f=fotoalbum_large)
/f/image/HOy6Z8jS8rK1gU4q6Wwn3X5A.png?f=fotoalbum_large)
/f/image/loELMnTG6yrj1ZC3KceAjn9Q.png?f=fotoalbum_large)