Sonoff or not to Sonoff????

slimplynth

Senior Member
Hello, I've set up a raspberry pi with webserver and have a decent enough user interface, controlling lamps (pimote) and music.. i like it.. it's local and therefore free from the cloud, no reason or desire to really want to control a food blender from foreign shores. (Also got the Bluetooth working nicely with picaxe >>> rpi)

What I do not like is that the pimote is quite restrictive, you could leave the antenna off to reduce the RF range to try to isolate rooms (if your house is big enough) but effectively, it's limited to 4 channels.. i believe there is an 8 channel option (not enough).. so i looked at alternatives, as the end plan is to use picaxe, collecting data (temp/humidity/noise.. etc) and have an isolated control for 240 VAC devices to correct the issue (e.g. I bought a homemedic tinitus speaker - just to drown out unwanted night time sounds.)

Recently bought some Sonoff Basic modules and (initially) I was very happy but look carefully at the markings.. they do seem brilliant but its a potential home insurance nightmare. (That said I'm currently on with flashing the firmware to run MicroPython and another unit to use with the Arduino IDE)

Does anyone have any suggestions, other than Sonoff? (instantly exclude Google Home or Alexa)

Thanks
 

PhilHornby

Senior Member
What I do not like is that the pimote is quite restrictive, you could leave the antenna off to reduce the RF range to try to isolate rooms (if your house is big enough) but effectively, it's limited to 4 channels.
Assuming you're using the Pimote with Energenie's sockets, I have some code that might help.

For some reason, Energenie restricted themselves to 4 sockets in a 'group', but the sockets actually support id numbers 1-7. The Pimote can fully control 1-6 (as a group), and partially control the 7th (turn it ON, but not OFF - but that's actually a restriction of the HS1527 that it uses).

If you don't need to control the sockets as a group (i.e. use the All ON/All OFF commands), you can replace the Pimote with a Picaxe and 433MHz transmitter and control as many as you want. The HS1527 has a 20 bit controller code set at manufacturing time and 4 user controllable bits. By replacing the HS1527, you can have as many controllers as you want - and thus re-use the socket numbers.

Some example code:-

http://www.picaxeforum.co.uk/showthread.php?28662-Code-for-controlling-Energenie-(and-similar-)-RF-Remote-Control-Mains-sockets
(ENCODER)

and

http://www.picaxeforum.co.uk/showthread.php?28531-Decoding-HS1527-OTP-Encoder-data-signals-(with-learning-mode) (DECODER)
 
Last edited:

slimplynth

Senior Member
That's brilliant info, thanks for that Phil, much appreciated. (will use that at some point because I've put a copy the webserver in the father inlaw's workshop (for that application I definitely prefer to see the CE mark on the pi mote stuff, not that I distrust Sonoff, their manufacturing facility looks good).

NB and ot: currently in the depths of MQTT to control the sonoffs, got the Broker working on the pi.. pub and sub working through ssh but for the life of me can not figure out why there's no on/off happening on the lamp side.. try and try again.. do think the picaxe and pi were always meant to be together..
 

PhilHornby

Senior Member
(for that application I definitely prefer to see the CE mark on the pi mote stuff, not that I distrust Sonoff, their manufacturing facility looks good).
I just bought a Sonoff S20 - and am in the process of modifying its firmware (it's going to power-cycle the internet connection in a holiday property, if it loses contact with the outside world for any length of time).

IMHO, I think the S20 is better made than the Energenie socket. Mine has a CE mark (which may or may not be genuine...). There's even a fuse (which there isn't in the Energenie).

I'd like to replace my eleven! Energenie sockets, with something of my own design - but it's making them small and pretty enough, that has me beat at the moment. (I like the idea of Energenie's newer 'Openthings'-based units - but they're far too pricey for me.
 

slimplynth

Senior Member
Hi Phil

Yeah, I was thinking the same with the 'diy' - the ESP8266 modules + relay but after searching thought, you really can't beat the 'Sonoff Basic' - £15 for two modules.. and safer than anything i'd cobble together.

I do like the Energenie Pimote but found there's quite a long delay between pressing a button on the intranet page and the socket reacting.. maybe 3 to 5 seconds.. whereas I have a transistor switching a set of fairy lights in a glass vase (very nice :) ) controlled by one of the pi's gpio pins.. that reacts almost instantaneously, do you get the same delay?

I guessed it was down to my sloppy php/python - snippets below; thought the delay was caused by importing the gpiozero library on every button click but i couldn't find any other way..

Code:
else if ( isset($post['energenie_1_on']))
         {
            exec('sudo python3 energenie_1_on.py');
         }
And the energenie_1_on.py:

Code:
from gpiozero import Energenie

lamp = Energenie(1)
lamp.on()
Cheers

s
 

PhilHornby

Senior Member
I do like the Energenie Pimote but found there's quite a long delay between pressing a button on the intranet page and the socket reacting.. maybe 3 to 5 seconds......do you get the same delay?
I guessed it was down to my sloppy php/python - snippets below; thought the delay was caused by importing the gpiozero library on every button click but i couldn't find any other way..
Sorry - I forgot to reply to this :eek:

No - I've not seen any delays at all - I'm pretty sure you're correct in your diagnosis; the delay being the overhead in getting the 2nd Python script up and running.

BTW - I succeeded in getting my Sonoff S20/ESP8266 project up and running. It's amazing what you can achieve, when you use Google to find C++ code snippets, then stick them all together :)
 

slimplynth

Senior Member
Hi Phil, no worries, I've been scratching my head since the Beast From The East struck.. felt guilty for not going to work so decided Sonoff and MQTT needed sorted.. still no closer.. i've flashed with the BasicReslayOTA .. it uploads but that is it.. it should connect to the wifi but nadda.. i did read something last night that made me think the newer Sonoffs may not be able to connect.. gutted because the RPI + Sonoff seems like the best solution to 240V + Picaxe imo... might look for a different ESP based module..
 
Top