Any help appreciated on this one please
I’m hopping it is possible
TLDR: In my blueprint I want to refer to one of the inputs in a trigger template.
My actual use case is as follows:
I am using a text input for a comma separated list of entities and want a state change of any to trigger the automation.
My input in blueprint:
media_players:
name: Media Players
description: "A comma seperated list of media_players in room."
Been trying to get this to work myself as I want my phone alarm trigger the automation but only if a boolean in the automation is true. Would be a great to be able to get this to work.
I get an error about “Blueprint Cover Testing generated invalid automation”
If I replace “!input timeClose” with a fixed string it is parsed without problems.
Just an observation, but your template only opens the cover if all the previous calculations are false and it’s daylight, it then has 4 other out points that all close the cover - seems like an excessively complicated way to resolve it.
Also service_template is deprecated, just use service.
Yeah, I get that, and I can’t propose an alternative at the minute because I seem to have woken up in a particularly dopey state today, it wasn’t intented as a criticism, just an observation that it seems a bit ‘backwards’ in its logic.
That is to say that regardless of all the arguments that come before it, if binary_sensor.daylight is off - then the cover is being/staying closed. So really that should be the first argument, then if that’s on do the calculation as to whether it should open.
Like I said, I’m having a dopey day so maybe the was you have it is just as efficient as what I could come up with if I was fully awake, it just doesn’t ‘look right’ to me to have a template outputting 5 potential options when 4 of them are the same
I’m absolutely in favor of code reviews.
I started with home assistant two days ago and I’m more than happy to learn best practices.
See Trigger closing shades via time and light
I could make only two options out of those four by using “and” and “or”
But I find a couple of short if clauses much easier to read and less error prone han lesser but more complicated ones.
What I don’t like with my solution is the time calculation and comparison.
What I understood is that if “now()” is used in an automation that this automation is calculated every minute. I don’t need this. Is it possible to get the time the trigger fired?
And comparing times via string compare is more than ugly.
Yeah, you’re probably right - I only brought it up because when I was looking at your code my brain kept nagging me that it was ‘backwards’ logically, but as I say I didn’t actually come up with any solution that would suit you better.
As I understand it (and I must admit I completely lost track of what was going on when the template engine was being re-written, so I may be off) - the recalculation every minute is for template sensors and such like, the templates in actions and conditions are still only evaluated as and when the automation is fired.