Heads up! Upcoming breaking change in the Template integration

better post the link, cause Petro;s link seems to be incorrect:

It is now going to update every time the minute changes, PR here: Refresh now() templates on second=0 by amelchio · Pull Request #42225 · home-assistant/core · GitHub

3 Likes

Thanks! now how’s that for community participation/involvement :wink: this is very cool. much appreciated indeed.

1 Like

Fantastic! Thank you! :+1:

1 Like

moving to the future in 117 with the native types in templates, trying to figure out where this will affect the config, would this be made easier now?

    sequence:
      service: light.turn_on
      data:
        entity_id: >
          light.{{['frontdoor','dining_corner','symfonisk']|random}}
        rgb_color: ['{{(range(0,255)|random)}}',
                    '{{(range(0,255)|random)}}',
                    '{{(range(0,255)|random)}}']
        brightness: '{{(range(50,250)|random)}}'
        transition: '{{(range(1,3)|random)}}'

There have been numerous posts on the rgb values in fact being made a string before/up to now.

The new template Python types in 0.117 are unrelated to this topic which is about how to adapt to the deprecation of entity_id. Kindly move your post to a separate topic (where it will also get better visibility than being the 565th post of this thread). Thank you!

(This thread is long enough without the addition of every new thing happening to templates in general.)

1 Like

sure, consider it done. sorry.

1 Like

Is there any method to list all the listeners in HA?

Dev tools Events page, right hand side.

Is this in the 0.117 beta?

I should check it.

Yeah it was rolled into beta2 (going final today). I was hoping to receive some feedback during beta time but not getting bug reports is a good start :slight_smile:

1 Like

I’ll do some tests now.

EDIT: all working as described. Templates with now() are updating on the minute.

have been busy with some diehard issues and bug reports on the new template type consequences…

they are still not ironed out, but don’t have to do with either frequency or entity_id limiting, so haven’t reported here because of that.

all templates that had the {% set trigger = states('sensor.time')%} because the use now() now behave very nicely indeed without that.
That is to say, they update once a minute.

the ones that had that and have other recognizable entity_id’s can’t be limited any longer either by setting an entity_id or frequency (id). Which I still feel as a limitation of the toolset.

so yeah, mixed feelings will linger. Grateful though for all the efforts being made

Thank you for confirming.

Right, that is still a limitation compared to the previous template engine (well, it was more of a bicycle before). I am also a bit sorry that it is gone but … yeah, Hue lights are polled every five seconds, it is what it is.

If the limitation causes observable problems (other than to your guts) I am still interested in YAML showing the issue.

cool, will do. but first things first now, eagerly awaiting the results of this: https://github.com/home-assistant/core/pull/42494

to get my rest_command templates working again. Hope this makes it for todays release if 117.0 !

after that, I’ll throw my original Unknown, Unavailable, None template in 117 and see what happens… :wink:
exciting times.

btw, if I may Taras, I invite everyone to hop over here meanwhile and help me out finding a way to prevent these template Undefined errors…

2 Likes

I have a sensor with a for loop with if statements. eg.

{%- set domain = states['sensor'] -%}
{%- for item in domain if ("docker" in item.entity_id | lower and "status" in item.entity_id | lower and item.entity_id != "sensor.docker_status") -%}

Is it possible to have it updated less than each minute, like /10 of a minute?
To save processor uses?

No, that’s not possible anymore.
However running this template once a minute or every 10 minutes will not have any significant impact on performance.

just for reference here (too): yes! it has been solved by Frenck and Paulus: rest_command working again, with the original templates. No need to change the format at all. very nice!

With 0.117 it should actually update each second because you are using a single domain, not all states. This is still not expected to have a visible performance impact.

Maybe you can optimize it anyway, using a group. Giving advice is easier if you show the full template though.