How to build an overridable MySensors relay based device (e.g. lamp with manual switch)
-
Hi all,
I finally got my first MySensors lamp working, controlled via OpenHab2.
My goal is to replace a couple of timers that we use either on vacation or when we have Christmas lights up with MySensors devices in the longer run.
In order to get wife approval factor, lamps need to be able to be manually switchable too. She doesn't want to have to get her phone out to turn the lamp on at odd times of day.
So far I have 2 ideas for indoor lights, and I'd like to know which one of these seems more sensible.
- Have a switch attached to the lamp cord (replacing the existing switch) with 2 wires running to the smart plug I'm building. This would change the state of the relay and send a message to OpenHab reflecting this change.
- Have a completely separate switch, battery powered, attached somewhere near the lamp being controlled. This would include an RF24 radio and act as a control for the lamp.
Option 1 would be cheaper, but have ugly wires running along the lamp wires.
Option 2 seems like it would be harder to miniaturize and power for longer periods of time.
Are there other options that I'm missing ?
What would you do ?
-
@anonymouslemming power is not a problem. The node would sleep as long as someone isn't pressing the switch. You should get 10 years battery life with 2xAA. If you want to make it smaller, use 2xAAA or something like cr123.
-
This project might be a good candidate https://forum.mysensors.org/topic/6938/battery-powered-glass-touch-switch
-
@mfalkvidd Ok, that's great then - sounds like Option 2 is the way to go.
Now to try and work out how to have a press event on one node trigger the on/off on another node via OpenHAB.
Are you aware of any examples like that ?
-
@anonymouslemming sorry I don't use OpenHab.
-
@anonymouslemming said in How to build an overridable MySensors relay based device (e.g. lamp with manual switch):
In order to get wife approval factor, lamps need to be able to be manually switchable too. She doesn't want to have to get her phone out to turn the lamp on at odd times of day.
A local control is a very good idea for most internal lights.
So far I have 2 ideas for indoor lights, and I'd like to know which one of these seems more sensible.
- Have a switch attached to the lamp cord (replacing the existing switch) with 2 wires running to the smart plug I'm building. This would change the state of the relay and send a message to OpenHab reflecting this change.
- Have a completely separate switch, battery powered, attached somewhere near the lamp being controlled. This would include an RF24 radio and act as a control for the lamp.
Option 1 would be cheaper, but have ugly wires running along the lamp wires.
This option will give the most reliable control of the light. If the light is in any way critical to normal day to day use then it is the only option that will give guaranteed control of the light.
Option 2 seems like it would be harder to miniaturize and power for longer periods of time.
This is a good choice if the light needs to be turned on as you enter the room, just like a normal room light requires.
The switch @mfalkvidd has pointed you to is a good example of this.The down side is you have a lot of places where instability can enter the system. If either of the two nodes loose their connection the light will not work. If your Gateway is down the light will not work. If your controller is down the light may not work. From experience I can tell you the WAF can drop very quickly if a light that is used daily does not work first time every time!
Are there other options that I'm missing ?
There may be other ways to achieve your goal. You could for example use a more novel approach like gesture control or perhaps a knock or clap sensor.
I have used the cheap X10 stick on battery powered wall switches in some areas but these need extra work to interface into the MySensors network.
Now to try and work out how to have a press event on one node trigger the on/off on another node via OpenHAB.
Do you need this to go through your controller? Usually the best way to treat a remote switch is to use direct node to node communication.
Perhaps you can give us a better idea of the physical layout of your setup, this may help us to suggest a more specific solution.
-
@Boots33 said in How to build an overridable MySensors relay based device (e.g. lamp with manual switch):
Do you need this to go through your controller? Usually the best way to treat a remote switch is to use direct node to node communication.
The reason I was considering going via the controller is so that the controller stays in sync. My worry with communicating directly with the node is that then the controller will think that the light is on, when it's off, or vice versa.
Perhaps you can give us a better idea of the physical layout of your setup, this may help us to suggest a more specific solution.
For the initial prototype, it's a lamp that sits in the far corner of the lounge. Control is currently the in-line switch on the lamp cable. I'd like to place the local control switch somewhere near it, if not on the cable, then on the bookcase that the lamp sits on.
The ethernet gateway is about 5m away from this switch and plug socket, with the controller running on a VM on the same ethernet network.
-
@anonymouslemming said in How to build an overridable MySensors relay based device (e.g. lamp with manual switch):
The reason I was considering going via the controller is so that the controller stays in sync. My worry with communicating directly with the node is that then the controller will think that the light is on, when it's off, or vice versa.
You can still notify the controller of the change but use node to node to activate the light. This is usually the simplest way to go. It also has the advantage that even if the controller is not available the light will still switch.
Like i said having the switch connected to the node that controls the light is the most reliable way, but not always the most convenient.
For the initial prototype, it's a lamp that sits in the far corner of the lounge. Control is currently the in-line switch on the lamp cable. I'd like to place the local control switch somewhere near it, if not on the cable, then on the bookcase that the lamp sits on.
The ethernet gateway is about 5m away from this switch and plug socket, with the controller running on a VM on the same ethernet network.
Where is the node that will control the light going to be. Are you fitting it inside the lamp or is it to be external?
You may get some ideas from these posts
AC-DC double solid state relay module
-
@Boots33 said in [How to build an overridable MySensors relay based device
You can still notify the controller of the change but use node to node to activate the light. This is usually the simplest way to go. It also has the advantage that even if the controller is not available the light will still switch.
Ok - I'll look into that.
Like i said having the switch connected to the node that controls the light is the most reliable way, but not always the most convenient.
The node is going to be in a plug socket type device instead of in the lamp in some way. The lamp will plug into this socket. So I can't work out a way to conveniently have the local switch attached to that without being quite ugly and ungainly.
Where is the node that will control the light going to be. Are you fitting it inside the lamp or is it to be external?
It'll be external - built into a plug socket. I figured that gives me more space to work, much like the X10 equipment I'm replacing.
You may get some ideas from these posts
AC-DC double solid state relay module
Thanks - I'll have a look over those !
-
This post is deleted!
-
Hi! How did it end?
Obtaining the WAF is the most part of my tinkering... I'm going for Sonoff ESP-based products to drive lights, mixing up the actuators via Home Assistant.
-
@ghiglie
It's stalled a bit due to work commitments. Prototype does everything EXCEPT keep the OpenHAB status in sync. I can control from openhab or from a separate node (that's just a switch).I need to update the code on the light node to keep openhab in sync and it'll be done. Then on to trying to build hardware that'll suit.
-
@anonymouslemming I understand. I'll track this topic!
-
@anonymouslemming Sorry for self-advertising, but i'm think my project https://forum.mysensors.org/topic/7417/ikea-varv-lamp-and-mysensors exactly what you wish - lamp with local control and, of course, OpenHab status automatically updated on flick a switch.
-
@doctor64
Hey - that does look really really good! I think I looked at it early in the project as inspiration.The lamps I'm using (http://www.ikea.com/gb/en/products/lighting/table-lamps/fado-table-lamp-white-art-10096375/) have in-line switches and there's no sensible space in the body to mount anything, so I need something that controls power at the plug socket end.
I also want them at the plug socket end just for more flexibility in the longer term so that they can drive things other than just lamps.
-
@anonymouslemming Hmm, you wish to use existing switch on mains cord? Or have some socket block with control is enough? I have use old one-for-all remote-controller socket for that - it have button, place for LED, nice case and i put inside arduino pro mini and 5 volt supply, using existing relay.
You are from Great Britain, right? So you have different power socket, but, may be you can find something similar?
-
I use the in-wall switches that I designed to control sonoffs around the room. The switch is basically a MySensorized scene controller. It does not have any relays or do any other kind of local switching. It simply talks to my Vera controller and the Vera controller handles the logic. Surprisingly, from pushing the switch to the light turning on, it is a nearly unnoticeable fraction of a second. When you think about what has to happen, that is awesome.
When the switch is pushed, it sends a radio signal to the gateway which tells the Vera controller that I pushed the switch. The Vera controller looks up the logic from my programmed scene and sends a wifi HTTP request to my Sonoff. The Sonoff then needs to process that and turn on the relay. ALL OF THAT in a fraction of a second.
Oh, and the WAF is a thumbs up.
-
@dbemowsk I was reading your thread... very inspirational. My main problem is can't change (for now!) the in-wall switches, so trying to figure out how to "decline" them.
-
@ghiglie There can be some issues in replacing normal switches with these kinds of switches. The main thing with ones that I built require a 110v (would work with 220v) line in the box where the switch is going to be located. Depending when the house was constructed, some wall switch boxes only have the switch line coming to the box. If this is the case then you are trying to re-wire things up where the switched device (light, fan , etc...) is located to send your power through the old switched line. That can be a pain if you don't know what you are doing. When doing that kind of re-wiring, I recommend labels, labels, labels to tell how things should be re-wired if you need to get it back to the way it was.
One other issue you can run into is that the box may be too shallow to where the switch won't fit all the way in with the wire nuts or connectors. If that is the case, you may need to cut out the old box and replace it with a new one.
If you are comfortable with remodeling and house wiring, these may not be issues for you.
-
Hmm - that's interesting. I've been looking at the Sonoff stuff since you posted this, thanks!
One of my goals is to have no Internet connectivity to my devices, and it looks like there are some firmware options that would let me achieve that. So that's a plus.
The minus so far is that I can't find anything about range extenders / relay (signal, not power) for these. Two of my early use cases are out of WiFi range, so I'd like to be able to have something between the shed and the controller that acts as a relay. One of the things that attracted me to MySensors is that nodes can act as relays for other nodes.
Do you know if that's possible with Sonoff ?
-
@anonymouslemming I am not even sure this would work because I am not sure about how the 433MHz side of the Sonoff RF's work, but what about adding a repeater of some sort to your setup. Something like this
http://www.dx.com/p/dc-12v-2a-433mhz-ni-hi-wireless-signal-repeater-white-454782?tc=USD&gclid=CjwKCAjwranNBRBhEiwASu908AcpaXRztfgkD8tTEGI-DKxVMZWfywYffgjebQVSD5gl9fvpyAfcsBoCz1UQAvD_BwE#.WaqirHWGNpg
-
I know this may sound weird, but I would recommend just going with the basic Sonoff switch and skip the MySensors part.
I build a lamp controlled by MySensors a long time ago, has external Tact button for on/off. Works great, took a while to build and I have an ugly box screwed to my lamp now that houses it all.
I wanted to build another, but didn't want it be be aesthetically displeasing. I ended up using these (https://www.itead.cc/sonoff-wifi-wireless-switch.html) and they are everything in one small package. You have wifi, a tact button for manual on/off, and it will report to any home automation system using MQTT after flashing some customer firmware (https://github.com/arendst/Sonoff-Tasmota). Just cut the power cable, screw into appropriate terminals and it's all good to go.
As much as I love MySensors; for this type of project I think there is a better solution.