Hi. I am trying my first Script in YAML and so far unable to ID the cause of Studio Code Server in HA telling me I am ‘Missing property “condition”.’ at 3 points in my script.
My Objective is to set a “part_of_day” input_text helper value depending on the time of day so I can use that Helper entity value in various automations and avoid re-calculating at each need.
I thought to code this as a ‘script’ so I can run it from in Automations or stand-alone.
My script with the 3 errors showing in SCS within HA desktop is
# Now set the Part_Of_Day value
- service: input_text.set_value
target:
entity_id: input_text.part_of_day
data:
value: l_pod
# End of set_part_of_day script
What am I missing?
Any other issues with my approach?
Thanks tom_I.
That’s how I had it originally and thought “I can make this cleaner, neater and shorter”. !!!
Adding all those repeating code snippets back goes against 45+ years’ good programming practice.
Ok, I’ll give it a go.
Hi. Now that Times of Day (TOD) integration page looks interesting.
But I’m slightly confussed by what it says. I see it’s only " used by 1.9% of the active installations" and does
YAML Configuration Alternatlively, this integration can be configured and set up manually via YAML instead. This has some additional functionality over the UI version.
imply that the integration does not need to be installed because you can do the same (and more) by using YAML code similar to the example given?
Or does installing the Times of Day integration give you the platform: tod that the example YAML uses?
I also found very helpful:
The sensor state is ON when this condition after + after_offset <= current time < before + before_offset.
I’d been wondering about that Starttime <= Time < Endtime question re Before and After on condition: time blocks. The documentation at HA Docs - Time Condition leaves it unstated.