SPM-Main is the main unit of Sonoff Smart Stackable Power Meter using RS485 to provide up to 128 relays. Besides support for the eWelink mobile app, we were promised an HTTP API at the time of the launch in September 2021.
ITEAD kept its promises and has now released the HTTP API for the SPM-Main smart power meter to allow IoT home automation users and developers to control SONOFF devices via existing home automation open-source platform or local HTTP client. It’s the same REST API used for SONOFF MINI & R3 smart switches, but it adds support for power monitoring as well.
The API allows you to switch between eWelink and DIY modes as needed, and provides the following functions:
- Device Status Broadcast – Returns the switch status of all channels with current, voltage, power, overload status, RS485 communication status, and more
- Get the List of Sub-device – List of SPM-4Relay connected over RS485
- ON/OFF Switch – Turn on/off channels of an SPM-4Relay as needed
- Overload Protection – Enable/disable and configure overload protection
- I Am Here – Check if subdevice can be reached
- Set Device Time – Set date/time of SPM-Main
- Historical Data of Sub-device – JSON with historical data of a subdevice per switch (voltage, current. power, etc…)
- Set up Real-time Monitoring Related Information – Return real-time data (voltage, current, power) of a specific outlet on the selected subdevice (SPM-4Relay)
- WiFi SSID and Password Setting – SPM-Main WiFi configuration (I suppose done over Ethernet…)
- OTA Firmware – Link to firmware update file and SHA256 hash
- Get Channel Operation Records – Reports when a specific outlet was on/off, got into overload mode, etc…
- Get Device State – Reports firmware version, WiFi status, RS485 communication status, and so on.
You’ll find documentation for the API on the developer website, as well as a short tutorial on the SONOFF website.
Many people are already flashing their SONOFF devices with ESPHome or Tasmota open-source firmware, but in most cases, it requires people to open the device and sometimes even solder some wires, which some people may feel uncomfortable doing, and the HTTP API removes the need to hack the hardware, as long as it’s implemented in your preferred home automation suite.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress