sonoff-homie icon indicating copy to clipboard operation
sonoff-homie copied to clipboard

Homie based software for Sonoff module

Homie based firmware for Sonoff Basic, Sonoff S20 wifi relay or any ESP8266 based relay.

Features:

  • ON/OFF relay
  • Timer based relay
  • Configurable default (on boot) relay state - (MQTT independent)
  • Local button on/off
  • Keepalive feature - device will reboot if not receive keepalive message in given time
  • Reverse mode - ON command means relay off, OFF command means relay on (configurable on Homie level)
  • Watchdog timer
  • All Homie buildin features (OTA,configuration)

Build and upload

  • Attache module via USB-RS232 adapter
  • Set proper serial port number in plantformio.ini file (upload_port variable) if required
  • reboot module into program mode
  • Flash module:
    • execute pio run --target upload --environment sonoff for SONOFF, pio run --target upload --environment sonoffs20 for SONOFF S20 or pio run --target upload --environment generic for generic ESP8266
    • In Atom editor with PlatformIO prees F7 enter environment name (sonoff or generic) and choose PIO uload option from the list

MQTT messages

Property Message format Direction Description
_HOMIE_PREFIX_/_node-id_/relay01/relayState (ON|OFF) Device → Controller Current state of relay
_HOMIE_PREFIX_/_node-id_/relay01/relayState/set (ON|OFF) Controller → Device Change relay state
_HOMIE_PREFIX_/_node-id_/relay01/relayTimer/set \d+ Controller → Device Turn on relay for specific no. of seconds
_HOMIE_PREFIX_/_node-id_/watchdog/timeOut/set \d+ Controller → Device Time after witch watchdog disable/enable output fo 10s
_HOMIE_PREFIX_/_node-id_/watchdog/tick/set \d+ Controller → Device Tick for watchdog - renew timeout of reset
_HOMIE_PREFIX_/_node-id_/keepalive/timeOut \d+ Device → Controller Report of keepalive timeout value (seconds), 0 - keep alive feature is not active
_HOMIE_PREFIX_/_node-id_/keepalive/timeOut/set \d+ Controller → Device Set Report of keepalive timeout in seconds, 0 - keep alive feature is not active
_HOMIE_PREFIX_/_node-id_/keepalive/tick/set .* Controller → Device Keepalive message from controller to gateway - if device will not receive during keepAliveTimeOut time slot, it will reboot, keepalive is not active when keepAliveTimeOut is equal 0
_HOMIE_PREFIX_/_node-id_/$online (true|false) Device → Controller /true when the device is online, false when the device is offline (through LWT)