RetroFed Forum
Your home away from modern life.
[Solved] How to detect the position of a dumb wall switch?
Post Reply
AuthorMessage
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
(edited) Quote

My nightstand lights are connected to a surge protector plugged into a Zigbee smart plug plugged into a dumb wall outlet controlled by a single dumb wall switch.

I have the smart plug set to default=On, so the wall switch works fine, and I can also turn the lights off from my phone or via an automation. All good so far.

What I WANT is to be able to turn the lights ON without getting out of bed, and irrespective of the position of the switch.

I tried putting a second smart plug in the switch-controlled outlet and making an automation to toggle the surge protector's smart plug when the switch's empty smart plug powers off/on via the wall switch, but it looks like it's not simple to detect a Zigbee device "disappearing". I found some integrations that detect zigbee devices disappearing, but those seemed more for running health checks to detect and repair moved devices than for live detection.

Any suggestions?

Edit:

Looks like a relay behind the switch will be my best bet. Thank you all!

20   Original
Onomatopoeia lemmy.cafe Onomatopoeia@lemmy.cafe
Joined: 2025-01-02
#2 · (edited) Quote Reply

What?

As I read through that Goldbergian stream of connectedness, I'm left wondering:

  1. Whatever you really trying to accomplish that brought this on

  2. Won't that wall switch always be a manual interrupt for the automation

Basically, don't you want to automate the wall switch or lock it to being always on? (There are wall plates for this).

10
paks feddit.uk paks@feddit.uk
Joined: 2023-07-16
#3 · Quote Reply

You may have better luck with a smart zigbee switch to replace the switch. Be careful that it complies with your local regulations etc.

If you want the aesthetic of the current switch, you can alternatively get relay modules which would sit in the box behind the switch and connect both to the switch and the socket.

If you don't want to mess with the in wall wiring, you can get covers that sit over a wall switch and contain/mount a battery smart switch.

If none of that suits, sounds like you're on the right track with powering the light from a non switched socket and using the presence/absence of a second device to identify the switch position. But I don't have advice on the fine details.

6
Joelk111 lemmy.world Joelk111@lemmy.world
Joined: 2023-07-01
#4 · Quote Reply

They do make button pressers, if your switch is the flat kind that could work I suppose.

I dunno what you expect us to tell you though, the switch is gonna turn off power to the circuit.

2
jonathan7luke lemmy.zip jonathan7luke@lemmy.zip
Joined: 2025-07-04
#5 · (edited) Quote Reply

If I'm reading this correctly, it sounds like what you want is a Shelly relay installed behind the dumb switch. Then you wouldn't even need the Zigbee wall plug at all.

3
slazer2au lemmy.world slazer2au@lemmy.world
Joined: 2023-06-30
#6 · Quote Reply

What? As I read through that Goldbergian stream of connectedness, I'm left wondering: Whatever you really trying to accomplish that brought this on Won't that wall switch always be a manual interrupt for the automation Basically, don't you want to automate the wall switch or lock it to being always on? (There are wall plates for this).

Kinda sounds like the setup is

Ac mains -> dumb switch -> ZigBee switch -> power board -> light. 

And they want to turn the light on while the wall switch is off, which sounds like it won't work because the power would be off, also turning power off to the ZigBee switch and the light.

4
Godnroc lemmy.world Godnroc@lemmy.world
Joined: 2023-06-22
#7 · Quote Reply

So, I've been looking at Shelley's smart switch modules which actually get wired in behind the light switch and use it as an input to control the smart switch. It involves simple wiring, requires a neutral in the switch box, but would give you control from either the switch or otherwise.

For me, it would let me control the lamps in my apartment and not show anyone that I had made all the switches smart.

11
Zwuzelmaus feddit.org Zwuzelmaus@feddit.org
Joined: 2024-12-14
#8 · Quote Reply

Any suggestions?

Yes:

Do not play stupid games with surge protectors.

2
FrederikNJS piefed.zip FrederikNJS@piefed.zip
Joined: 2026-01-17
#9 · (edited) Quote Reply

Sonoff makes a bunch of Zigbee smart relays, that can take input from a normal switch.

It's basically just a Zigbee relay that can connect and disconnect regular wires, just like a switch does. But it also has terminals for connecting a regular switch, which then just functions as a button that controls the relay.

Something like this: https://sonoff.tech/en-eu/products/sonoff-zbmini-extreme-zigbee-smart-switch-zbminir2

5
Matt The Horwood lemmy.horwood.cloud mhzawadi@lemmy.horwood.cloud
Joined: 2023-07-27
#10 · Quote Reply

So, I've been looking at Shelley's smart switch modules which actually get wired in behind the light switch and use it as an input to control the smart switch. It involves simple wiring, requires a neutral in the switch box, but would give you control from either the switch or otherwise. For me, it would let me control the lamps in my apartment and not show anyone that I had made all the switch...

Shelly relays are amazing, you wire the load and switches to it. Making a dumb light smart

Here in the UK we don't have a neutral wire the light switch, so I have a shelly in the light fitting

3
Godnroc lemmy.world Godnroc@lemmy.world
Joined: 2023-06-22
#11 · Quote Reply

Shelly relays are amazing, you wire the load and switches to it. Making a dumb light smart Here in the UK we don't have a neutral wire the light switch, so I have a shelly in the light fitting

Oh, that's genius! I know a light I had to skip making smart because it didn't have a neutral, but putting it in the light is a great solution!

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#12 · Quote Reply

Any suggestions? Yes: Do not play stupid games with surge protectors.

Is it stupid to put a "smart plug" between the wall outlet and a surge protector with two lights on it? Doesn't seem dangerous to me.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#13 · Quote Reply

Kinda sounds like the setup is Ac mains -> dumb switch -> ZigBee switch -> power board -> light. And they want to turn the light on while the wall switch is off, which sounds like it won't work because the power would be off, also turning power off to the ZigBee switch and the light.

The goal is correct, but the current setup is incorrect. Right now, I have:

AC mains -> dumb switch -> zigbee smart plug

AND

AC mains -> zigbee smart plug -> surge strip with two lights on it

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#14 · Quote Reply

What? As I read through that Goldbergian stream of connectedness, I'm left wondering: Whatever you really trying to accomplish that brought this on Won't that wall switch always be a manual interrupt for the automation Basically, don't you want to automate the wall switch or lock it to being always on? (There are wall plates for this).

I want the dumb switch to turn the lights on and off as usual, but I ALSO want to be able to turn them on and off with Home Assistant, irrespective of the dumb switch position.

The dumb switch is an interruption to the one outlet on the wall, sure. That's why I'm trying to do this "Rube Goldberg" setup.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#15 · Quote Reply

So, I've been looking at Shelley's smart switch modules which actually get wired in behind the light switch and use it as an input to control the smart switch. It involves simple wiring, requires a neutral in the switch box, but would give you control from either the switch or otherwise. For me, it would let me control the lamps in my apartment and not show anyone that I had made all the switch...

That looks like a good option, thank you for the tip!

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#16 · Quote Reply

If I'm reading this correctly, it sounds like what you want is a Shelly relay installed behind the dumb switch. Then you wouldn't even need the Zigbee wall plug at all.

I'd never heard of these, but they do sound like what I want! Thank you.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#17 · Quote Reply

They do make button pressers, if your switch is the flat kind that could work I suppose. I dunno what you expect us to tell you though, the switch is gonna turn off power to the circuit.

That's why I have the lights plugged into a smart plug in the second, NON-switched outlet of the 1-gang. Other commentors suggested a relay, which sounds perfect.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#18 · Quote Reply

You may have better luck with a smart zigbee switch to replace the switch. Be careful that it complies with your local regulations etc. If you want the aesthetic of the current switch, you can alternatively get relay modules which would sit in the box behind the switch and connect both to the switch and the socket. If you don't want to mess with the in wall wiring, you can get covers that sit o...

I like the relay idea better, thank you. I've done outlet and switch wiring before, but never for HA and not yet in this house.

Detecting the missing device seemed like it would be the easiest way as it wouldn't require wiring, but it seems that that's actually the more complicated option!

2
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#19 · (edited) Quote Reply

Assuming technically possible, this solution requires no other hardware:

Is it possible to make the smart plug default to the opposite of the last state? You could use the wall switch like a pushbutton (cut and restore power) and it would toggle, then maintain control from HASS. You might be able to save the last state of the smart plug, detect when it comes online after a power failure (theoretically), and set it to the opposite of the previous state in an automation.

3
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#20 · Quote Reply

Assuming technically possible, this solution requires no other hardware: Is it possible to make the smart plug default to the opposite of the last state? You could use the wall switch like a pushbutton (cut and restore power) and it would toggle, then maintain control from HASS. You might be able to save the last state of the smart plug, detect when it comes online after a power failure (theore...

That's probably possible, but doesn't solve my problem. That said, some commentors found my explanation confusing.

When the switch is toggled ON, I want the lights to go ON.

When the switch is toggled OFF, I want the lights to go OFF.

Irrespective of the switch position, I want to be able to turn the lights ON or OFF with Home Assistant.

It sounds like a zigbee relay behind the switch will be the way to detect the switch position.

2
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#21 · Quote Reply

That's probably possible, but doesn't solve my problem. That said, some commentors found my explanation confusing. When the switch is toggled ON, I want the lights to go ON. When the switch is toggled OFF, I want the lights to go OFF. Irrespective of the switch position, I want to be able to turn the lights ON or OFF with Home Assistant. It sounds like a zigbee relay behind the switch will be t...

My point is, you would keep the switch on no matter what and flick it off and on again when switching the lights on/off

2
Galapagon sh.itjust.works Galapagon@sh.itjust.works
Joined: 2023-06-10
#22 · Quote Reply

My point is, you would keep the switch on no matter what and flick it off and on again when switching the lights on/off

Isn't the default unavailable timeout like 5 minutes though?

2
Galapagon sh.itjust.works Galapagon@sh.itjust.works
Joined: 2023-06-10
#23 · Quote Reply

That's probably possible, but doesn't solve my problem. That said, some commentors found my explanation confusing. When the switch is toggled ON, I want the lights to go ON. When the switch is toggled OFF, I want the lights to go OFF. Irrespective of the switch position, I want to be able to turn the lights ON or OFF with Home Assistant. It sounds like a zigbee relay behind the switch will be t...

If you're putting a relay in the outlet box, you can probably eliminate your smart plug as well

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#24 · Quote Reply

If you're putting a relay in the outlet box, you can probably eliminate your smart plug as well

The second one that I attempted to use as a switch position detector, you mean? Because I think I'd still need the one in the un-switched outlet to turn the lights on and off.

1
paks feddit.uk paks@feddit.uk
Joined: 2023-07-16
#25 · Quote Reply

The second one that I attempted to use as a switch position detector, you mean? Because I think I'd still need the one in the un-switched outlet to turn the lights on and off.

A lot of relay boxes will both detect the switch position and toggle the power, so you should be able to get rid of all smart plugs that you were planning to use for this light.

The relay should have these connections:

  • Live input from breaker box
  • Neutral (both from breaker box and to socket)
  • Switched live output to socket
  • Connection to one side of the manual switch
  • Connection to the other side of the manual switch
2
Onomatopoeia lemmy.cafe Onomatopoeia@lemmy.cafe
Joined: 2025-01-02
#26 · Quote Reply

The goal is correct, but the current setup is incorrect. Right now, I have: AC mains -> dumb switch -> zigbee smart plug AND AC mains -> zigbee smart plug -> surge strip with two lights on it

Just replace the wall switch with a zigbee.

6
FrederikNJS piefed.zip FrederikNJS@piefed.zip
Joined: 2026-01-17
#27 · (edited) Quote Reply

That's probably possible, but doesn't solve my problem. That said, some commentors found my explanation confusing. When the switch is toggled ON, I want the lights to go ON. When the switch is toggled OFF, I want the lights to go OFF. Irrespective of the switch position, I want to be able to turn the lights ON or OFF with Home Assistant. It sounds like a zigbee relay behind the switch will be t...

@eddiereasoner@lemmus.org might actually be on to something...

Depending on the wall switch you have, you might be able to add a spring that makes it always return to the previous position when released. At least the switches I have in my house have a special little socket for adding a spring.

So in your Zigbee control panel you would configure the "power on behaviour" of the smart light/socket to "toggle".

Then I you would add the spring inside your physical switch.

Now when you press the switch it would cut the power to the light/socket briefly, and as soon as you release the switch the power would be restored.

If the light/socket is on, you press and release the switch, which cuts the power and the light/socket stays off due to the "toggle" behaviour.

If the light/socket is off, the light/socket is still powered, soo you can still turn it on via Zigbee, and if you pres the switch, it momentarily cuts the power and the toggle behaviour would now make if turn on.

This gives you basically the same behaviour as if you installed a relay, but if you use smart bulbs you gain the benefit of being able to control the brightness, color temperature, and hue, if it has those controls

3
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#28 · Quote Reply

@eddiereasoner@lemmus.org might actually be on to something... Depending on the wall switch you have, you might be able to add a spring that makes it always return to the previous position when released. At least the switches I have in my house have a special little socket for adding a spring. So in your Zigbee control panel you would configure the "power on behaviour" of the smart light/socket...

Thanks for the better explanation

2
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#29 · Quote Reply

That's probably possible, but doesn't solve my problem. That said, some commentors found my explanation confusing. When the switch is toggled ON, I want the lights to go ON. When the switch is toggled OFF, I want the lights to go OFF. Irrespective of the switch position, I want to be able to turn the lights ON or OFF with Home Assistant. It sounds like a zigbee relay behind the switch will be t...

I don’t think a relay would work because it wouldn’t let you turn the lights off without getting up, and would make it so the switch won’t turn the lights off without turning of the relay from your phone.

3
AA5B lemmy.world AA5B@lemmy.world
Joined: 2023-07-09
#30 · Quote Reply

I want the dumb switch to turn the lights on and off as usual, but I ALSO want to be able to turn them on and off with Home Assistant, irrespective of the dumb switch position. The dumb switch is an interruption to the one outlet on the wall, sure. That's why I'm trying to do this "Rube Goldberg" setup.

A smart switch makes all this complexity go away

3
AA5B lemmy.world AA5B@lemmy.world
Joined: 2023-07-09
#31 · (edited) Quote Reply

That's why I have the lights plugged into a smart plug in the second, NON-switched outlet of the 1-gang. Other commentors suggested a relay, which sounds perfect.

I never really understood the use case for those relays. While I also thought they were a cool idea, the more I thought about it, they just weren’t. You’re leaving the switch in a weird state that won’t be useful to most people

A smart switch should be the same wiring as the relay and take care of the entire problem in a much more straightforward way. You can even get them in toggle or paddle to be similar to whatever else you have.

Most importantly smart switch means the switch keeps operating like everyone expects, PLUS automation.

2
Jason2357 lemmy.ca Jason2357@lemmy.ca
Joined: 2023-07-11
#32 · Quote Reply

The goal is correct, but the current setup is incorrect. Right now, I have: AC mains -> dumb switch -> zigbee smart plug AND AC mains -> zigbee smart plug -> surge strip with two lights on it

Your idea works in theory, but in practice, using a ZigBee plug as a power sensor -even if you managed to program a way of detecting its online/offline status, will probably have too many issues.

The protocol is designed for low power and so has to be robust to temporary connectivity issues from interference. You would either have too much latency between the switch and the light turning on/off, or you would have phantom switching of the light whenever some other device in your house desides to do its thing.

It is a genuinely neat idea you had though.

2
bluGill fedia.io bluGill@fedia.io
Joined: 2024-08-15
#33 · (edited) Quote Reply

Here is a question you need to figure out: Switch is in the on position, and you use the remote to turn the light off, what happens when the switch is moved to off?

According to my wife the only satisfactory answer to this question is when the remote turns the light off the switch moves to off and so you cannot turn it off in this case! (she wants the same behavior from the old 3-way light switches that have been around for decades)

3
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#34 · Quote Reply

Your idea works in theory, but in practice, using a ZigBee plug as a power sensor -even if you managed to program a way of detecting its online/offline status, will probably have too many issues. The protocol is designed for low power and so has to be robust to temporary connectivity issues from interference. You would either have too much latency between the switch and the light turning on/off...

Theory is all I have! I'm too new at this. That's part of what makes it fun!

Yeah, it sounds like I want a relay behind the switch.

1
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#35 · Quote Reply

Here is a question you need to figure out: Switch is in the on position, and you use the remote to turn the light off, what happens when the switch is moved to off? According to my wife the only satisfactory answer to this question is when the remote turns the light off the switch moves to off and so you cannot turn it off in this case! (she wants the same behavior from the old 3-way light swit...

See my other comment. I guess a 3-way-switch with a relay could work, but not a relay in parallel with the switch. Sequence might achieve the goal but it’s not fully functional

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#36 · Quote Reply

Here is a question you need to figure out: Switch is in the on position, and you use the remote to turn the light off, what happens when the switch is moved to off? According to my wife the only satisfactory answer to this question is when the remote turns the light off the switch moves to off and so you cannot turn it off in this case! (she wants the same behavior from the old 3-way light swit...

Nothing! The lights stay off.

I want to be able to turn the lights on or off from both the switch and the app, each overriding the other.

The ideal case would be the switch physically moving to match the app toggle position, but I don't know if that's possible.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#37 · Quote Reply

A smart switch makes all this complexity go away

I didn't think so, not on the physical interface side. The switch in question is in the middle of a 4 gang, so having one be a different shape than the others would be slightly annoying. We can swipe down on the whole row to turn all lights off at the same time, and the switches I see appear to have a form that doesn't visually (physically, not an LED) indicate the switch position.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#38 · Quote Reply

A lot of relay boxes will both detect the switch position and toggle the power, so you should be able to get rid of all smart plugs that you were planning to use for this light. The relay should have these connections: Live input from breaker box Neutral (both from breaker box and to socket) Switched live output to socket Connection to one side of the manual switch Connection to the other side ...

Ah, so it would disconnect the physical switch from the circuit except as an IRL input for the HA relay entity ! That does sound perfect.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#39 · Quote Reply

My point is, you would keep the switch on no matter what and flick it off and on again when switching the lights on/off

Maybe? I'll think about that.

1
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#40 · Quote Reply

I never really understood the use case for those relays. While I also thought they were a cool idea, the more I thought about it, they just weren’t. You’re leaving the switch in a weird state that won’t be useful to most people A smart switch should be the same wiring as the relay and take care of the entire problem in a much more straightforward way. You can even get them in toggle or paddle t...

We don't usually toggle this switch by itself; normally we hit the first three at the same time in either direction. (4th is a ceiling fan)

When I turn the lights on from HA it's to read in bed, so the lights do end up matching the switch position when I'm done. Heck, maybe I'll use a script to turn the lights on for x minutes at a time if the switch is off.

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#41 · Quote Reply

@eddiereasoner@lemmus.org might actually be on to something... Depending on the wall switch you have, you might be able to add a spring that makes it always return to the previous position when released. At least the switches I have in my house have a special little socket for adding a spring. So in your Zigbee control panel you would configure the "power on behaviour" of the smart light/socket...

That makes sense, and sounds like a good solution. Thank you and @eddiereasoner@lemmus.org I'll have a look.

2
AA5B lemmy.world AA5B@lemmy.world
Joined: 2023-07-09
#42 · (edited) Quote Reply

I didn't think so, not on the physical interface side. The switch in question is in the middle of a 4 gang, so having one be a different shape than the others would be slightly annoying. We can swipe down on the whole row to turn all lights off at the same time, and the switches I see appear to have a form that doesn't visually (physically, not an LED) indicate the switch position.

True, whatever form a smartswitch is in, they usually are self-centering. The user is protected from appearance of a false state. They can match your other switches closely enough in the same room, but that will stand out in the same switch plate.

Admittedly I was never concerned about that either: even before home automation I installed dimmers and programmable switches that were already visibly different. I’m actually just now getting back to that consistency, after replacing most switches. That’s an expensive way to do it though

3
eddiereasoner lemmus.org eddiereasoner@lemmus.org
Joined: 2026-04-30
#43 · Quote Reply

That makes sense, and sounds like a good solution. Thank you and @eddiereasoner@lemmus.org I'll have a look.

Please let me know what you end up doing, because I might have a similar problem at some point.

2
Clay_pidgin sh.itjust.works clay_pidgin@sh.itjust.works
Joined: 2023-06-14
#44 · Quote Reply

Please let me know what you end up doing, because I might have a similar problem at some point.

I shall.

2
DominusOfMegadeus sh.itjust.works Reverendender@sh.itjust.works
Joined: 2023-07-11
#45 · Quote Reply

So, I've been looking at Shelley's smart switch modules which actually get wired in behind the light switch and use it as an input to control the smart switch. It involves simple wiring, requires a neutral in the switch box, but would give you control from either the switch or otherwise. For me, it would let me control the lamps in my apartment and not show anyone that I had made all the switch...

I may be overthinking this, but this Shelley module makes a dumb switch smart? And then you can turn the light on and off with the switch, but can also still control the light from your device, irrespective of the switch position, correct?

1
Godnroc lemmy.world Godnroc@lemmy.world
Joined: 2023-06-22
#46 · Quote Reply

I may be overthinking this, but this Shelley module makes a dumb switch smart? And then you can turn the light on and off with the switch, but can also still control the light from your device, irrespective of the switch position, correct?

That is correct

2
Post Reply
Back to top