Jump to content

Sonoff - Wifi enabled Smart Switches


Laphroaig

Recommended Posts

large.Sonoff-TH-Details-01.jpg.e11ae0683

 

Hi folks,  I'm back again after a long hiatus and wouldn't you know, when I switched on my main lights using my DIY contactor half the blasted lights wouldn't work!  If you recall I used a couple of contactors in my box, one simply on a time switch and the other with an additional on-delay relay and a RF thermostat that would switch off half the lamps when the grow room got too hot and switch them back on once it had cooled down, with the delay relay to guarantee there was a suitable delay so they weren't cycling every few minutes.  It seems that at some point the RF thermostat decided it didn't want to talk to its controller on the box anymore so the on/off signal either wasn't getting sent or wasn't being received.  After much fiddling, swearing and gnashing of teeth I decided that the Danfoss RF thermostat and relay was buggered and a replacement would have to be found.  I was loathe to buy the same kit again once it had been proven to be unreliable (and they aren't that cheap either) I was about to run a cable through the wall of the grow room and put a bog standard mechanical thermostat inside when I remembered seeing there was a new generation of smart thermostats out there, so before getting out the drill and making holes I decided to do a little research to see if an alternative idea presented itself.  

 

large.26965577-f82c6c92-4d28-11e7-9034-7

 

Smart thermostats were a dead end, £200+ for a thermostat, you're F***ing kidding, apparently not.  So I went digging around for other alternatives and discovered Sonoff and a big 1000w lightbulb appeared above my head!  The basic Sonoff is around £6 and it's a pretty amazing bit of kit for the money, it's a WiFi enabled switch you can control with your phone or tablet.  You can also set it to turn on and off at a specific time and it'll switch up to 10 amps which is adequate for fans etc but you'll still need contactors if you're switching HID lamps on and off.  The next model up is a TH10/TH16 which has two relays that can switch 2 devices of up to 10 or 16 amps each respectively.  But that's not all because the "TH" stands for temperature and humidity, at which point I was getting tumescent!  For the princely sum of around £20 (including the sensor!) you can get a WiFi enabled switch that'll automatically switch devices on or off at specific temperatures or humidity levels, with manual override via your phone or tablet from anywhere and you can also monitor the temperature/humidity.  If that wasn't good enough you can use the temp/humidity readings from one switch to activate another or several elsewhere as they can talk to each other.   They'll even work with those newfangled things you can talk to Google Home and Amazon Echo.   They even do a 4 channel WiFi enabled switch that'll fit on a DIN rail!

 

large.sonoff_4ch_03_3.jpg.83c14267c75293

 

The only downside is that the switches communicate via the cloud so you need to be connected to the internet.  The local timings and temperature triggers will still work if you loose connection to the internet but the ability for you to manually control them from your phone or tablet or for one switch to trigger another is also disabled.  So if I wanted one switch to monitor the temperature and another to switch off one or more of the lights when the temperature limit was exceeded using a second switch it wouldn't work if the internet wasn't connected.   However it's a problem that you can fix, although a bit of mucking about is required to upgrade the standard firmware, fortunately it's well documented and although I've never attempted anything like it before I reckon it's doable even for a numpty like me and even if I bugger it up completely I've only lost £6.  There are several custom firmwares available but after reading up on it I've decided to use the Sonoff-Tasmota firmware by arendst available from GitHub.  As I'm on Macs I'm going to try and use PlatformIO for the actual firmware hack of the switches.

 

Then the freaking wheels fell of the bus!  The software backend to control the switches is a freaking nightmare on acid!  I guess it didn't help that everyone else seem to be running it on a RaspberryPI and I chose to try and get it working on a Mac Mini.  To begin with that wasn't too bad, I downloaded and installed Python and then the most comprehensive looking home automation server package I could find Home Assistant, I even got it running and installed an API to give me a running hyperlocal weather forecast. Suffice it to say I was well beyond the six or so UNIX shell commands I could remember how to use at that point.  For one moment I thought I was done... Okay Yaml (the language the configuration files are written in) was a royal pain in the ass but I'd got it to run an API so I'd figure out how to do stuff eventually, then I peered into the abyss, all this shit was just the front end, the backend MQTT, remote access, security and way down there far away in the distance... automation.  At which point I cried like a little girl and as it was just after 4am decided to go to bed and get a couple of hours sleep.

 

In the morning (roughly 2 hours later) everything was clear, I'm going to use the switches on the eWelink software on the cloud and as I've ordered a few extra switches spend most likely the rest of my life fucking about with the spares trying to get them working on my home network.  So is there anyone else out there who's into this shit?  I'd greatly appreciate some help :chains:

 

 

Edited by Laphroaig
add pictures
  • Like 8
Link to comment
Share on other sites

Brilliant post!  Welcome back @Laphroaig I'm no help I'm afraid but I'm sure some folks are into this stuff.

It's all beyond me but it looks brilliant...

  • Like 3
Link to comment
Share on other sites

Yeah the basic "out of the box" configuration and phone app seems to be good enough.  I just get a bit twitchy not being in full control of their ecosystem and reliant on an external cloud based service.  And thank you, it's nice to be back :) 

Link to comment
Share on other sites

Mr Bond was into all that but he's not been active.  Maybe worth having a search through his content.

;)

 

Link to comment
Share on other sites

@doobie01 There's a shedload of stuff on YouTube about them and all the hacking, MQTT, automation stuff too.  It's worth a look even if you're a bit of a dinosaur like me and just use them with the standard software.

Link to comment
Share on other sites

Will have a look on YouTube mate at it love the idea of home/grow automation but don't have the energy that was needed to learn and use it for raspberry pi type of stuff and the other stuff is as you said to expensive to justify spending on.

I'm kinda looking at it as a tool for stuff I already own kind of clobbering together a hybrid timer controller for the lights canopy fans and the dehumidifier aswell as a vent fan ect.

Just need them to do a fan speed controller for the rvks

 

Link to comment
Share on other sites

@doobie01  I got my switches off eBay, they said they were in Birmingham but it turns out they're lying and charging twice as much for them and sending them from China anyway.  The best price is direct from the manufacturer and being so cheap there probably won't be a customs charge for them, but I can't guarantee it.   Here's a link to the manufacturers website.

 

The eWelink client software they use runs on a phone or tablet and is free.  It comes in Apple and Android flavours.  You don't need anything else except WiFi and a connection to the internet to run them straight out of the box.

 

I was getting all twisted up trying to replicate at home the server side which is a free service they're already providing on the cloud, 'cos I'm a pedantic old bastard. :) 

 

 

Edited by Laphroaig
  • Like 1
Link to comment
Share on other sites

As soon as the ones I've ordered arrive from Birmingham (via China) I'll do a quick review and over the coming months I'll be having a go at making a few things with them in so watch this space :) 

 

Already have some great ideas for a lighting contactor and twin variac fan controller!  If they're as good as they seem to be they're going to be a complete game changer!

  • Like 2
Link to comment
Share on other sites

good i will look forward to see what you come up with.

i have a powerstar relay would it be straight forward wiring  as in cut female socket off powerstar and wire to the sonoff dual and ballasts plugs off and wire to sonoff dual outlet.

ive just enough knowledge to be dangerous  lol

Link to comment
Share on other sites

@doobie01  NO!  DO NOT go cutting off the leads to your lighting contactor and splicing one of these in.  You should use the Sonoff to activate the coil on a contactor component that'll look something like this.

 

large.s-l1600.jpg.307068be083ac4baf88629

 

The Sonoff will go between the A1 and A2 terminals that operate the coil that closes the contacts.  The terminals 1 & 3 carry the load in from the mains whilst the terminals 2 & 4 go to the lighting ballast. 

 

There isn't an issue connecting a fan or pump directly to the Sonoff as they typically only draw a few amps and should be well within the 10-16 amp tolerance of the units but HID lamps are a special case and for safety you should always use a contactor for them.  It simply isn't worth burning your house down for the sake of the £6 one of these costs.  

 

It's also worth mentioning that the Sonoff switches should always be placed inside a IP rated box with a couple of cable glands on either end for strain relief on the cable and the earth leads from each of the cable ends need to be joined using a choc block or similar to maintain the earth connection for the full cable run.  

 

Besides the Sonoff don't, as far as I'm aware, have a battery and internal clock and need to be connected all the time as they draw power from the mains coming in.  Having a mechanical timer in front of them just stops any power getting to them.  You could probably take the mechanical clock out of the Powerstar and replace it with a Sonoff but I've never looked inside one so I can't say for sure.

 

Peace

Edited by Laphroaig
Link to comment
Share on other sites

I have a samsung smartthings hub. I got myself a box of these things 5 i think. I have flashed them all with easyesp firmware and they work well in the samsung smartthings app. Better than that I can use local times/weather conditions ect ect to trigger these things. Last but not least I also bough a few xiaomi temperature and humidity sensors. I have them controlling different things through my house. I have a couple that I have got in my tent- 1 sonoff with an oil filled rad on the end of it comes on when my tent temp goes down below 20. I also have my humidifier plugged into another sonoff - again this takes a reading from my temp/humidity sensor and if/when the humidity drops below 40 my humidifier kicks in. I am considering adding my lighting into this system too - but im taking my time with it and want to ensure reliability. At the moment I use it and monitor it manually too. But it is nice to have the ability to control/alter conditions from anywhere with a mobile signal - i could see something like this being used to automate watering for short holidays ect. Nice and cheap too lol.

  • Like 1
Link to comment
Share on other sites

@Diddy Do the Smartthings Hub and Sonoff switches work okay without an internet connection just running on your local network?  It might be the answer to my dreams!  Do you still retain the ability to set up and operate on/off schedules, manual control from phone, etc. if you loose connection to the internet for any reason?

Edited by Laphroaig
Link to comment
Share on other sites

@Laphroaig Smartthings can survive without internet BUT only the smart lighting feature (Z wave devices) not with these devices above. They run on the cloud so therefore.......End of the day to achieve that you would need a local server without smartthings and just use these sonoffs.

If internet goes down and back on to the hub I do get a notification on the phone - so i suppose you could say I have an immediate warning when that happens (Had a couple very short drop outs here as bt are renewing lines) -

Power cuts do not kill off the smarthub though....so all your configs remain ect.

letscontrolit.com - is a hive on information regarding the sonoff - or more importantly the ESP8266 wireless chip which is what is inside the sonoff. Im sure the sonoff itself is capable of working over local network but unfortunately not through the smarthub. Sorry if i raised the excitement up too high lads.

 

Edit to add Homeassistant

Looks more promising than smartthings for internet outages.....I only just had a quick look since you mentioned it lol - I origionally got my "stuff" because 1. I love to tinker, 2. I just wanted to automate certain home things weren't really thinking "inside the tent" (love that phrase it's like uk420 version of "blue sky thinking lol).....But yes I wasn't thinking about things like internet dropping ect as it was all just home stuff i could manually do anyway and so not the end of the world kind of thing. Smartthings community IS very good tbh but the system itself does get let down by 90% being dependant on the cloud. You have got me on a bloody reading mission now lol...I might just work on separating the tent automation from the rest of the house..

 

Edited by Diddy
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use