How to prevent HA from changing the state of a switch?

I recently installed a lot of power outlet plugs to better monitor my power usage. All of these power plugs also function as switches. I would like to prevent HA from making changes to the state of some of the switches (i.e. because my refrigerator and my router are attached to them), while still displaying the state and measuring power consumption. Is there a way to accomplish this?

I currently have setup an automation that immediately toggles the switch back on, but the power interruption is still annoying. And in the case of the switch for my router, toggling it back on with HA doesn’t work, becuase the damn router is now down.

Is there some kind of “child lock” setting? I have Tasmota and Zigbee plugs and some of them have this, but it will depend on the manufacturer. There may also be a start up setting to cater for genuine power outages.

Otherwise, I wouldn’t have thought HA should be turning off sockets spontaneously - it will only do it if you’ve told it to! You might try adding a “do not turn off” attrubute to the switch entity with customize, then you can add a condition to your automations/scripts so that fridge and router sockest are left alone.

There is a “child lock” setting! I thought this would prevent manually switching on the physical device itself, but I’ll check if it works for switching from HA too.
You also had the right intuition: My motivation here is to prevent accidental changes. I created an automation and selected the wrong switch … my router spontaneously powering down several times a day was not fun.
I already experimented with a custom attribute, but you have to check this in every single automation, script or dashboard that you create. It also doesn’t help you at all if you put the wrong switch in a scene, since you cannot check the attributes there.

It would be really cool if I could tell HA ‘don’t mess with that thing’. I think it would be usefull not only for switches.

Ah. Not sure either - I’ve never used mine.

add a confirmation clause to the action statement of your card:

type: tile
entity: light.master_bedroom_outlet_1
tap_action:
  action: none
icon_tap_action:
  action: toggle
  confirmation:
    text: are you sure?

Or change the action to no action

When you do this you also have double tap action and the tap and hold to deal with you may use them to override or make sure they’re off too…

Docs on actions:

Yes, this works for UI elements. But:

  • If you ever forget it somewhere, you may be in trouble.
  • Automatically generated elements cannot use this.
  • It doesn’t prevent you from accidentally changing the state with automations, scenes and scripts.

Have you ever considered using a Shelly EM?
This device uses power clamps that you can clamp around your power cable.
https://www.shelly.com/en/products/shop/shelly-em-120a

This is really not a configuration I would do. All smart plugs eventually fail. When it fails consider the impact. So like on a router, it fails, you lose internet, not the end of the world. If it’s on your furnace, and it fails, and the house freezes up and pipes burst that’s super bad. Same with a sump pump. A fridge is someone in the middle, how important that is to you is up to you. Just always consider the failure modes…

For these kinds of loads consider using a non-invasive CT clamp either in the breaker box or in an external box next to the plug. That gives you the reliability of being hardwired (50 year life expentancy) and current monitoring vs a 2-5 year life expectancy for a zwave switch.

1 Like

@PeteRage & @complex1
This is excellent advice! I’ll try to replace at least some of these critical switches. The appeal of the power plugs is the ease of installation, because I’m really bad with tools. Looks like I’ll have to make some new experiences and get my hands dirty :slight_smile: