Can a switch be "locked"

I have a couple of aqara/xiaomi zigbee power sockets that I’m using for monitoring power on appliances such as a dishwasher.

Is it possible to lock the item in HA? Thus the state cant be changed from the GUI, but I can still see it is powered.

(the alternative is to hide from the UI)

You can use a template sensor.

This will allow you to read the state of the switch, but there will be no switch to turn on, or off.

In Lovelace you can define

tap_action: none 

e.g.

            - type: state-icon
              tap_action: none
              entity: switch.plug2
              style:
                left: 12%
                top: 29%

for an entity - which is different from not defining a tap action - and results in no action when clicking on the item.

1 Like