Andymator
Posts: 27
Joined: Sat Jun 30, 2018 9:38 am

Controll Sonoff from RPi with Python

Wed Feb 13, 2019 5:19 pm

Hello

I just bought a Sonoff S26 (https://www.itead.cc/sonoff-s26-wifi-smart-plug.html). It pairs with my phone and I can turn it on and off with an app. Do you think it is a way to switch it on/off with a python program?

In the end I want my students to be able to use this in a RPi-school-project to turn high voltage-stuff on/off without having to cut wires and end up dead (and getting me fired).

Andyroo

Re: Controll Sonoff from RPi with Python

Wed Feb 13, 2019 6:57 pm

These folk had a firmware for the SONOFF units that would allow any web browser to control them https://www.letscontrolit.com

Other software on GITHUB may work without replacing the firmware on the SONOFF https://github.com/HarringayMakerSpace/sonoff-adhoc

danjperron
Posts: 3519
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Controll Sonoff from RPi with Python

Wed Feb 13, 2019 7:30 pm

Well it is more than 2 years than all my sonoff use firmware from https://github.com/arendst

This firmware is not compatible with the itead cloud but instead of a cloud it uses Mosquitto , a local MQTT broker, which is in on my raspberry Pi.

I'm able to access it on my phone via MQTT Dash. Or I could use the web page of each individual switch.
My Raspberry pi or any computer is able to access it using a MQTT client like paho in python.
My echo dots is able to access it using a wemo emulator call fauxmo.
And my home assistant access the switch via MQTT.

I made a small video in french on how to use an esp8266 with relay and one of the old software. Same firmware
https://www.youtube.com/watch?v=T4XjFoNEUm8 Sorry it is in french but I describe how to do it with python.

Return to “General discussion”