Hi all! I am experiencing a bit strange behavior when triggering automations at regular intervals on ESPHOME devices.
Here is the description:
HA: 2024.1.1
ESPHOME: 2023.12.5
I have 6 Humidity sensors:
h1,h2,h3,h4,h5,shth1
and one switch: relay
I want to check the sensor values every minute and:
- if any of the sensor values (logic OR) goes above 68, then I want to switch on the relay.
- switch off the relay when all the sensors (logic AND) are below 65
I have implemented following yaml script:
interval:
- interval: 1min
then:
if:
condition:
or:
lambda: |-
return id(h1).state >68;
return id(h2).state >68;
return id(h3).state >68;
return id(h4).state >68;
return id(h5).state >68;
return id(shth1).state >68;
then:
- switch.turn_on: relay
- interval: 1min
then:
if:
condition:
and:
lambda: |-
return id(h1).state <65;
return id(h2).state <65;
return id(h3).state <65;
return id(h4).state <65;
return id(h5).state <65;
return id(shth1).state <65;
then:
- switch.turn_off: relay
What happens is that only the “and” condition works, while the “or” condition doesn´t.
Then, I have tried to remove the “and” condition and only keep the “or” condition, and this time the logic works.
So my question is: Could it be that the two automation logic went into conflict since fired at same time?
Or, am I doing something wrong?
Thanks for any help or suggestions.