Hi all!
I have a switch to turn a screen up or down and I get a status value of the screen.
I need to have the switch turned off when the status is 0% or 100%.
I’m able to create an automation that turns off the switch when a value is reached.
But when my screen is fully closed, and I turn the close switch on AGAIN, it remains on.
So: if screen is at 0% already and I send the command to close again, the close command should reset itself automatically.
Here are 2 rules I made and they work seperately but I can’t really combine them…
This rule turns of the switch when the status CHANGES TO less than 0.01.
Problem: if switch.mb_con_screenn3_down changes to on when sensor.mb_screenn3_stand is already 0, the switch stays on…
- id: "ScreenN3_Full_Closed1"
alias: "Screen N3 Full Closed1"
trigger:
- platform: numeric_state
entity_id: sensor.mb_screenn3_stand
below: 0.01
action:
- service: switch.turn_off
entity_id: switch.mb_con_screenn3_down
and:
This rule turns the switch of, when it CHANGES TO on, AND sensor.mb_screenn3_stand is less than 1.
Problem: if sensor.mb_screenn3_stand is 50% and you turn on switch.mb_con_screenn3_down, then switch.mb_con_screenn3_down is not turned off when sensor.mb_screenn3_stand reaches 0.
- id: "ScreenN3_Full_Closed2"
alias: "Screen N3 Full Closed2"
trigger:
platform: state
entity_id: switch.mb_con_screenn3_down
to: "on"
condition:
condition: numeric_state
entity_id: sensor.mb_screenn3_stand
below: 1
action:
service: switch.turn_off
entity_id: switch.mb_con_screenn3_down
So I need a combination of these rules because I have many screens and my code becomes pretty messy and unreadable if I need this double rules for all screens…
Does anyone have an idea to achieve this?
Thanks!