Hi there, this is my working in progress addon for ha, is a sonoff server based on https://github.com/mdopp/simple-sonoff-server
you can add sonoff devices and configure name for every channel in case you have multichannel device
Setup a new device
There are two ways of setting up the devices. Either with the sonoff.setupdevice.js script, or with wget (or anything else that can post an http request to a specific server).
currently just wget works
sonoff.setupdevice.js
Start sonoff.setupdevice.js on a computer you like. It will connect to the SONOFF device, so you will lose internet connection. When the scripts runs, you must long-click the black button on the device, and it will be configured to use the âserverâ as its cloud. Which now runs in your own network.
To run this on a linux device, the network manager must be installed. On an raspberry pi I would suggest to do the setup process manually with wget.
wget
Put the SonOff/Wemos device in AP mode (press and hold button for 5s)
Find the device and connect to it (SSID: ITEAD-10000xxxxx Password: 12345678)
Add route if necessary sudo route change 0.0.0.0 mask 0.0.0.0 10.10.7.1
(optional) use wget to read device info wget -O- 10.10.7.1/device
use wget to send local WiFi settings to device wget -O- --post-data=â{âversionâ:4,âssidâ:âyourSSIDâ,âpasswordâ:âyourSSID_PASSWORDâ,âserverNameâ:ân.n.n.nâ,âportâ:1081}â --header=Content-Type:application/json âhttp://10.10.7.1/apâ
The device will automatically drop out of AP mode and tries to connect to WiFi and server.
Web UI for name config
http://HASSIOIP:1080
this is the custom component for the addon
https://gist.github.com/gerswin/0cac4f8df4a947b0fec196b84a5e8d8b