ESP8266 MQTT switch with local on/off and feedback

Everything about esp8266 and more.
Post Reply
SweetPants
Posts: 2171
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.9895
Location: The Netherlands
Contact:

ESP8266 MQTT switch with local on/off and feedback

Post by SweetPants » Monday 11 June 2018 19:53

Project Scope:

When entering my house I want to be able to switch the light in the halway automatically between sunset and sunrise. So when the door opens, switch On the light for say 1-2 minutes and switch Off again using dzVentz. But I also want to be able to switch on/off the light using the existing wall switch(es).

This could be done using an extra (ESP8266 driven) relay in parallel with the original wall switch, but then you are not able to switch off the lights anymore with the wall switch and this is not suitable when having a hotel circuit (2 or more switches in series)

This could be solved by buying (expensive) wall switches which most of the time do not fit into the wall box or are totally different from the original.

Solution:
I've created an ESP8266 enabled switch that can be switched using MQTT, but also takes the switch wire from the wall switch as an input and do local switching if needed. When the wall switch is toggled, the switch also sends an MQTT update to domoticz to update the current switch state. The module is located in or near the lamp, so in case of a hotel circuit, it also works.

First test looks promising
Ubuntu 16.04.3 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

kimot
Posts: 55
Joined: Saturday 25 November 2017 18:18
Target OS: Raspberry Pi
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: ESP8266 MQTT switch with local on/off and feedback

Post by kimot » Tuesday 12 June 2018 23:05

ESPeasy works the same way without need scripts in Domoticz and works if Domoticz is down too.
Domoticz only sends "events" sunset, sunrise, switch slamp ( for remote control ) etc. Other ESPeasy sends door contact state to first (lamp) ESPeasy
This ESPeasy monitors mechanical switch state too, reports lamp state back to Domoticz and control lamp relay ( with timers if needed )

SweetPants
Posts: 2171
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.9895
Location: The Netherlands
Contact:

Re: ESP8266 MQTT switch with local on/off and feedback

Post by SweetPants » Wednesday 13 June 2018 14:50

kimot wrote:
Tuesday 12 June 2018 23:05
ESPeasy works the same way without need scripts in Domoticz and works if Domoticz is down too.
My solution does that too, no need for scripts, and no need to modify wall switches, just sense the presence of a switch signal, but you need some additional hardware to do that. And how about hotel circuits with two or more wall switches?

Edit: Have a second one running now on a 3 switch hotel circuit. Still looking good
Ubuntu 16.04.3 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

ronschaeffer
Posts: 8
Joined: Monday 11 September 2017 17:13
Target OS: Linux
Domoticz version:
Contact:

Re: ESP8266 MQTT switch with local on/off and feedback

Post by ronschaeffer » Friday 17 August 2018 13:41

Sounds really interesting. Please post some details about your hardware set up to detect the wall switch toggle. Thanks!

SweetPants
Posts: 2171
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.9895
Location: The Netherlands
Contact:

Re: ESP8266 MQTT switch with local on/off and feedback

Post by SweetPants » Friday 17 August 2018 14:30

ronschaeffer wrote:
Friday 17 August 2018 13:41
Sounds really interesting. Please post some details about your hardware set up to detect the wall switch toggle. Thanks!
Schematic: (The circled part converts the wall switch signal to something the ESP can handle
The attachment Feedback_Switch.png is no longer available
Hardware:
Feedback_Switch.png
Feedback_Switch.png (42.61 KiB) Viewed 10 times
Attachments
Hardware.jpg
Hardware.jpg (78.14 KiB) Viewed 6 times
Ubuntu 16.04.3 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests