mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
✨ Add hook up with the MQTT service
This commit is contained in:
parent
87e9e3695a
commit
e7bb759397
2 changed files with 31 additions and 1 deletions
29
vscode/rootfs/etc/cont-init.d/mosquitto.sh
Normal file
29
vscode/rootfs/etc/cont-init.d/mosquitto.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Visual Studio Code
|
||||
# Pre-configures the Mosquitto clients, if the service is available
|
||||
# ==============================================================================
|
||||
declare host
|
||||
declare password
|
||||
declare port
|
||||
declare username
|
||||
|
||||
host=$(bashio::services "mqtt" "host")
|
||||
if bashio::var.has_value "${host}"; then
|
||||
password=$(bashio::services "mqtt" "password")
|
||||
port=$(bashio::services "mqtt" "port")
|
||||
username=$(bashio::services "mqtt" "username")
|
||||
|
||||
mkdir -p /root/.config
|
||||
{
|
||||
echo "-h ${host}"
|
||||
echo "--pw ${password}"
|
||||
echo "--port ${port}"
|
||||
echo "--username ${username}"
|
||||
} > /root/.config/mosquitto_sub
|
||||
|
||||
ln -s /root/.config/mosquitto_sub /root/.config/mosquitto_pub
|
||||
ln -s /root/.config/mosquitto_sub /root/.config/mosquitto_rr
|
||||
else
|
||||
bashio::log.info "The above error can be ignored if you don't have Mosquitto installed"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue