How to force a switch to always stay on

My fridge is on an IKEA Inspelning plug. What is considered best practice to make sure it doesn’t get switched off (both through Home Assistant and physically)?

I didn’t include it in an area or any dashboard and I’ve hidden it so it can’t be turned off through the dashboard. But users can still look for it in the devices page or through the power consumption cards. I’ve considered disabling the switch, but I assume I then can’t make an automation that turns it back on if someone turns off the switch itself?

ZHA or zigbee2mqtt ? With Zigbee2mqtt you can send a modified discovery message that does not include the button/switch

I do not own Ikea plugs, but some have firmware settings for always on. Next, almost all plugs have a move to automatically turn on if the plug is powered after an outage. Then you make the automation to turn it on a few seconds after you notice it was turned off. If you are paranoid about it you can add a time schedule. And you can set visible to false so it won’t get added to automatically generated dashboards, buI’s, but that is about it.

Blockquote
I’ve considered disabling the switch, but I assume I then can’t make an automation that turns it back on if someone turns off the switch itself?

Correct!

I currently use this as a temporary solution for a Sonoff Mini that needs to stay on all the time:

alias: TEMP - Switch Sonoff Mini Back On For Patio Fan
description: ""
triggers:
  - trigger: state
    entity_id:
      - switch.sonoff_mini_01_temp
    for:
      hours: 0
      minutes: 0
      seconds: 5
    to: "off"
conditions: []
actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.sonoff_mini_01_temp
mode: single

Not sure, if that’s a great solution for a fridge compressor, though, to turn it back on after less than 3-5 minutes - so, maybe you want to use for 5 minutes instead of my for 5 seconds

First explain why do you have fridge on switch at all if you never want/intend to turn it off? Then we’ll be able to help better…

I’m using ZHA

For the power metering.

Aha… ok, in that case i’d open it and solder a wire on relay contacts to disable relay- but that’s me, i have skills for that…i don’t know how you are with soldering, and, above all, i wonder if that plug can be safely opened and then closed again at all…
Perhaps consider another way to measure enegry? For example with shelly pm mini - it’s only energy meter, without relay. You can install that inside wall plug, since it’s darn small. But, then again, you must have some electric skills for that…
To solve current problem: one way is to make an automation which triggers say every minute and checks switch position. If it”s off, it turns it back on. Fridge won’t mind being out of power for 1 minute (i guess you could safely set that to even 5 minutes)

You also need a trigger for homeassistant startup to turn it on as well. maybe a trigger on the hour as well.
Things happen, power goes out, maybe HA starts before the zigbee is up and then the automation runs but it doesn’t turn on, etc.
Triggering the automation to turn on if it’s already on does not hurt a thing, but having extra triggers to make sure it’s not off more than an hour,

Not sure where in the world you are but Athom now do a “no relay” plug for power monitoring, either esphome or tasmota, also in AU, EU and US formats

Who are your users? Why would they search for it and turn it off?

Might be time to reevaluate who you allow to be users if this is an issue.

Slap the crap out of some people or just remove their access!!!

I wouldn’t normally say this but a time pattern trigger every hour should do the trick.
If the fridge can’t keep cool an hour then it needs to be replaced.

@anon60850888 there are many reasons why a switch might turn off.
I don’t know if this bug still exist in Google home but if there was no devices linked to the same room as the speaker, using the “turn off the lights” would switch everything off in all rooms

Understand what you are saying, but i don’t think the OP has that situation from their description.

A zigbee version would be a no-brainer for me.

I’d like to avoid WiFi as we have a cheap ISP router and thick walls that block a lot. Our internet connection is VDSL2 and everything is hardwired except our phones (which are fine with mobile data) so alltogether that puts upgrading the WiFi all the way down the priority list.

Yeah I guess checking every hour would be the only automation I need then. I’ve tried to avoid using automations as cron jobs (don’t know why it feels wrong to me) but for this I don’t see any other way.

I also try and avoid those automations but then sometimes they are the most reliable. Having a trigger that should work but then there is these few caveats (and some more that might be unknown) is not a great feeling for automations that need reliability.
But I do agree with the others here, solder the plug or get something that only monitors the usage.
Keep in mind soldering it will not look great in case of a fire.

I also have refrigerator on a power meter with switch-based wall socket :smiley:

I’ve made it like this, feel free to let me know if there’s something I can improve.

alias: Fridge auto-on
description: ""
triggers:
  - trigger: time_pattern
    hours: "*"
    id: Hourly
  - device_id: ##########
    domain: zha
    type: device_offline
    subtype: device_offline
    trigger: device
    id: Offline
  - type: turned_off
    device_id: ##########
    entity_id: ##########
    domain: switch
    trigger: device
    id: "Off"
    for:
      hours: 0
      minutes: 5
      seconds: 0
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Hourly
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.koelkast
      - conditions:
          - condition: trigger
            id:
              - Offline
        sequence:
          - action: notify.mobile_app_##########
            metadata: {}
            data:
              message: Fridge is offline
      - conditions:
          - condition: trigger
            id:
              - "Off"
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.koelkast
          - action: notify.mobile_app_##########
            metadata: {}
            data:
              message: Fridge switched off, trying to switch it on ...
mode: single

This is maybe overkill for a fridge situation, which could stand being off for a short time, but if you need a metering plug socket that is always on I’d use an ESP8266 based plug meter (e.g. Tasmota / ESPHome Smart Plug | Power Monitoring | Local Bytes) and use ESPHome Builder to program them without an on/off service (you could even de-program the physical on/off switch on the device).
Admittedly this uses WiFi rather than Zigbee to send the metering info but for sensor readings personally that would be acceptable to me. I prefer Zigbee for device control as it’s more reliable in my house.

You could do something like this

but with a zigbee clamp meter in the box:

https://www.aliexpress.com/item/1005003090284560.html?spm=a2g0o.productlist.main.13.388b6762CbfLs7&algo_pvid=7d8066ea-1344-4ad3-af5a-048fcc2220d6&algo_exp_id=7d8066ea-1344-4ad3-af5a-048fcc2220d6-12&pdp_ext_f={"order"%3A"108"%2C"eval"%3A"1"}&pdp_npi=4%40dis!GBP!37.79!31.09!!!49.46!40.69!%402103919917531823899382282e79c6!12000033735955782!sea!UK!4536424810!X&curPageLogUid=sQfWQrsp9uYM&utparam-url=scene%3Asearch|query_from%3A