Outdoor Weather / Temperature
Using homebridge-weather https://www.npmjs.com/package/homebridge-weather
Add the following weather accessory to the homebridge config.json
"accessories": [
{
"accessory": "Weather",
"apikey": "enter_your_own_key_here",
"locationByCoordinates": "lat=your_lattitudelon=your_longitude",
"name": "Weather"
}
]
Indoor Temperature
I'm taking indoor temperature from the Fibaro HCL temperature sensor, i.e. Aeotec multi-sensor.
Option1: cron/bash file to extract temperature to load into Domoticz temperature device
In the earlier post, I created a batch file to extract the temperature via REST API from Fibaro HCL to upload to a domo device. Not the most graceful way to do it, but it old school and works.
Option 2: Create a MQTT temperature feed using node-red
Another way, I just setup is using Node-red to keep pulling the temperature from the sensor and publishing it to domoticz/in topic to update the domoticz vitual device.
This is installed using https://www.npmjs.com/package/homebridge-mqtt-temperature This requires you to run mosquitto mqtt and node-red locally.
There's probably a few more things you can actually do with MQTT, so I've decided to move to MQTT instead and reduce the number of cron jobs.
- The timestamp that triggers the flow can be set to repeat on interval of 10 mins.
- The HTTP input "Room Temp" is the device URL from Fibaro.
E.g. http://user:password@192.168.1.XX:80/api/panels/temperature?type=devices&method=single&id=XX
Replace the username, password, IP address and device ID.
- Split is an easy way to remove the square brackets [] from the string output.
- Fibaro to Temp function to re-write the JSON for Domoticz
The customised function will extract the TemperatureH value from the return JSON string and insert the domotics JSON format into domoticz/in topic for domoticz to update the virtual temperature device.
E.g.
var temperature = msg.payload.temperatureH;
msg2 = {};
msg2.payload = '{ "idx" : XX, "nvalue" : 0, "svalue" : "'+temperature+'"}';
return msg2;
Again replace the XX with the Domoticz device ID.
No comments:
Post a comment