ESP8266 MQTT switch with local on/off and feedback Topic is solved
Moderator: leecollings
ESP8266 MQTT switch with local on/off and feedback
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
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
-
- Posts: 104
- Joined: Saturday 25 November 2017 17:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v3.8153
- Location: Czech Rep.
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
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 )
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 )
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
Re: ESP8266 MQTT switch with local on/off and feedback
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
-
- Posts: 12
- Joined: Monday 11 September 2017 17:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
Sounds really interesting. Please post some details about your hardware set up to detect the wall switch toggle. Thanks!
Re: ESP8266 MQTT switch with local on/off and feedback
Schematic: (The circled part converts the wall switch signal to something the ESP can handle Hardware: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!
-
- Posts: 12
- Joined: Monday 11 September 2017 17:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
Thanks. Have you been happy with the performance?
Re: ESP8266 MQTT switch with local on/off and feedback
What performance? It's just a switch and it takes only a few msec to switch either locally or via MQTT
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
SweetPants wrote: ↑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
Perhaps look at Tasmota..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Re: ESP8266 MQTT switch with local on/off and feedback
As said, it's already working fine, so no need for TasmotaDerik wrote: ↑Monday 20 August 2018 23:21SweetPants wrote: ↑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
Perhaps look at Tasmota..
-
- Posts: 12
- Joined: Monday 11 September 2017 17:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
Just meant whether it was working reliablySweetPants wrote: ↑Monday 20 August 2018 18:43What performance? It's just a switch and it takes only a few msec to switch either locally or via MQTT
Re: ESP8266 MQTT switch with local on/off and feedback
yup, running since jun 11 and never missed a local or MQTT switch up till now. Have 2 running, working on a third, waiting for some components.ronschaeffer wrote: ↑Wednesday 22 August 2018 14:13Just meant whether it was working reliablySweetPants wrote: ↑Monday 20 August 2018 18:43What performance? It's just a switch and it takes only a few msec to switch either locally or via MQTT
-
- Posts: 67
- Joined: Sunday 22 March 2015 16:18
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
ESP8266 MQTT switch with local on/off and feedback
Can it also be installed behind a light switch? Dutch version ‘inbouwdoos’?SweetPants wrote: yup, running since jun 11 and never missed a local or MQTT switch up till now. Have 2 running, working on a third, waiting for some components.
Domoticz| Zigbee | SONOFF
Re: ESP8266 MQTT switch with local on/off and feedback
Depends on the depth of the 'inbouwdoos', but I don't think so, never tried. Also be aware that the ESP antenna is a PCB antenna and known not to be very good, so placing it behind the original wall switch could give problems.
Last edited by SweetPants on Saturday 25 August 2018 12:37, edited 1 time in total.
- Antori91
- Posts: 136
- Joined: Sunday 12 February 2017 17:12
- Target OS: NAS (Synology & others)
- Domoticz version: 4.10717
- Location: France
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
Hello SweetPants,
Could you publish the ESP8266 code you are using for this?
Could you publish the ESP8266 code you are using for this?
Domoticz High Availability Cluster: Synology Dz V4.10693 (Main) - Raspberry Dz V4.10717 (Backup) - Scripts Node.js
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
-
- Posts: 7
- Joined: Monday 10 August 2020 13:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: ESP8266 MQTT switch with local on/off and feedback
Hello,SweetPants wrote: ↑Friday 17 August 2018 14:30Schematic: (The circled part converts the wall switch signal to something the ESP can handleronschaeffer 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!
Feedback_Switch.png
Hardware:
Hardware.jpg
I am facing the same issue and I want to update the status of the switch on domoticz when I toggle a wall switch. I am unable to access the Feedback_switch.png and hardware.jpg provided in this quote. Can you please provide me with the same and any additional information will be helpful.
Who is online
Users browsing this forum: No registered users and 0 guests