Skip to content

Commit

Permalink
update HA shower example
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Oct 23, 2024
1 parent 6a301ab commit e615ade
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/Home-Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,20 @@ sensor:
sensors:
last_shower_duration:
friendly_name: Last shower duration
value_template: "{{ int(states('sensor.ems_esp_shower_duration')) | timestamp_custom('%-M min %-S sec', false)}}"
value_template: >-
{% if has_value('sensor.ems_esp_shower_duration') %}
{{ int(states('sensor.ems_esp_shower_duration')) | timestamp_custom('%-M min %-S sec', false)}}
{% else %}
unknown
{% endif %}
last_shower_time:
friendly_name: Last shower timestamp
value_template: '{{ as_timestamp(states.sensor.ems_esp_shower_duration.last_updated) | int | timestamp_custom("%-I:%M %p on %a %-d %b") }}'
value_template: >-
{% if has_value('sensor.ems_esp_shower_duration') %}
{{ as_timestamp(states.sensor.ems_esp_shower_duration.last_updated) | int | timestamp_custom("%-I:%M %p on %a %-d %b") }}
{% else %}
unknown
{% endif %}
```

Note you can configure the `timestamp_custom()` to your own preferred format.
Expand Down

0 comments on commit e615ade

Please sign in to comment.