If-then-rule -- but how?

Hello,

can you create an if-then rule and what should it look like?

If sensor A above value X
then turn on relay 1 when sensor B is above value Y.

If sensors A and B fall below the set value, relay 1 switches off.

I can’t get this problem under control.
Currently I’m doing it like this:

   - platform: home assistant
     name: "Power Generation A"
     entity_id: sensor.input_power
     on_value_range:
         - above: 1520
           then:
             - switch.turn_on: hk_1
         - below: 1500
           then:
             - switch.turn_off: hk_1

   - platform: home assistant
     name: "battery"
     entity_id: sensor.battery_state_of_capacity
     on_value_range:
         - below: 95
           then:
             - switch.turn_off: hk_1

But it just doesn’t work like that…

The problem is me with my limited skills :wink:

gerald

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

2 Likes