I want to have “lock” entity that controls an input_boolean. I have a gate with a momentory switch to open and close. Pulse to open and pulse to close. A seperate door sensor is attached to see the state. I am trying to build that as a lock… I was almost there, see here:
But then I stopped using a “vswitch” since it seems not supported and I suspect that being the source of my problems and I decided to go for the “helper” and created an input_boolean.
but that seems to give me the same headache.
I have
a helper:
a node red flow controlling the physical switch by sending a “pulse” of 2 secs and then wait for 20secs to see if the door sensor is open/closed. This works really well and I would like to keep that:
I had/have a template lock
Why? In that “lock” I can also take the door sensor as a sensor for the template and see the correct state.
BUT I cannot get that working… (again, I had it working with a vswitch but that was not reliable. Probably it’s very simple (like everything is when you know it :-).
I struggle with the template lock and the combination with a boolean…
Changing the state in the dev tools does NOT send the corresponding commands. All it does is change the state. If you pick a light entity and swap the state, the light will remain in the original state but report the one you put (until the next update happens from the switch).
What it CAN do is trigger automations. It will send a state changed event for that entity, even though nothing happened.
But when I THEN click on “unlock” in lovelace it locks !!?!?
When you click ‘unlock’, it will call the ‘set_unlock’ command.
How did you map this to your virtual switch? Do you have an automation that listens to the input_boolean and calls the virtual switch turn on/off? To me, it sounds like your virtual switch is more like a button where, it has no state…and when you push it, it just runs. Looking at your flow, both open and close to the exact same thing, so this would make sense.
I’m not sure why the close flow will delay for 20 seconds, then check if the sensor is open, then do it again. What if the gate closes within that 20 seconds? The poort sensor would be off. I don’t know how to read node-red, but ist hat a conditional block? I dunno, it might be right, but having 2 identical things for both open and close seems wrong to me. Might as well have one.