You can add a number of difference sensors to the Sonoff devices. This document will describe how to add a DS18B20 temperature sensor.
The DS18B20 1-Wire digital temperature sensor from Maxim IC reports degrees C with 9 to 12-bit precision, -55C to 125C (+/-0.5C). Each sensor has a unique 64-Bit Serial number etched into it - allows for a huge number of sensors to be used on one data bus.
Wiring the DS18B20
Configuring the Sonoff
Retrieving the temperature via HTTP
http://sonoff/cm?user=<USER>&password=<PASS>&cmnd=status%2010
Ouput:
{ StatusSNS: { Time: "2018-06-14T07:34:49", DS18B20: { Temperature: 21.8 }, TempUnit: "C" } }
Integrating with MQTT
The temperature information will put published to the
tele/<SONOFFDEVICE>/SENSOR
{"Time":"2018-06-14T07:56:34","DS18B20":{"Temperature":21.9},"TempUnit":"C"}
Setting interval at which the sonoff will report it's status
Display current interval
> TelePeriod
Set interval
> TelePeriod <seconds>
Integrating with Homebridge
Install the mqtt-temperature-tasmota homebridge plugin.
> npm install -g homebridge-mqtt-temperature-tasmota
Configure the plugin in homebridge's config.json file:
{ "accessory": "mqtt-temperature-tasmota", "name": "sonoff98", "url": "mqtt://192.168.1.60", "username": "MQTTUSER", "password": "MQTTPASS", "topic": "tele/sonoff98/SENSOR" },
References
Reference | URL |
---|---|
Temperature Sensor - DS18B20 | http://wiki.jmehan.com/display/KNOW/Temperature+Sensor+-+DS18B20 |
Sonoff Basic | http://wiki.jmehan.com/display/KNOW/Sonoff+Basic |
Sonoff-Tasmota MQTT Overview | https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview |
Sonoff-Tasmota Sensor Configuration | https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration |
Sonoff-Tasmota Commands | https://github.com/arendst/Sonoff-Tasmota/wiki/Commands |
MQTT Web Client | http://www.hivemq.com/demos/websocket-client/ |