Force entity as readonly or protected


All my plugs are controlled by homeassistant.

But for obvious reasons, the plug homeassistant is on is controlled by a Philips Hue Bridge.

As I’m using Hue integration, the plug is also visible to homeassistant, and fully controllable from it.

What I’d like is to be able to set this plug in homeassistant as readonly or protected so homeassistant can’t change it’s state (unless it wants suicide), but I still want to see it’s state to know if for example it’s unavailable (zigbee network problem?) to trigger an alarm.

Any thoughts?


Not really aware of any straightforward way to do what you’re trying to do. Seems like basically you want all the normal entities you just want the service calls to the switch entity to fail.

There might technically be a way to do that with this:

But honestly not sure if you can control service calls on an entity or not. There’s not a lot of info on it and it hasn’t been updated in quite a while so YMMV.

What I would probably do is leverage this:

I see from this section of the docs that the Philips Hue integration fires events of type hue_event for changes. So what I would do here is listen for these events in developer tools and test when they fire and what they contain. Assuming they contain all the state information you need then simply disable the switch entity created by the Philips Hue integration and create your own trigger template sensor out of these events. That way you have all the state information available but its in a sensor rather then a switch so the turn_on and turn_off service calls don’t work.

But really depends on what’s in those events and when they fire. I am not familiar with the philips hue integration personally. My philips hue hub sits unplugged somewhere in my basement, I just connected all the devices directly to HA with Zigbee.

Well, Hue is only for my case, but I’d like a generic way to set an entity to readonly or protect it

Ok, indeed card-mod can disable the switch on the dashboard. But if you click on the item, you can still toggle it in the properties.

Then set tap-action to none

Of course, but it’s still available in the full entities list. What would be nice is a real readonly status.

Probably it is a matter of access rights. Non-admin users probably must not have access to the Settings.

Using assistant is fun.
If I tell it to turn off all lights, it also turns all hue plugs off, which of course will turn off the raspberry hosting HA on a Hue plug…
The only way to prevent it is to manually disable the hue plug in the HA interface.