Trying to use a lambda to check two states and return 1 if either is true, I started with:
on_value:
then:
- if:
condition:
and:
- lambda: 'return ( id(cc_temperature).state >= id(cc_max_temperature).state || id(cc_humidity).state >= id(cc_max_humidity).state );'
- switch.is_off: cc_cooler
then:
- logger.log: "Cooler on"
- switch.turn_on: cc_cooler
and have also tried:
on_value:
then:
- if:
condition:
and:
- lambda: |-
if ( id(cc_temperature).state >= id(cc_max_temperature).state || id(cc_humidity).state >= id(cc_max_humidity).state ) {
return 1;
} else {
return 0;
}
- switch.is_off: cc_cooler
then:
- logger.log: "Cooler on"
- switch.turn_on: cc_cooler
but always get ERROR Circular dependency detected!
probably, something stupid, can anyone help?
If I leave everything else as is and only test for one state e.g.
- lambda: 'return id(cc_humidity).state >= id(cc_max_humidity).state;'
it compiles fine