|
Post by papa on Apr 14, 2019 17:33:05 GMT
WiFi Energy-Saving NodeI believe many of us want to be careful about using energy. We want to turn off lights & appliances when they are not being used. Some appliances such as TVs & streaming devices are always on to some extent, ready to become active shortly after our remote commands them. I don't want to give up that instant-on feature, but don't need it 24 hours a day. An ESP8266 WiFi ECOplug like an Itead Sonoff S20 is good for switching AC appliances off & on. An always-on ECOplug will use some energy, but less than AV devices always in instant-on mode. Thanks to computourist & jimkernsjr, we have code to program an S20 to respond to openHAB/MQTT commands. Using this approach, we can have our Audio-Visual appliances in instant-on mode only during the time window that we typically use them. Note: Itead Sonoff S20 ECOplugs are still for sale. Itead is now also offering a newer S26 model. I ordered an S26 & will compare it to a Sonoff S20. See below.
Next, Preparing to Program a Sonoff Smart WiFi Socket
|
|
|
Post by papa on Apr 15, 2019 3:32:23 GMT
Quick Notes on a Sonoff S26 Smart WiFi Socket
Today I received the Sonoff S26 Smart WiFi Socket (ECOplug). It has very different construction from the S20. For one key difference, the S26 does not have the four convenient header holes (3.3v, gnd, Rx, Tx) for re-flashing the device with other programming. I was able to re-flash the S26 in an awkward & time consuming way. Fortunately, to program this one S26, I no longer need to open the case because I can use the Over the Air (OTA) programming via WiFi.
Update April 21, 2019: In this thread, I document an easier way to re-program an S26 without soldering. I saw little price difference between the S20 & the S26, but the S20 is easier to re-program. I recommend that you buy & re-flash Sonoff S20 Smart Sockets (ECOplugs) as long as they are available (especially if they still come with the 4 header holes).
Next, Preparing to Program a Sonoff Smart WiFi Socket
|
|
|
Post by papa on Apr 15, 2019 15:54:34 GMT
|
|
|
Post by papa on Apr 16, 2019 18:39:25 GMT
Programming the S20 ECOplug with This Forum's Firmware, ContinuedOpen ESP82xx_Devices.ino (downloaded above) with Arduino IDE. ECOplgS20AV59.h should also open in another tab. If not done already, customize ESP82xx_Devices.ino with your WiFI SSID, WiFi password, & IP of the computer running your MQTT server. Also in ESP82xx_Devices.ino, UNcomment (delete the initial // of) the line #include ECOplgS20AV59.h Follow instructions in this post & this post to upload this firmware to the S20. After the upload finishes successfully, momentarily release the pressure on the board & dupont pins in the programming strip (de-power the board). Then reapply pressure (power the board). The green LED should flash once & then stay on steady indicating the S20 has connected to your local WiFi network & MQTT. You should not need to program the S20 this way any more. You can now remove the FTDI programmer & dupont cable connections & reassemble the S20 in its case. For future upgrades, you should be able to use Over the Air (OTA) WiFi programming. Via my local network router's settings, I sometimes give my S20s permanent IP addresses. That might make them more likely to reconnect automatically after a power outage. See posts starting here for more hints. Next, Connecting the S20 ECOplug to OpenHAB
|
|
|
Post by papa on Apr 17, 2019 15:07:17 GMT
Connecting the S20 ECOplug to OpenHABNeeded in order for the following to work: a computer (possibly a Raspberry Pi) that hosts MQTT & OpenHAB. See this thread on installing openHAB/MQTT on a local network-connected computer. Except, the channel topic will somewhat differ from one for an RFM69 node. (See blue text in topics below.) As above, you might program an S20 as Node59 & use it to control Audio-Visual appliances on a power strip (as long as the appliances on the strip use no more than 10 amperes total current, according to the S20's specifications.) Here are OpenHAB configurations to accomplish that: (The outlet holding the S20 must be powered for these to work.) At PaperUI\configuration\Things, Add Thing (click + in blue disc) (If a Node59 Thing does not exist yet) click MQTT Binding Add Manually Generic MQTT Thing Node59 Location (arbitrary physical location) LR MQTT Broker - mqtt:systemBroker:embedded-mqtt-broker save (click check mark in blue disc) PaperUI\Configuration\Things\ Node59 Add channel (click + in blue disc), fill the fields: Channel type On/Off switch < choose type according to the item data type we want Channel id Node59Channel16 < arbitrary ? as long as we match in a linked item later Label Node59_Switch < arbitrary ? MQTT State Topic home/ esp_gw/nb/node59/dev16 Command Topic home/ esp_gw/sb/node59/dev16 In OpenHAB's \conf\ items folder, create a file named Node59.items & within Node59.items create this entry & save the file: Switch Act_Node59 { channel="mqtt:embedded-mqtt-broker:topic:mything:Node59Channel16" } Important: Link the above item to the above matching channel. Next, OpenHAB Configurations, Continued
|
|
|
Post by papa on Apr 18, 2019 14:58:01 GMT
OpenHAB Configurations, Continued Add to a .rules file in openHAB's \conf\rules folder: rule "AV ON 5:30am" // Base AV on (Node59) when Time cron "0 30 5 * * ?" then Act_Node59.sendCommand(ON) end rule "AV OFF 9:30am" // Base AV done (Node59) when Time cron "0 30 9 * * ?" then Act_Node59.sendCommand(OFF) end
Add to a .sitemap file in openHAB's \conf\sitemaps folder: Switch item=Act_Node59 label="AV59"
Next, Energy-Saving Node, Operation
|
|
|
Post by papa on Apr 19, 2019 13:46:21 GMT
WiFI Energy-Saving Node, Operation
Given the preparations in the previous posts AND that the power strip's OWN switch is on ...
To toggle the power strip & the Audio-Visual appliances (at instant on level) on or off, one can use the S20 push button OR use the virtual switch on the OpenHAB User Interface. The first rule in the previous post will turn on AV equipment (or whatever is on the power strip) at 5:30 am. The second rule will turn them off off at 9:30 am.
In the last post's 2 rules you can adjust the 2 "Time cron ..." lines to define your period when the AV appliances are ON. Note: Time cron expressions use a 24-hour clock. So for 1:00pm (13:00), use Time cron "0 0 13 * * ?"
|
|