This is a Python utility that translates the deCONZ rest api to MQTT messages. Will later be using WebSockets for fetching changes on the fly that are published to MQTT. There is also a full update of all items every x minutes, to make sure we have the last updated values.
The utility is connecting to the deCONZ rest api
- Handle scenes
- OpenHAB examples and details about how to use it
- Get WebSocket port from config
- Config what to care about sensors, groups, lights etc
To get this working you must have deCONZ running on a computer and the deCONZ rest api in place
Clone this repo and install the dependencies
$ git clone this.repo
$ cd this.repo
$ cp default.template.cfg default.cfg
- Update the new file
default.cfg
with all the correct values - Get a new api_key to insert if you do not have one
$ make init test run
Create systemd service, assuming repo was cloned to /home/pi
folder on a RaspberryPi, adjust paths if needed
$ sudo ln -s /home/pi/deconz2mqtt/deconz2mqtt.service /etc/systemd/system/deconz2mqtt.service
Set permissions:
$ sudo chmod 644 /etc/systemd/system/deconz2mqtt.service
Reload systemd then enable the service at startup:
$ sudo systemctl daemon-reload
$ sudo systemctl enable deconz2mqtt.service
$ sudo systemctl start deconz2mqtt.service
Check service status and view log snippet with:
$ sudo systemctl status deconz2mqtt.service
To view more lines of logs add -nXX
where XX is the number of lines e.g. to view 50 lines of logs
$ sudo systemctl status deconz2mqtt.service -n50
Start, stop and restart with:
$ sudo systemctl start deconz2mqtt.service
$ sudo systemctl stop deconz2mqtt.service
$ sudo systemctl restart deconz2mqtt.service