This firmware drives Sonoff Basic from iTead Studio, and powered by Mongoose OS. It targets to work with openHAB 2.4 or newer using the MQTT binding.
- LED blink pattern to indicate connectivity
- On board button to toggle the switch manually in case of no connectivity
- Bounce protection
- Device local schedule timer
- Countdown timer to toggle the switch
- Switch ON duration counter for energy consumption analysis
- Night Mode to turn off status LED
- Web interface for setting up WiFi SSID and password
- Reset to firmware defaults by holding the on board button for over 5 seconds
You have 2 options to implement this firmware:
- automatic configuration by Homie Convention
Homie Convention enables auto-discovery of the device by openHAB. Things, Channels and Items will be automatically setup.
- manual configuration with text files
Build using default cloud service:
cat mos-homie.yml > mos.yml
mos build --platform esp8266 \
--build-var FLASH_SIZE=1048576 --build-var BOARD=esp8266-1M
Build using default cloud service:
cat mos-manual.yml > mos.yml
mos build --platform esp8266 \
--build-var FLASH_SIZE=1048576 --build-var BOARD=esp8266-1M
Sonoff Basic has only 1Mbytes flash.
mos flash --esp-flash-params "dout,8m,40m"
-
Switch your PC or smartphone to the device's WiFi network. The SSID is named like Sonoff_??????, and the password is
SonoffBasic
. -
Use your browser to open http://192.168.4.1/
If you choose the manual configration option, please check the manual
folder.
Before using the local timer, make sure to set correct time zone via timer.tz
.
For Example, a Hong Kong user:
mos config-set timer.tz=+0800
And a user in California (DST):
mos config-set timer.tz=-0700
Then, create a JSON file schedules.json
and upload to the filesystem. Please reference the
supplied sample for syntax.
When the countdown timer reached zero, the switch will be toggled.
The local schedule timer will be disabled until the countdown is completed.
This timer is not persisted across reboots.
Example: set night mode from 23:00 to 6:30:
mos config-set nm.enable=true nm.bh=23 nm.bm=0 nm.eh=6 nm.em=30
Press and hold the on board button for over 5 seconds.