Hi All,
Hopefully one of you can help me further.
I have 2 Withings sleeping mats and these report time back in seconds and I would like to see the format HH:MM.
So I made a template sensor entity, only they all show 1 hour too much. So when something is 0 seconds and therefore 0 hours then I see 01:00. At 15.900 seconds it should be 04:25 but I see 05:25.
Of course I googled and searched the forum but I didn’t do this well enough because I didn’t find a suitable option.
Hopefully one of you can help me further.
Thnx up front.
BR,
Chad
sensor:
- platform: template
sensors:
sleep_light_duration_seconds_chad:
friendly_name: Lichte slaap Chad
value_template: >
{% set seconds = ( states('sensor.withings_sleep_light_duration_seconds_chad') | int ) | timestamp_local %}
{{ strptime(seconds, '%Y-%m-%d %H:%M:%S').strftime('%H:%M') }}
- platform: template
sensors:
sleep_light_duration_seconds_cindy:
friendly_name: Lichte slaap Cindy
value_template: >
{% set seconds = ( states('sensor.withings_sleep_light_duration_seconds_cindy') | int ) | timestamp_local %}
{{ strptime(seconds, '%Y-%m-%d %H:%M:%S').strftime('%H:%M') }}