Locking and unlocking a KNX Switch

Hey Folks,

did anyone already found a solution to lock and unlock the control of a switch entity?

In my case I have added some KNX switches with address and state address.

The KNX devices over the feature to lock lock and unlock the switches by another KNX group address.

But if I lock the KNX device I can still toggle the Home Assistant switch entity in the front end, however it will not do anything except showing the false switch state in the frontend…

I don’t know what’s the right way to achieve the solution.

  1. Having a lock address (seams to be a big thing)

  2. Locking the entity by an automaton that is triggered by the binary sensor of the lock state from the group address - but therefore the question is, how to lock the entity in home assistant

Thanks for any feedback and ideas that you going to share :slight_smile:

Hi :wave:!
Unfortunately HA doesn’t know the concept of “locking” things. You can however use “unavailable” to achieve similar. I guess you’d have to wrap the switch in a template-switch for that and use a bibary_sensors state or knx_event to set and unset availability.

Thanks @farmio! My problem is that I want to show the state even if the entity is locked.
Really said, that a feature request is not that likely to be come real.

I guess, this feature would be so helpful. Imagine an automation should switch off a entity at a specific time but the system detects, that the device is still in use - power consumption is higher than standby consumption - so it locks the switch.

… but the switch is locked.
What should the automation do then - when no user interaction is available (since it is a automation). What should happen when the lock is released?

This is not an easy / lightweight feature to implement. And it can’t happen on a per integration base, but would have to be implemented at HA entity level.

I did start an architecture issue some time ago (which was then moved to discussions) without any real answer. Unfortunately I don’t think I personally could implement this. Add locked state to Cover · home-assistant/architecture · Discussion #545 · GitHub

1 Like

Yes really sad that this is so complicated, that this not available for all entities. The more I search the more I read about people that would appreciate such a feature.

I think that’s okay, because all other switches that would be affected by the automation will switch. And for the locked ones for example my computer socket I would have another automation similar to that: