The Python script queries the ha-bridge for configured devices, and determines if they are mqtt or X10 devices. It then gets the state of each X10 device from HEYU‘s state engine and stored mqtt message states from the broker and updates the ha-bridge with that on/off and dim state as applicable.
-
Linux box, preferably a Raspberry Pi, with Python installed
-
Complete my Amazon Echo X10 Home Control tutorial
-
Set the directive “START_ENGINE AUTO” in the HEYU configuration file
-
Mosquitto broker (or the like) installed on your RPi, NOTE: Remember to set 'retain' to 'true' for your mqtt devices on HA-Bridge so the broker retains states
-
Copy the devices.py file to your "habridge" directory on the Raspberry Pi.
-
Make the script executable:
$ sudo chmod +x devices.py
-
Replace the [IP] variables in the code with your IPs.
-
Replace the [USER] and [PASS] variables in the code with your usernames and passwords.
-
From the command line:
$ python devices.py
-
In a cronjob
*/10 * * * * python /home/pi/habridge/devices.py > /dev/null 2>&1