#Timers - where are the entities?

1 messages ยท Page 1 of 1 (latest)

storm vale
#

Ok Nabu, set a timer called BREAD TIMER for 1 hour.

where can I check & monitor/display the entities for this named timer?

random raven
#

I believe they're only on device right now. Or so Frenck said a week or so ago

storm vale
#

Interesting. I'm figuring that out now. these REALLY need to be exposed as Entities....

storm vale
#

yup, I just checked the yaml - everything specific to timers is internal to the ESP32 with no exposed entities. That sucks.

past loom
storm vale
#

I do this in Alexa.

    icon: mdi:timer-outline
    state: >
        {% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
          {% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
          {% if sorted_active[0] in sorted_active %}
            {{ (sorted_active[0][1].triggerTime|int /1000 -  (as_timestamp(now()))) | timestamp_custom('%H:%M:%S', false)}}
          {% else %}unavailable{% endif %}
        {% else %}unavailable{% endif %}   
    attributes:
      label: >
        {% if state_attr("sensor.kitchen_original_next_timer", "sorted_active") != None %}
          {% set sorted_active = state_attr("sensor.kitchen_original_next_timer", "sorted_active") | from_json %}
          {% if sorted_active[0] in sorted_active %}
            {{ sorted_active[0][1].timerLabel }}
          {% else %}Timer 1{% endif %}
        {% else %}Timer 1{% endif %}
  - name: "Alexa Timer 2"
 etc, etc
#

it gives me this in my OpenHasp display

#

I'm also a chef, so this is like a MUST HAVE feature in my kitchen ๐Ÿ™‚

#

I sent an email to the guy who wrote the timers in ESPHome for the HA VPE. Let's see what he says.

storm vale
#

Keith was listed in the repo, but yeah, according to Keith, Jesse Hills wrote it. I'll ping him when he gets back from his vacation.

#

I wish I was a more competent coder.... I can see all the timer stuff is all there, but it's completely internal to the ESP. Nothing is exposed to HA. Multiple timers are supported, so a new multi-attribute entity needs to be created and exposed to HA that iterates active timers listing their name & time left on the timer.

past loom
storm vale
#

My Alexa timers only update every minute or so. Even at 5-10 seconds it would be much more useful.

hasty granite
#

I think it would be enough to call the API on create/update/delete of a timer to synchronize between the esp32 and HA. If the timer has some kind of ID it would be possible to have multiple timers. Just my thoughts about it. I hope this will be coming in the future.

past loom
past loom
random raven
#

HA timer entities already only change on a state change of some sort

#

Anything that needs real time updates needs to do it itself

hasty granite
past loom
past loom
hasty granite
past loom
hasty granite
past loom
storm vale
# past loom Yeah it goes against the logic of HA... So far anyways. Having attribute on ass...

An array of 5 timers. Having any more would be up to the user to implement. Update all 5 of the HA timer entities every 5 seconds ( could be user configurable). This would be totaly acceptable. Each timer already goes off exactly on time on the Satellite. Its just the display in HA that might lag a few seconds.
Honestly this is totally acceptable.
REAL WORLD: By the time the timer goes off and you turn your head to look at the display, it will most likely already be updated.
If you need Precice timers with a realtime display, use a stopwatch.

#

Ok, here's the psudo-code! Now who can help me implement it?

past loom
storm vale
#

ok. we can agree to disagree. But it's not in core ESPHome, it's in the config file.

past loom
#

You keep saying it's totally acceptable, but it's only personal opinion and single use case. ๐Ÿ™‚
If someone will implement 5 timers and 10 sec interval, it will raise more discussions you can imagine. ๐Ÿ™‚

past loom
storm vale
#

look at the yaml - it's all there.

past loom
#

Where?

storm vale
#
  - addressable_lambda:
          name: "Timer Tick"
          update_interval: 100ms
          lambda: |-
            auto light_color = id(led_ring).current_values;
            Color color(light_color.get_red() * 255, light_color.get_green() * 255,
                  light_color.get_blue() * 255);
            Color muted_color(255, 0, 0);
            auto timer_ratio = 12.0f * id(first_active_timer).seconds_left / max(id(first_active_timer).total_seconds , static_cast<uint32_t>(1));
            uint8_t last_led_on = static_cast<uint8_t>(ceil(timer_ratio)) - 1;
            for (int i = 0; i < 12; i++) {
              float brightness_dip = ( i == id(global_led_animation_index) % 12 && i != last_led_on ) ? 0.9f : 1.0f ;
              if (i <= timer_ratio) {
                it[i] = color * min(255.0f * brightness_dip * (timer_ratio - i) , 255.0f * brightness_dip) ;
              } else {
                it[i] = Color::BLACK;
              }

so clearly this id could be used in a lambda:
id(first_active_timer).seconds_left

storm vale
#

I started a discussion in ESPHome Discussions on Github. Somehow this needs to be solved.... I'm throwing ideas out at this point. Feel free to shoot them down and propose alternatives.
https://github.com/esphome/esphome/discussions/8017

GitHub

A glaring omission in the Voice PE timer implementation is the lack of ability to display them in HA. As a chef, I use this voice Alexa assistant feature literally every day in my kitchen. With som...

past loom
storm vale
#

I know.

#

it can still be used in a labmda

past loom
#

Yes, that's how I exposed it to the sensor.

#

But it's just single sensor with time left on first timer.

storm vale
#

I know.

past loom
#

You can set it to -1 in Home Assistant, if no timers ongoing

#

So this sensor is always there.

storm vale
#

I'm pointing actual programmers (I'm a hack) to the place where all this happens in ESPHome.

past loom
#

Yeah i also have no PRs to ESPHome ๐Ÿ™‚ Let's see what devs say.