Hacking MQTT onto a Cheap Wifi Power Outlet

I have a Rancilio Silvia coffee machine, that needs time to warm up correctly in the morning – 30 minutes gets everything up to temperature, allowing me to draw excellent coffee shots.

For the past couple of years, I run a simple mechanical timer that turns on at 6am, and goes off at 8am which is fine for the days I go to work, but if I work from home, or it’s the weekend, I’m left with a cold coffee machine unless I turn it to manual mode – which often results in me forgetting to turn it off!

To get around this, I’d been planning on getting a smart switch which would integrate with my Home Assistant setup. I looked at the Belkin Wemo, but it seems a little expensive at $80 a pop.

I thought about designing and building my own one, but the prospect of messing around with mains power didn’t excite me, nor did 3D-printing a case – 3D printing plastic, by definition isn’t very fire resistant.

Browsing Hackaday.io, I stumbled across this project, and it got me wondering if I could find an ESP8266-based Australian WiFi outlet. After a bit of googling, I found something that at least looked the same for $AU20 delivered. Turns out it did have an ESP8266 under the hood!

I managed to re-program it, and now have it acting as an MQTT switch in Home Assistant. Write up here: https://myles.eftos.id.au/blog/2017/04/18/hacking-a-cheap-wifi-outlet

1 Like

I use the orvibo S20 switches. ~$20 (AUD), from places like gear best. I am also playing around with the xiaomi ones, but they are zigbee and require you to set up the eco-system (ie the hub).

Just buy the orvibo, they integrate straight into HASS.

cheers,

or you can get an itead Sonoff, and flash new firmware onto it. Then you just splice it into the cord of your coffee machine, and it is forever wireless.

these come in at about 5USD, and i use them on my lights. I have modded the firmware to automatically turn on when the power is switch on, which you would probably want in this case.

firmware: https://github.com/KmanOz/Sonoff-HomeAssistant
or the one i use:
https://github.com/arendst/Sonoff-Tasmota

EDIT: though looking at it, the KmanOz (who is a local on this forum) looks to be the one to use, and i am now contemplating re-flashing all of my sonoffs to Kmans.

They look cool, though I did want MQTT.

Also: sometimes buying off the shelf is way less fun than getting your hand dirty :slight_smile:

I’m going to look at the Sonoff for backs of light switches. I would reflash them with my MQTT setup.

The sonoffs are small (any other type are quite large), but you will probably struggle to get them behind the light switches.

Also remember that you probably wont have a neutral behind your light switch, meaning you cannot put it down there!

I have mine spliced into my downlight leads.

just had a look through the kmanOz code. Whilst it looks the goods, one thing i like about the other one is that htere is a simple web interface that you can use to configure, and all the settings stay in the EEPROM. That means there is a single file that you upload, then you set it up and it is done.

When you want to upgrade the firmware, you can just use the web server on each to upload the .hex file and it will upgrade, and you wont need to do any other configuration. Makes it much easier and quicker to manage.

just my 2c.

Had a quick flick through the kmanOz code - It looks like it does a similar thing to the firmware I use on my WiFi Switch and Garage Door opener, so porting that to the Sonoff should be pretty simple.

At the moment, my firmware (https://github.com/madpilot/WifiSwitch):

  • Communicates with MQTT over an encrypted channel (using TLS 1.2)
  • Verifies the identity of the MQTT server it is connecting to (via a fingerprint)
  • Logs messages to a remote syslog server
  • Stores configuration on a SPIFFS filesystem
  • Allows Over-the-Air Updates (from the Arduino IDE)

My TODO list (now possible due to some updates to the ESP8266 Arduino core):

  • Verify the identity of the MQTT server using a trusted certificate authority
  • Web interface for configuration (using a captivate portal)
  • Over-the-Air Updates via the web interface
  • Verification of Over-the-Air Updates using digital signatures (WIP: https://github.com/madpilot/Arduino)

I’ve got a bunch of articles about the firmware development here: https://myles.eftos.id.au/blog/tag/garage-door-opener

1 Like