I’m trying to add a software blockage of a switch by having a boolean I can turn on.
text_sensor:
- platform: homeassistant
id: sw_block
entity_id: input_boolean.porttelefon_sw_block
switch:
- platform: gpio
pin:
number: 14
id: porttelefon
name: "Porttelefon"
on_turn_on:
then:
- if:
condition:
lambda: |-
if(id(sw_block).state == "off"){
return true;
}else{
return false;
}
then:
- delay: 0.5s
- switch.turn_off: porttelefon
The switch it self needs to momentary thus the delay and turn off, but how can I make sure it first reads the condition before the turn on?
The way it works now is that if the boolean is off then it works as expected (turn on, delay then off).
When boolean is on, it turns on and stops at that position. I want it to not even turn on.
Is that even possible?