ESP8266 / Sonoff Controlled Ceiling Lights

Thanks @Dullage

The only way it would work for me was to have Tasmota installed first, I still have a couple of unflashed versions so happy to test it out :smile:

I was able to do this with the sonoff Dual R2 flashed with tasmoto. I basically removed the wall switch and installed the Sonoff. Now the light and fan is controlled by my Google mini. I might add a zwave wall switch in the future if needed.

This is great, thanks for sharing.

Hello, im very interested in how you managed to use sonoff without neutral, could you explain? in brazil we usually only have tha phase and the return from the lamp, and i was told that without the neutral is impossible, I could try to put in the ceiling but will take a lot of trouble and will null my switch.

hi, I tried with your new code Sonoff basic here https://github.com/Dullage/SwitchedSonoffSimple. however i flash to the nodeMCU which is same ESP8266. I chage the code which will active the internal pullup resistor (line 318 replace the INPUT with INPUT_PULLUP. I test on my breadboard with a LED illustration for a relay on gpio 12. however it is not working with a switch.
I did another flashing your very first version code, it worked however when I tried to turn off my wireless, the switch did not work at all.
could you pls help to highlight some ideas.

by the way, thank very much for your sharing

Hi @michau83, Iā€™ll try and help if I can.

With the ā€œSimpleā€ version, what isnā€™t working? Does it not work at all? Do you get any MQTT state messages from it?

Hi, if you control with mqtt it is fine. But if you want to turn on and off by a switch then it is fail.

Hi @michau83, some things to check:

  • Are you using a rocker switch or a momentary button? sonoffGPIOPin expects a rocker switch and sonoffButtonPin expects a momentary button.
  • Are you sure the GPIO pin you are specifying is correct for your board? These can differ between boards and are regularly labelled differently to what you have to specify in the code. Perhaps flash a simple but of code onto the board (e.g. blink) to check?
  • Maybe add some Serial.println(ā€œStep Xā€); lines to the code and watch the serial monitor to see if anything is being detected?

Do you have a link to the Relay/D1 Mini that you used?
(Iā€™m a newbie when it comes to MQTT/ESP8266 and want to keep the different variables I may have to contend with lowā€¦)

This looks just the thing for what Iā€™m trying to do though! I had considered a Sonoff but after some less than stellar reviews on here about them being unsafe when sealed off in the ceiling I am leaning towards this idea instead.

Hi @Dullage, I flashed your code to the Nodemcu V1.0 board, your code assigned gpio14 for a switch and I applied same value in the code gpio14, that pin corresponding to D5 off nodemcu. I connected that pin to a normal light switch on the wall. Control via mqtt hass is fine but turn on/off switch did not work. I tried with the input_pullup and without pullup (+ a resistor) neither worked at all. I will put sometime for the serial.println.
Thanks

1 Like

Hi @Coedy, I mostly use Sonoff now so havenā€™t ordered any Wemos or Relays recent enough to have a link that still works. I donā€™t think thereā€™s anything particular about the oneā€™s I bought though.

How are you finding the Sonoffs? Are you using any special firmware other than Tasmota?

Iā€™m tempted to just ignore the bad press that sonoff have received as out of all of the users on here Iā€™ve only actually seen 2 charred/melted sonoffs which I think leans more to batch issueā€¦
Not to mention I have 2 Sonoffs sat on my table at home alreadyā€¦

Not wanting to jinx it but Iā€™ve had no problems. One or two have been running for over a year now and havenā€™t let me down.

Iā€™m not using Tasmota Iā€™m just flashing my firmware directly, I should probably have a look at Tasmota though.

Like you, my first foray into a Smart Home used several ESP8266 devices running code that I pieced together from available libraries. I thought I had a pretty good handle on the code, but I was recently convinced to give Tasmota a try and I am now in the process of updating all of my ESP8266-based devices to Tasmota.

Try it. Youā€™ll like it.

1 Like

Thatā€™s great, thanks a lot for your help. Iā€™ll probably stick with Tasmota, firstly due to never used ESP8266 devices previously and secondly because of the added benefits of tasmota that Iā€™ve seen (like TasmoAdmin control panel etc).

I can only imagine the crazy wiring that we will have above our ceiling lightā€¦ The previous owner of the house was a ā€˜laborerā€™ (Iā€™ve since discovered that in my case that means: ā€˜Jack of all trades apprentice that has been at a building site once or twiceā€™) and we have been fixing his fixes ever sinceā€¦

:rofl: Good Luck!

My homeā€™s previous owner thought he was pretty handy around the house. Like the carpenter that sees every solution is a nail, he ā€œfixedā€ everything with 3-inch sheetrock screws. One day a few years ago, the towel bar on the wall of a downstairs bathroom just fell off the wall. His 3-inch screw holding the towel bar went right through the drain pipe from the upstairs bath and the screw rusted out. But the funny part (not then as much as now) was that my daughter got an unintended shower when someone upstairs flushed the toilet and a stream of ā€œliquidā€ sprayed out of the hole in the drain.

I wonder what the next owner of this house will think of everything Iā€™ve done to the place.