Smart Desk Lamp - keep Cord Switch working!


i wanted to switch my desk lamp via OH. But i wanted to have it switchable with the cord switch as well. Since it is a 12v LED lamp i made some tinkering i documented here:

The result looks like that: :wink:

I really wonder, if there is a smart way of keeping a cord switch usable with a 230v lamp. The principle would work, but i do not want to tinker like that with mains…


1 Like

Use a Sonoff as an overgrown switch?

@rossko57, i have actually two of them waiting in a drawer. But how would i integrate a cord switch to them?

Swithing a lamp ONLY via Alexa or phone would be not very well accepted by my better half :slight_smile:

Open the drawer and look at them. They have a cable in and a cable out, and a button to push for on/off. Is that not what you mean by “cord switch”?

Search this community for how to integrate with Openhab, involves reprogramming.

Well, true, technically: yes :slight_smile:

But i would not want to leave them open & accessible.

Have a look at YouTube. SuperHouse TV #21 .He shows a safe way to use your Sonoff. Maybe that’s something for you?

@ronvsanten Thanks for the great tip. I Subscribed it immediately :slight_smile:

However, for me personally, most cases they mention i can handle nicely with Homematic components as well.

Just the cord switches…

I found this devices: but it would force me into z-wave as new protocol. I think my “happy” solution would be this device in a homematic version :wink: :frowning:

For the desk lamps of the kits (running on mains) it might be the cheapest solution to just replace them with smart LED lamps and to hope that they can be “openHABed”…

Not quite the same but I have such a switch mounted to my shelf:

The alternative would be to install a switch or button to your microcontroller, which will then switch the relay. no need for the cord to stay in sight (or is this indeed what you want?)

@ThomDietrich in some cases the cord is part of the design (Desk lamps, some floor lamps (Stehlampe)).

Actually all the devices which use cord switches today. Where a cord switch is just usable and feels “right”.

The typical HM solutions (like your switch) are of cause ok. But still they are somehow “workarounds” for the cases where cords are visible and cord swiches are just good :-).

I thinks regarding usability my solution above is exactly what i desire. I just don’t want to switch mains like that.

Using a Homematic device with the trick i made in the cord switch is not possible i guess, since
a) i can not swich them with a pull down, so i would have to send back 230 to the “S” but
b) i could not toggle on change…

I get your point and don’t want to argue about “Where a cord switch is just usable and feels “right”.”

For me a cord and the switch on them are just ugly elements that are there in the classic approach and should move out of the way of the smart home :wink:

My second suggestion was to have a button on a cord come out of your “smart” box. Why don’t you want to do that?

Another approach I would think of is using an Sonoff PCB in conjunction with a Button or Switch on your cord, in a nice housing. Is that an option?

Also this might be interesting to you: Switcher – A WiFi Open Source Power Switch and Socket Based on ESP8266

I did look for a nice housing for Sonoff, none found. Opportunity for 3D printer owner? But then there’s the e-marking etc.
I do agree in the home something a bit more glamorous looking and spill/child resistant is desirable.

Of cause i can very well agree to have the cord as a technical necessity :blush: .

Sure, the second approach is an option. But since i would want to have only one cable, it would leave me having low voltage signals and mains in one cable. Not sooo nice.

If i would have a cord switch as a push button (Taster) i could easily use someting like

May be the most reasonable solution would be to replace the cheap ikea lamps with something like

Hide your electronics whenever you can :slight_smile:

3D printing is also not always the solution, depends on what you deem as “nice” in your home environment. I’ve hidden away the Sonoff modules behind things like shelves or the fridge, another nice place is under the foot of the floor lamp (“Stehlampe”).

So, my solution for the next desk is:

lets see if i can get it into openhab :slight_smile:

The usage of the ground-wire for anything else than ground is not legal in many countries and poses a huge safety risk. The cord should be changed to have more wires.

That is true, but I think this rules apply place for mains installations, not on low voltage things like this? Any experts on this around?

Makes no difference. High voltage is high voltage. If it’s part of a fixed installation, then regulations coveres it down to 12V (Think it’s same across EU). Regardless, I’d personally never use yellow/green for anything else than ground.

1 Like

Yes. High voltage is high voltage. But this is behind a 12v. power supply. It is neither high voltage nor fixed installaton.

But I agree, it is not the best style to use that green/yellow line for other purposes then the designated. Even there :slight_smile: