since that dialog, using this now everywhere where needed:
- condition: template
value_template: >
{{trigger.to_state is not none and
trigger.from_state is not none and
trigger.to_state.state != trigger.from_state.state}}
as a default condition to rule them all…
which would translate here to at least do:
value_template: >
{{ trigger.from_state is not none and
trigger.to_state.attributes.temperature !=
trigger.from_state.attributes.temperature }}
That curfew time is adjusted elsewhere in another stand alone app. We change it according to sunset, work schedules etc.
Want I need is the lock_time value to be the trigger for my automation I’m building. So when it hits (in this case) 17:20, I want it to fire as a trigger.
How would I include this into my automation? (this trigger will then ensure the cats’ status is set to “inside” 5mins after this variable time.)
This is my current automation YAML, but I’ve currently just picked the latest possible time we’d ever lock the catflap, and added a few mins (which means, right now, it’s changing their status to “home” well after the flap lock curfew time):
Not exceptionally bright, but nothing better comes to mind right now.
Any trigger on sensor.cat_flap_cat_flap will only fire when the sensor actually changes, which will be rare if I understand correctly, and quite surely won’t on, e.g., 17:20
Instead of a Time Pattern Trigger, use a Template Trigger employing the template in your existing Template Condition (and eliminate the Template Condition). It will be evaluated every minute, on the minute, because it contains now().
Are you referring to the use of the Template Trigger vs Time Pattern Trigger or how the template derives the current time as a string?
For the former, the rationale is “code simplification” and for the latter it’s just “my preference”. I won’t make any claims about improved performance because (for either of them) the differences are probably measured in microseconds.
That one
Ok. Yeah, I’m juggling with tons of stuff, so I’ll definitely have forgotten about “It will be evaluated every minute, on the minute, because it contains now().” in no time, so I prefer “explicit” to “compact” myself
Thanks for all the replies and suggestions.
I tried 123/Taras suggestion, but it has never triggered (2 days now where that time has occurred and the curfew has been implemented) any ideas why?
Edit: my formatting was different, have ensured it matches yours and will try again. Cheers for the help again
I’ve input.number for Google speakers volume control like this:
- alias: "Google Mini Hall Volume Control"
trigger:
- platform: state
entity_id: input_number.google_mini_hall_volume_control
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.google_mini_hall
volume_level: "{{ trigger.to_state.state }}"
And my question was about volume sync when it changed outside of HA. For this case I made something like this:
- alias: "Google Mini Hall Volume Sync"
initial_state: false
trigger:
- platform: state
entity_id: media_player.google_mini_hall
condition:
- condition: template
value_template: "{{ not is_state_attr('media_player.google_mini_hall', 'volume_level', states('input_number.google_mini_hall_volume_control') | int / 100) }}"
action:
- service: input_number.set_value
entity_id: input_number.google_mini_hall_volume_control
data_template:
value: "{{ state_attr('media_player.google_mini_hall','volume_level') | float(0) | round(1) }}"
It’s work like a charm but, I noticed a problem when third-party automations are triggered, when, for example, a group speakers is used that includes the current speaker and the volume of this group changes before the TTS message - the current speaker falls out at 0% volume. Until I got to the solution, and currently I had disabled automation above.