Let's continue with my Home Automation System design, based on the wonderful OpenHAB
This time the main attraction is a simple floor lamp that will be trasformed in a SMART Device, using a Sonoff Basic.
These are my soldiers:
For those who don't know it, SONOFF is a simple "wifi button", which allows you to control electrical loads remotely. The Basic version is the simplest one with a single relay.
It seems a simple job...
I will replace the standard button with the SONOFF...so, I will cut the wires to move away the button from the lamp...and plug these wires in INPUT e OUTPUT pins of the SONOFF.
Let the things be a little more complicated: on TASMOTA (https://github.com/arendst/Sonoff-Tasmota/wiki/DHT11-Wiring---Sonoff-Basic), I learnt that it's possible to manage an humidity/temperature sensor, linked to a free pin inside the SONOFF (GPIO14). A compatible sensor is the DHT11 and, luckily, I own some of them.
This sensor has 3 pin, Vin, GND and OUT. So I link Vin and GND to the right SONOFF pins and OUT pin to the GPIO14 (always inside the sonoff)...To discover the right position of these pins, I used again the TASMOTA Wiki (https://github.com/arendst/Sonoff-Tasmota/wiki/GPIO-Locations)
Here are the wires soldered and protected by a heat-shrinking sheath
Now, I have to solder the other side of the wires to the DHT11...
Also here I used a heat-shrinking sheath ...these pins are very close
And here is the complete device...
Now I make an hole in the plastic case to let the wires get out
And here is the lamp with the SONOFF and the DHT11...
Now it's software time. Using the well known TASMOTA web interface, I selected the right sensor connected to the GPIO14.
and then I inserted the usual MQTT informations.
Back to the home page, I noticed that the data acquired by the DHT11 is displayed on top of the page
Let's configure OpenHAB defining new items and the MQTT topic used by the SONOFF...
My MQTT topic will be smarthome/light_env/%topic%/%prefix%/
Looking to the TASMOTA console, I noticed a new prefix in the topic related to the temperature and humidity information:
This will be the topic which I'll use in the items definition.
Here is the result
Basic UI
And this is the switch for the lamp
-----------------------------------------------------
Similar items used in this project
-----------------------------------------------------