-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from lnr0626/hassio-addon
Hassio addon initial submit
- Loading branch information
Showing
7 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG BUILD_FROM | ||
FROM $BUILD_FROM | ||
|
||
ENV LANG C.UTF-8 | ||
RUN apk --no-cache add python3-dev | ||
|
||
COPY . /opt/insteon-mqtt | ||
|
||
RUN pip3 install /opt/insteon-mqtt && \ | ||
chmod +x /opt/insteon-mqtt/hassio/entrypoint.sh | ||
|
||
CMD ["/opt/insteon-mqtt/hassio/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
DOCKER_REPO=lnr0626 | ||
|
||
TAG=$(jq -r '.version' ./hassio/config.json) | ||
|
||
docker run --rm --privileged \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v ~/.docker:/root/.docker \ | ||
-v "$(pwd)":/docker \ | ||
hassioaddons/build-env:latest \ | ||
--all \ | ||
-l \ | ||
--from "homeassistant/{arch}-base" \ | ||
--doc-url "https://github.com/TD22057/insteon-mqtt" \ | ||
--name "Insteon MQTT" \ | ||
--description "Insteon PLM <--> MQTT Bridge" \ | ||
--image ${DOCKER_REPO}/{arch}-insteon-mqtt \ | ||
--squash \ | ||
--version ${TAG} | ||
|
||
docker push ${DOCKER_REPO}/i386-insteon-mqtt | ||
docker push ${DOCKER_REPO}/i386-insteon-mqtt:$TAG | ||
docker push ${DOCKER_REPO}/armhf-insteon-mqtt | ||
docker push ${DOCKER_REPO}/armhf-insteon-mqtt:$TAG | ||
docker push ${DOCKER_REPO}/amd64-insteon-mqtt | ||
docker push ${DOCKER_REPO}/amd64-insteon-mqtt:$TAG | ||
docker push ${DOCKER_REPO}/aarch64-insteon-mqtt:$TAG | ||
docker push ${DOCKER_REPO}/aarch64-insteon-mqtt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Insteon-MQTT Bridge Quick Start for Hass.io users | ||
|
||
## First time installation | ||
|
||
This package assumes that you: | ||
|
||
- Have a hass.io installation up and running with either SSH access or a | ||
network share. | ||
|
||
- Have a working MQTT broker up and running. If not, do that first | ||
([Mosquitto](https://mosquitto.org/) is good choice, and has [an addon for | ||
hass.io](https://www.home-assistant.io/addons/mosquitto/)). | ||
|
||
- Have an Insteon PLM modem (serial or USB) or one of the older hubs that | ||
supports a PML port (usually 9761) on a fixed IP address. | ||
|
||
- Have hass.io connected to your mqtt broker. | ||
|
||
1) Create a directory for insteon-mqtt in your /addons folder: | ||
`mkdir /addons/insteon-mqtt` | ||
|
||
2) Copy the `hassio/config.json` file into `/addons/insteon-mqtt/config.json` | ||
|
||
3) Install the Local Insteon MQTT addon through the hass.io addon store. | ||
* If you do not see the 'Local Add-ons' repository or the Insteon MQTT | ||
add-on, click the refresh button in the top right corner on the Hass.io | ||
Add-ons page, and it should show up. | ||
|
||
4) Start the addon. This will setup the default config files under `/config/insteon-mqtt/config.yaml`. | ||
|
||
5) Edit `/config/insteon-mqtt/config.yaml` as appropriate. There is no | ||
automatic device discovery at this time. Insteon devices must already | ||
be linked with the modem as a controller and the device as a responder | ||
(press set on modem first, then the device). | ||
|
||
- Set the Insteon port to be the USB port or address of the PLM modem. | ||
- Set the modem Insteon hex address (printed on the back of the modem). | ||
- Edit the Insteon device section and enter the hex addresses of all | ||
the devices you have. | ||
- Edit the storage location. Each device will save it's database in | ||
this directory. | ||
- Edit the MQTT topics and payload section. The sample config.yaml file | ||
is designed for integration with Home Assistant but you can change it | ||
to use whatever style of messages you want. | ||
|
||
6) Restart the insteon-mqtt addon to pick up the changes. | ||
|
||
7) Download an Insteon device database for every device. This may | ||
take awhile and battery operated devices (motion sensors, remotes, | ||
etc) will fail because they aren't awake. Publish the following command | ||
to `insteon/command/modem` | ||
|
||
``` | ||
{ "cmd": "refresh_all", "force": false } | ||
``` | ||
|
||
Once that finishes, you should wake up each battery powered device | ||
(by activating it or pressing the set button - it may depend on the | ||
device) and then quickly send a command to the Insteon hex address | ||
of that device to download the database (hopefully this will be | ||
automatic in the future). Publish the following command to | ||
`insteon/command/aa.bb.cc` | ||
|
||
``` | ||
{ "cmd": "refresh", "force": false } | ||
``` | ||
|
||
If you haven't linked the device as a controller of the modem | ||
(press set on the device, then set on the modem), you'll also need | ||
to tell the device to pair with the modem. This step is also | ||
needed for complicated devices like the smoke bridge which require | ||
multiple Insteon groups to be configured. | ||
|
||
IMPORTANT: If you do not call pair for each device one time (it only needs | ||
to be done once) means that the correct controller/responder links from | ||
the device to the PLM modem may not exist and the functionality of the | ||
device with the Insteon-MQTT system may not work until pair() is called. | ||
|
||
Publish the following command to `insteon/command/aa.bb.cc` | ||
``` | ||
{ "cmd": "pair" } | ||
``` | ||
|
||
Downloading the device database and pairing only needs to be done | ||
one time. The refresh command only needs to be sent again if you | ||
make changes to the Insteon links (scenes) manually without using | ||
the server. | ||
|
||
## Updating | ||
|
||
To update, replace your `/addons/insteon-mqtt/config.json` with the most | ||
recent `hassio/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "Insteon MQTT", | ||
"description": "Python Insteon PLM <-> MQTT bridge", | ||
"slug": "insteon-mqtt", | ||
"version": "0.6.2", | ||
"startup": "services", | ||
"boot": "auto", | ||
"auto_uart": true, | ||
"map": ["config:rw"], | ||
"options": {}, | ||
"schema": {}, | ||
"image": "lnr0626/{arch}-insteon-mqtt" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
/bin/mkdir /config/insteon-mqtt/ | ||
|
||
/bin/cp /opt/insteon-mqtt/config.yaml /config/insteon-mqtt/config.yaml.default | ||
|
||
if [ ! -f /config/insteon-mqtt/config.yaml ]; then | ||
echo "Copying default config.yaml" | ||
/bin/cp /opt/insteon-mqtt/config.yaml /config/insteon-mqtt/config.yaml | ||
fi | ||
|
||
insteon-mqtt /config/insteon-mqtt/config.yaml start |