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: