Closed peterthepeter closed 10 months ago
The time is reported to HA as an exact timestamp, it decides to convert it to an interval and round it for rendering. I didn't verify but I'm guessing that if you check the sensor value in the dev tools you'll see that it's a timestamp
Yes you are correct it shows an exact timestamp. Is there a possibility to round the timestamp to hours and minutes?
This is a HA behavior, you can override it with a template if you wish
Thanks for the tip:
I found a thread in the Home Assistant forum that dealt exactly with the problem. Here is my solution (maybe it helps someone else)... I used it direct in my Dashboard:
type: custom:mushroom-template-card
primary: |
Restzeit
secondary: |2-
{% if states('sensor.403060519689023725_bsh_common_option_remainingprogramtime') == 'unavailable' %}
---
{% elif (as_timestamp(states('sensor.403060519689023725_bsh_common_option_remainingprogramtime'))) >0 %}
{% set sec = as_timestamp(states('sensor.403060519689023725_bsh_common_option_remainingprogramtime'))-as_timestamp(now()) %}
{%set hr = (sec / 3600) | int %}
{%set min = sec / 60 - hr * 60%}
{% if hr > 0 %}
{{"%dh:%02dm" % (hr, min)}}
{%else%}
{{"%02dm" % (min)}}
{% endif %}
{% endif %}
icon: mdi:clock-time-eight
entity: sensor.403060519689023725_bsh_common_option_remainingprogramtime
icon_color: blue
tap_action:
action: more-info
I have a Bosch Dishwasher SMV4HVX31E (sensor.403060519689023725_bsh_common_option_remainingprogramtime) , the Sensor for Remaining Time shows only Hours if the remaining time is more than 1 hour:
e.g. Remaining time - 2h45m the sensor shows: Remaining time 2 hours Remaining time - 45m the sensor shows: Remaining time 44m
It would be better if the sensor would show: Remaining time 2 hours and 45 minutes if the remaining Time is more then 1 Hour.