Time conversion no longer work after 2022.5 update

Hello,
I use a couple of sensors to record how many time every user is at home.
This first sensor count the time but the measurement is in hours (like 12,3 h):

  - platform: history_stats
    name: Time at home
    entity_id: input_boolean.user
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

This one is still working after the update but this second one that converts the hours in a more friendly timestamp (used for notification or lovelace) after the update became ā€œunknownā€:

template:
  - sensor:
    - name: "Time at home Converted"
      state: "{{ state_attr('sensor.time_at_home', 'value') }}" 

Is there a way to fix it?

Thank you in advance

The value attribute has been removed in 2022.5.

1 Like

Thank you for the answer, I didnā€™t notice it before.
Is there a way to use this format in notification too (like Telegram send_message) and not only on lovelace?

Iā€™m sure this can be done better, but thatā€™s what Iā€™m using right now:

{% set list = states('sensor.office_this_week').split('.') %}
{{ list[0] }}h{{ (60 * ('0.'~list[1]) | float) | round(0) }}m

Result: 29h57m

1 Like

Thatā€™s great! thank ou for your help!