Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
sonoff [08.02.2018 00:02] – [Falshing Tasmota Firmware] Pascal Suter | sonoff [08.12.2018 09:50] – [MQTT interface for digitalSTROM] Pascal Suter | ||
---|---|---|---|
Line 11: | Line 11: | ||
===== alternative firmware ===== | ===== alternative firmware ===== | ||
* [[https:// | * [[https:// | ||
- | * works also on some other ESP based devices | + | * works also on lots of ESP based devices |
* provides control via serial / web / MQTT | * provides control via serial / web / MQTT | ||
===== What I intend to do with it ===== | ===== What I intend to do with it ===== | ||
Line 42: | Line 42: | ||
Here are the steps it took to flash the stock sonoff (current and more detailed instructions can be found in the [[https:// | Here are the steps it took to flash the stock sonoff (current and more detailed instructions can be found in the [[https:// | ||
- | - download the latest | + | - [[setup arduino IDE for ESP8266]] |
- | - create a subdirectory called '' | + | |
- | - start your arduino IDE and go to '' | + | |
- | - select OK and go to '' | + | |
- download the sourcecode tar.gz or zip package from the [[https:// | - download the sourcecode tar.gz or zip package from the [[https:// | ||
- extract the contents of the '' | - extract the contents of the '' | ||
- | - verify your settings under Tools are like these: < | ||
- | Board: " | ||
- | Flash Mode: " | ||
- | Flash Size: "1M (no SPIFFS)" | ||
- | Debug Port: " | ||
- | Debug Level: " | ||
- | LwIP Variant: "v1.4 Prebuilt" | ||
- | Reset Method: " | ||
- | Crystal Frequency: "26 MHz" | ||
- | Flash Frequency: " | ||
- | Upload Using: " | ||
- | CPU Frequency: "80 MHz" | ||
- | Upload Speed: " | ||
- | Port: Your COM port connected to sonoff | ||
- | </ | ||
- edit '' | - edit '' | ||
- **make sure your sonoff is disconnected from the AC power lines*** | - **make sure your sonoff is disconnected from the AC power lines*** | ||
Line 148: | Line 130: | ||
In order to turn the lights on in a room, you can publish to the topic '' | In order to turn the lights on in a room, you can publish to the topic '' | ||
mosquitto_pub -h mqtt.psuter.ch -u sonoffs -P sonoff -t set/ | mosquitto_pub -h mqtt.psuter.ch -u sonoffs -P sonoff -t set/ | ||
+ | |||
+ | ==== retention and QoS ==== | ||
+ | the mqtt-dss-bridge is a bit of a special service regarding retention and QoS since the state of our DigitalStrom environment is not lost when the service is restarted.. so DigitalSTROM has basically its built-in retention. when the mqtt-dss-bridge service is started it publishes the sate for all properties of our DigitalSTROM environment to the mqtt server. this includes things that where published before. By Default the mqtt-dss-bridge uses a QoS of 1 which means, every message will be sent out at least once. In my case i have created a rule that turns all the lights in the entire hous off as soon as one room enters the deep off state.. this allows me to press and hold the light switch for 3 seconds in the bedroom and the entire house will turn dark. unfortunately though, due to this qos setting of 1 the message will be re-sent as soon as the mqtt-dss-service is restarted. so as soon as at least one room in my house is in the deep-off state all lights will go out when i restart the service. to avoid this, i set the QoS to 0, so the mqtt server will ignore the re-published message upon restart of the mqtt server. To set the qos you need to edit the file in ''/ | ||
+ | |||
+ | a similar issue araises if you use for example node-red to create the above mentioned rule and set the retention flag to true or leave it unset which is true by default in node-red. the lights-off command will be kept on the mqtt server and it will be sent to the digitalstrom bus each time the dss bridge is reloaded. this is of course correct but not wanted in our case. so remember to set that flag to false in node-red for your dss nodes if you don't want to redo the last command on that node each time the mqtt-dss-bridge is restarted. | ||
===== Rules Engine - node-red ===== | ===== Rules Engine - node-red ===== | ||
Line 203: | Line 190: | ||
[Unit] | [Unit] | ||
Description=Node.js MQTT DSS Bridge | Description=Node.js MQTT DSS Bridge | ||
- | Requires=After=mosquitto.service | + | Requires=mosquitto.service |
+ | After=mosquitto.service | ||
[Service] | [Service] | ||
Line 229: | Line 217: | ||
[Unit] | [Unit] | ||
Description=Node.js Node-RED | Description=Node.js Node-RED | ||
- | Requires=After=node-red.service | + | Requires=node-red.service |
+ | After=node-red.service | ||
[Service] | [Service] |