Heads up! Upcoming breaking change in the Template integration

I read the preliminary release note and I have a question about that specific option.

In 0.117, templates will support types. That means the output of a template is no longer constrained to be a string but can be float, int, list, etc. This new behavior might cause problems for some applications so one can set the legacy_templates option to true in order to preserve the old behavior.

After explaining that, the note proceeds to say that sensor.DOMAIN is now rate-limited to per-second as opposed to per-minute (as it was in 0.116). Does the legacy_templates option influence this modification as well? That appears to be your interpretation of the note. However, the fact that it is mentioned after describing legacy_templates makes me believe it isn’t included.

Maybe amelchio can clarify this particular point.

Ah, yeah, you are probably right.

On a sidenote:
I’m on the latest 0.117 beta and have no problems so far with the changes. The python types are quite nice :smiley: and the adaptive lighting integration is amazing!

1 Like

That option only affects the new types. The release notes have breaking changes from two PRs concatenated with no visual separation.

2 Likes

legacy_templates:

1 Like

if I might add:
Another good reason would be to avoid confusion the implementation of sensor.time next to now() causes, as this thread section now proofs… also, the way Petro explained, about losing 8 minutes per day on using only now() is so theoretical, I cant imagine the core team to prioritize that above the ‘ease’ of having now() simply update on the minute (and thus void the need to use the extra line with sensor.time)

I do realize now() is supposed to be what it is, now. And it will be. But failing another entity to update, it would be very well accepted to have it update on the minute.

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.