Skip to content

Commit

Permalink
Vcontrold: allow custom vito.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-io committed Oct 30, 2023
1 parent 302c14d commit c53a199
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions vcontrold/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->

## 1.9.0

- Allow custom vito.xml
- Upgrade debian to bookworm

## 1.8.4

- Added polish translation (@Qbunjo)
Expand Down
9 changes: 9 additions & 0 deletions vcontrold/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,12 @@ mqtt:
state_on: 1
state_off: 0
```
### Custom vito.xml configuration file
The module utilizes the `addon_config`` option (refer to https://developers.home-assistant.io/docs/add-ons/configuration/#add-on-advanced-options) for mounting a custom configuration file. It verifies the existence of a 'vito.xml' file during startup.

Ensure the file is placed in the specified path:
```
/addon_configs/vcontrold/vito.xml
```

4 changes: 3 additions & 1 deletion vcontrold/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config

Check failure on line 1 in vcontrold/config.yaml

View workflow job for this annotation

GitHub Actions / Lint add-on vcontrold

'addon_config' does not match '^(config|ssl|addons|backup|share|media)(:(rw|ro))?$'
name: Vcontrol add-on
version: "1.8.4"
version: "1.9.0"
slug: vcontrold
description: Vcontrol add-on
url: "https://github.com/Alexandre-io/homeassistant-vcontrol"
Expand Down Expand Up @@ -83,3 +83,5 @@ devices:
- /dev/ttyUSB1
- /dev/ttyUSB2
- /dev/ttyUSB3
map:
- addon_config
10 changes: 9 additions & 1 deletion vcontrold/rootfs/etc/services.d/vcontrold/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Declare variables
declare config_tty
declare config_file
declare config_deviceid
declare config_commands

Expand All @@ -14,9 +15,16 @@ declare config_commands

## Get the 'message' key from the user config options.
config_tty=$(bashio::config 'tty')
config_file=/etc/vcontrold/vito.xml
config_deviceid=$(bashio::config 'device_id')
config_commands=$(bashio::config 'commands')

## Check if custom vito.xml file exist
if [ -f "/config/vito.xml" ]; then
bashio::log.info "Using a custom vito.xml file"
config_file=/config/vito.xml
fi

# Cleanup scripts
rm /etc/vcontrold/1_mqtt_commands.txt || /bin/true
rm /etc/vcontrold/2_mqtt.tmpl || /bin/true
Expand Down Expand Up @@ -57,7 +65,7 @@ fi
## Run your program
if [ "$VCONTROL_HOST" = "localhost" ] ; then
bashio::log.info "Starting local vcontrold..."
exec /usr/sbin/vcontrold -n -U root -d $config_tty
exec /usr/sbin/vcontrold -n -U root -d $config_tty -x $config_file
else
# do nothing - needed as a dummy job to keep the dependency job running
tail -f /dev/null
Expand Down

0 comments on commit c53a199

Please sign in to comment.