Skip to content

Commit

Permalink
Release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
krkeegan committed Jan 13, 2025
2 parents 83ce11d + 3ae075a commit b336c36
Show file tree
Hide file tree
Showing 34 changed files with 1,050 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.0
current_version = 1.3.0
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk --no-cache add python3-dev
COPY . /opt/insteon-mqtt

RUN apk add --no-cache py3-pip && \
pip3 install /opt/insteon-mqtt && \
pip3 install --break-system-packages /opt/insteon-mqtt && \
chmod +x /opt/insteon-mqtt/hassio/entrypoint.sh

CMD ["/opt/insteon-mqtt/hassio/entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ integrated into and controlled from anything that can use MQTT.

This package works well with HomeAssistant and can be easily [installed as an addon](docs/HA_Addon_Instructions.md) using the HomeAssistant Supervisor.

Version: 1.2.0 ([History](CHANGELOG.md))
Version: 1.3.0 ([History](CHANGELOG.md))

### Recent Breaking Changes

Expand Down
8 changes: 6 additions & 2 deletions config-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,19 @@ mqtt:
#retain: 1

encryption:
# Whether to enable a TLS encrypted connection to your MQTT broker.
enable: False

# Encryption Options for encrypted broker connections
# These settings will be passed to the `tls_set()` method. Please refer
# to the Paho client documentation for details:
# https://eclipse.org/paho/clients/python/docs/

# A string path to the Certificate Authority certificate files that are to
# be treated as trusted by this client.
# A Certificate Authority cert is REQUIRED for any encrypted connection.
# an encrypted connection will not be attempted unless this is specified.
# WARNING: If a ca_cert is specified, encryption will be enabled. You should
# however use the enable setting above as this is a deprecated way to enable
# encryption.
# ca_cert:

# Client certificate and private key - Optional
Expand Down
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "Insteon MQTT",
"description": "Creates an MQTT interface to the Insteon protocol.",
"slug": "insteon-mqtt",
"version": "1.2.0",
"version": "1.3.0",
"startup": "services",
"arch": ["amd64","armhf","aarch64","i386"],
"boot": "auto",
"uart": true,
"map": ["config:rw"],
"map": ["addon_config:rw", "homeassistant_config:rw"],
"options": {},
"schema": {},
"image": "td22057/{arch}-insteon-mqtt",
Expand Down
12 changes: 7 additions & 5 deletions docs/HA_Addon_Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ These instructions assume that you:
7. Click __Install__
8. Click __Start__ to start the Add-on, this will create your initial config
files.
9. Edit `/config/insteon-mqtt/config.yaml` as appropriate. See [configuration](configuration.md) for detailed instructions.
9. Edit `/config/config.yaml` (which can be found at '/addons_configs/83fc19e1_insteon-mqtt/config.yaml' within VSCode or SSH Addon) as appropriate. See [configuration](configuration.md) for detailed instructions.
10. Enable the [Discovery Platform](discovery.md)

> Alternatively, if you choose to define your entities in Home Assistant
Expand All @@ -48,10 +48,12 @@ These instructions assume that you:
## Backing up your Data

The default settings in the config.yaml file will save all user data to the
`/config/insteon-mqtt` directory. So you only need to backup and save this
data, you do not need to make a snapshot of the Insteon-MQTT add-on. This
directory may also contain a log file if you have enabled logging,
be careful, this can get quite large.
`/config/` directory. This directory is backed up when you make a snapshot
of the Insteon-MQTT add-on. This directory may also contain a log file if
you have enabled logging, be careful, this can get quite large.

You can also access this directory '/addons_configs/83fc19e1_insteon-mqtt/'
within VSCode or SSH Addon.

## Updating

Expand Down
3 changes: 3 additions & 0 deletions docs/battery_devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Battery devices (e.g. motion sensors, remotes, etc) are normally sleeping and wi

> As noted below, not all devices enter an _awake_ state after sending a message. For some devices, the only option is to manually wake them up.
## `*_all` Commands
None of the `*_all` style commands will work on battery devices, you must individually call the commands you wish to run on each battery device.

## Waking a Battery Device

### Automatically
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

The following is the bare minimum of changes to the `config.yaml` file that are necessary to get Insteon-MQTT started.

> For HomeAssistant Addon users, the `config.yaml` file is stored at `/config/config.yaml` within the addon
> and can be found at at '/addons_configs/83fc19e1_insteon-mqtt/' within VSCode or SSH Addon.
1. __Configure Modem__ Set the Insteon port as `port` under the `insteon` section to be the USB port or address of the PLM modem on your system. If using an Insteon Hub, see [Hub Instructions](hub.md).

2. __Config Devices__ Edit the `insteon` -> `devices` section and enter the hex addresses of all the devices you have under the appropriate device types.
Expand Down
8 changes: 5 additions & 3 deletions docs/hassio_development.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
## Testing Unreleased Versions in Home Assistant Supervisor
The Home Assistant Supervisor system makes most things pretty simple. Testing development releases or your own code fixes is mildly more difficult. The following instructions should help.

1. Uninstall the Insteon-MQTT addon. Your config files are saved in `/config/insteon-mqtt` so you should be okay. But you can back them up ahead of time just in case.
1. Uninstall the Insteon-MQTT addon. Your config files for the repository installed addon are saved in `/config/` (which can be found at '/addons_configs/83fc19e1_insteon-mqtt/' within VSCode or SSH Addon). If you install the addon locally, as described below, the configs for the locally installed addon will be at:
`/addons_configs/local_insteon-mqtt/` within VSCode or SSH Addon).
2. SSH into Home Assistant using the SSH addon
3. cd to `/addons`
4. run `git clone https://github.com/TD22057/insteon-mqtt.git` You can replace the repository with your own if you like.
5. cd `insteon-mqtt`
6. Use git to checkout the branch you desire.
7. When you are ready to install on Home Assistant you will have to do the following:
- edit `config.json`
- edit `config.json`
- remove the entire line that reads: `"image": "td22057/{arch}-insteon-mqtt",`
- edit the line that reads: `"version": "0.8.1",` to be something sensible, I use dates so: `"version": "2021.03.23.0",`
8. You may have to use `git stash` and `git pop` when pulling in changes, particularly after a release has occured. This is because both branches will have changed the version line.
9. Go back into your Home Assistant instance and go to `Supervisor->Addon Store`
10. In the menu on the top right click `Reload`
11. You should now see the Insteon-MQTT addon listed as a `Local Add-on` install that, it may take a few minutes to compile locally.
12. In the future to update your local version, you have to edit the `config.json` to trigger a new release, then run the `Reload` command in the store to see the new version.
12. You will have to copy your InsteonMQTT `config.yaml` file to the local config directory (which can be found at '/addons_configs/local_insteon-mqtt/' within VSCode or SSH Addon)
13. In the future to update your local version, you have to edit the `config.json` to trigger a new release, then run the `Reload` command in the store to see the new version.

11 changes: 7 additions & 4 deletions docs/initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When setting up Insteon-MQTT, adding a new device, or to solve problems, it is n
All of these functions are idempotent, they can be run multiple times without causing any issue.

> __Note__ Battery devices (e.g. motion sensors, remotes, etc) are normally sleeping and will not respond to commands sent to them. If the commands below are sent to a battery device, the command will be queued and will attempt to be run the next time the device is awake. For more details, see [battery devices](battery_devices.md)
> __Note__ Battery devices (e.g. motion sensors, remotes, etc) are normally sleeping and will not respond to commands sent to them. If the commands below are sent to a battery device, the command will be queued and will attempt to be run the next time the device is awake. None of the `*_all` commands will work on battery devices, you must individually call each desired command on battery devices. For more details, see [battery devices](battery_devices.md)
1. __Join__ This is necessary to allow the modem to talk to the device. This needs to be done first on any new device or device that has been factory reset. If you are seeing the error `Senders ID not in responders db. Try running 'join' again.`
- To join a __single device__ run `join`.
Expand All @@ -21,7 +21,8 @@ All of these functions are idempotent, they can be run multiple times without ca
Payload: { "cmd" : "join" }
```
- To join __all__ devices run `join_all`. This may be necesary when first setting up a network.
- To join __all__ non-battery devices run `join_all`. This may be necesary when first setting up a network.
- The `join` must be run individually on each desired battery device.
_Command Line_
```
Expand All @@ -47,7 +48,8 @@ All of these functions are idempotent, they can be run multiple times without ca
Payload: { "cmd" : "pair" }
```
- To pair __all__ devices run `pair_all`. This may be necesary when first setting up a network.
- To pair __all__ non_battery devices run `pair_all`. This may be necessary when first setting up a network.
- The `pair` must be run individually on each desired battery device.
_Command Line_
```
Expand Down Expand Up @@ -79,7 +81,8 @@ All of these functions are idempotent, they can be run multiple times without ca
Payload: { "cmd" : "refresh", ["force" : true/false] }
```
- To refresh __all__ devices run `refresh_all`. This may be necesary when first setting up a network. __This may take a while to complete__
- To refresh __all__ non-battery devices run `refresh_all`. This may be necessary when first setting up a network. __This may take a while to complete__
- This `refresh` must be run individually on each desired battery device.
_Command Line_
```
Expand Down
4 changes: 3 additions & 1 deletion docs/mqtt.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,15 @@ data.

Supported: modem

This will cause a get_engine command to be sent to each device (i.e. devices
This will cause a get_engine command to be sent to each non-battery device (i.e. devices
defined in the config file). The command payload is:

```
{ "cmd" : "get_engine_all"}
```

This command must be run individually on each desired battery device.

### Add the device as a controller of another device.

Supported: modem, devices
Expand Down
8 changes: 6 additions & 2 deletions docs/scenes.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ The `import-scenes` function will attempt to keep the order and all comments in
```

### `import-scenes-all`
The `import-scenes-all` function will perform the `import-scenes` function on all devices in the network. The same caveats about `import-scenes` apply to this function as well.
The `import-scenes-all` function will perform the `import-scenes` function on all non-battery devices in the network. The same caveats about `import-scenes` apply to this function as well.

This command must be run individually on each desired battery device.

> The `import-scenes-all` function can take quite a while to complete particularly if you have a lot of devices and scenes and/or a slow computer. For reference 85 devices on a raspberry pi takes about 20 seconds to complete. This may cause the command line to time out before the command completes. The command should continue to run and complete in the background however, you will not see the results printed to the screen. You can solve this by editing the file (../insteon_mqtt/cmd_line/util.py) and changing the line at the top from `TIME_OUT = 10` to something like `TIME_OUT = 30`.
Expand Down Expand Up @@ -140,7 +142,9 @@ The changes will only be made to the device on which this command is called. So
```

### `sync-all`
The `sync-all` function will perform the `sync` function on all devices in the network. The same caveats about `sync` apply to this function as well.
The `sync-all` function will perform the `sync` function on all non-battery devices in the network. The same caveats about `sync` apply to this function as well.

This command must be run individually on each desired battery device.

_Command Line_
```
Expand Down
16 changes: 16 additions & 0 deletions hassio/CONFIG-MOVED.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
InsteonMQTT Config Files Have Moved!!!

Your config files were copied from this location on <<MIGRATION_DATE>>

If InsteonMQTT is operating correctly, you may delete these files.


Config files can now be found at:

WITHIN Visual Code Addon or SSH Addon:

/addons_configs/83fc19e1_insteon-mqtt

WITHIN InsteonMQTT Addon:

/config/
34 changes: 26 additions & 8 deletions hassio/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
#!/bin/sh

/bin/mkdir /config/insteon-mqtt/
/bin/cp /opt/insteon-mqtt/config-example.yaml /config/config.yaml.default

/bin/cp /opt/insteon-mqtt/config-example.yaml /config/insteon-mqtt/config.yaml.default
# Migrate add-on data from the Home Assistant config folder,
# to the add-on configuration folder.
# We add a file to the old directory so that hopefully a user
# doesn't get confused in the future.

if [ ! -f /config/insteon-mqtt/config.yaml ]; then

if [ ! -f /config/config.yaml ] && [ -f /homeassistant/insteon-mqtt/config.yaml ]; then
mv /homeassistant/insteon-mqtt/* /config/ || \
{ echo "Failed to migrate InsteonMQTT configuration"; exit 1; }
# If user was using default data and log locations, edit them to match the new location
sed -i "s|storage: '\{0,1\}\"\{0,1\}/config/insteon-mqtt/data'\{0,1\}\"\{0,1\}|storage: /config/data|" /config/config.yaml
sed -i "s|file: /config/insteon-mqtt/insteon_mqtt.log|file: /config/insteon_mqtt.log|" /config/config.yaml
/bin/cp /opt/insteon-mqtt/hassio/CONFIG-MOVED.txt /homeassistant/insteon-mqtt/CONFIG-MOVED.txt
sed -i "s/<<MIGRATION_DATE>>/$(date)/g" /homeassistant/insteon-mqtt/CONFIG-MOVED.txt
echo "InsteonMQTT configuration successfully migrated from /config/insteon-mqtt."
fi

if [ ! -f /config/config.yaml ]; then
echo "Welcome to InsteonMQTT!"
echo "Creating your initial config.yaml file."
/bin/cp /config/insteon-mqtt/config.yaml.default /config/insteon-mqtt/config.yaml
sed -i "s/#storage: 'data'/storage: '\/config\/insteon-mqtt\/data'/" /config/insteon-mqtt/config.yaml
sed -i "s/#file: \/var\/log\/insteon_mqtt.log/file: \/config\/insteon-mqtt\/insteon_mqtt.log/" /config/insteon-mqtt/config.yaml
echo "Please edit the file /config/insteon-mqtt/config.yaml"
/bin/cp /config/config.yaml.default /config/config.yaml \
|| echo "Unable to create initial InsteonMQTT config.yaml file"; exit 1;
sed -i "s|storage: 'data'|storage: /config/data|" /config/config.yaml
sed -i "s|#file: /var/log/insteon_mqtt.log|file: /config/insteon_mqtt.log|" /config/config.yaml
echo "Please define the required settings in the file /config/config.yaml"
echo "(which can be found at '/addons_configs/83fc19e1_insteon-mqtt/config.yaml'"
echo "within VSCode or SSH Addon)."
echo "Then you can start InsteonMQTT."
else
python3 /opt/insteon-mqtt/hassio/start.py /config/insteon-mqtt/config.yaml start
python3 /opt/insteon-mqtt/hassio/start.py /config/config.yaml start
fi
2 changes: 1 addition & 1 deletion hassio/webcli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def handle_message(message):
socketio.start_background_task(target=app.config["worker"].do_work)
# We run it this way to disable buffering
command = ['python3', '-u', '/opt/insteon-mqtt/scripts/insteon-mqtt',
'/config/insteon-mqtt/config.yaml']
'/config/config.yaml']
command.extend(user_cmd)
# Save the user inputed text so we can display it back to the user
user_text = 'insteon-mqtt config.yaml ' + message
Expand Down
Loading

0 comments on commit b336c36

Please sign in to comment.