I have an automation. Lets say it has a AND
condition that five sensors must be below 5 temperatures. Easy enough to create the automation with those conditions. Do I have to repeat the logic, 5 temperature sensors below 5 different values, in the trigger section? Can I tell the trigger to look at the condition section for changes?
No you can’t.
The way you explained your question, they need to be both in trigger and conditions.
Triggers are OR, if one is below 5, it will trigger, but you don’t know in advance which one.
Conditions are by default AND, if all 5 must be below 5, it needs to be in the condition.
Thats what I was afraid of. Thanks for confirming.
One possibility is you would use a template sensor written in configuration.yaml to show whatever you like, which you could then use as the single tigger if preferred. Not sure what is being saved however - and note there is now a new feature that you can put an action in sensors as well
Here is an example of one that updates an input_text without an automation even being required :
template:
- trigger:
- platform: state
entity_id: input_text.weewx_last_array_data
action:
- service: input_text.set_value
data:
value: "{{ states('input_text.latest_weewx_receipt') }}"
target:
entity_id: input_text.previous_weewx_receipt
- service: input_text.set_value
data:
value: >
{% set ts = trigger.to_state.state %}
{% set ts = ts[:15:] + " " + "{}".format(now().year) %}
{% set time = strptime(ts, "%b %d %H:%M:%S %Y") %}
{% set str = time.strftime('%a %-m/%-d %-I:%M:%S%p') %}
{% set indx = str.find("M") %}
{% set oldstr = str[indx-1:indx+1] %}
{{ str.replace(oldstr,oldstr.lower()) }}
target:
entity_id: input_text.latest_weewx_receipt
sensor:
- name: "Weewx last array data formatted"
state: "{{ states('input_text.latest_weewx_receipt') }}"
unique_id: weewx_last_array_data_formatted