Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp unit for time to end #71

Open
steuerlexi opened this issue Oct 15, 2024 · 5 comments
Open

Timestamp unit for time to end #71

steuerlexi opened this issue Oct 15, 2024 · 5 comments

Comments

@steuerlexi
Copy link

Is it possible to have a timestamp entity for the time_to_end entity?

I would need it for this timer bar to work:
https://github.com/rianadon/timer-bar-card

@kingy444
Copy link

The api isnt super consistent across device types - i think the easiest path forward would be to look at creating an automation that fills a timer entity for your needs

This is not super useful for my fridge, as all the timers return in minutes. This resukts in every refresh restarting the timer and it goes up and down over and overuntil the full minute passed

something like the below

timer:
  fridge_fast_mode:
    duration: "00:00:00"
automation:
  - alias: Set fridge fast mode timer
    trigger:
      - platform: state
        entity_id: sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend
    condition:
      - condition: template
        value_template: "{{ states('sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend') | int > 0 }}"
    action:
      - service: timer.start
        target:
          entity_id: timer.fridge_fast_mode
        data:
          duration: >
            {% set minutes = states('sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend') | int %}
            {% set hours = (minutes // 60) %}
            {% set remaining_minutes = minutes % 60 %}
            {{ '%02d:%02d:00' | format(hours, remaining_minutes) }}

@Sascha-L
Copy link

Before the last update the Time To End entity returns e.g.: 50. Which means 50 min. Now with the latest release the time is returned as "50.0". Please fix this. Your entity also ignores the unit format setting, because it is set to 50 instead of 50.0 but still returns 50.0, so I had to manually remove the ".0" in my dashboards. As said, with all previous versions the value was correct.

@kingy444
Copy link

kingy444 commented Oct 19, 2024

Precision like that does sound strange as I would expect it to be 50:00.
You could just have updated the precision on each entry directly rather than in your dashboard (and may still prefer to)

Previously time was converted to minutes in integration code and stored that way meaning it was less accurate.
Time is stored in seconds now to allow conversion in the UI (as per HA standard) and using the HA UI to convert to minutes.

Note that even if we adjust the precision in the code, your entities likely won't auto update without a remove and readd. It is not loaded on every restart

I do actually think that the current 50.0 is more accurate as it includes the information on seconds and would display 40:30 for instance rather than just 40

It's only 3 clicks to change the precision of an entity after all.

You could submit a device specific catalog that would force this too

@Sascha-L
Copy link

Sascha-L commented Oct 19, 2024

Where can I change the precision? As said, the precision settings on that entity has no effect, what ever I set up, your entity always returns "50.0" instead of e.g. "50". That's why I had to fix it in my dashboards. Also my devices never shows seconds, it always full minutes.

image image

@steuerlexi
Copy link
Author

The api isnt super consistent across device types - i think the easiest path forward would be to look at creating an automation that fills a timer entity for your needs

This is not super useful for my fridge, as all the timers return in minutes. This resukts in every refresh restarting the timer and it goes up and down over and overuntil the full minute passed

something like the below

timer:
  fridge_fast_mode:
    duration: "00:00:00"
automation:
  - alias: Set fridge fast mode timer
    trigger:
      - platform: state
        entity_id: sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend
    condition:
      - condition: template
        value_template: "{{ states('sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend') | int > 0 }}"
    action:
      - service: timer.start
        target:
          entity_id: timer.fridge_fast_mode
        data:
          duration: >
            {% set minutes = states('sensor.electrolux_kitchen_fridge_fridge_fastmodetimetoend') | int %}
            {% set hours = (minutes // 60) %}
            {% set remaining_minutes = minutes % 60 %}
            {{ '%02d:%02d:00' | format(hours, remaining_minutes) }}

Somehow I can´t get this to work. How can I set up this automation step by step? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants