/Sonoff-Switch-Control

Console menu application for actuating Sonoff WIFI Smart Switch Basic by posting HTTP request. Written in Python.

Primary LanguagePythonMIT LicenseMIT

Sonoff-Switch-Control

This is console menu application for actuating Sonoff WIFI Smart Switch Basic by posting HTTP request written in Python. Your pc/laptop and Sonoff Smart Switches have to be on the same WiFi network and you need to know IP address for each of yours Sonoff Smart Switches(you will know by following procedure below).

Prerequisite

  • Python 3
  • Connect Sonoff WIFI Smart Switch Basic on your WiFi network. How to is HERE. IMPORTANT: You will actually write new firmware to Sonoff. Setup Arduino IDE Settings like THIS.
  • Configure Sonoff WIFI Smart Switch Basic following Sonoff configuration section from THIS guide.

Usage

In config.xml list all of yours Sonoff WIFI Smart Switches and they will appear in console menu. One switch is represented as a pair:

  • <name>
  • <IP address>.

Start script as python sonoff_switch_control.py and console like on the picture below will appear. For every listed switch ON and OFF option will be presetned in the list.

capture

Conclusion

I used this script for testing my Sonoffs at the beginning. Now, I run it on my Raspberry PI which I connect on IoT platform and controls Sonnofs over my phone or web remotely.