diff --git a/futurehome/config.yaml b/futurehome/config.yaml index 7dd4d43..650c5b7 100644 --- a/futurehome/config.yaml +++ b/futurehome/config.yaml @@ -32,6 +32,10 @@ schema: tp_username: 'str?' tp_password: 'password?' tp_allow_empty: 'bool?' + custom_mqtt_host: 'str?' + custom_mqtt_port: 'int?' + custom_mqtt_user: 'str?' + custom_mqtt_pwd: 'password?' demo_mode: 'bool?' show_debug_log: 'bool?' diff --git a/futurehome/rootfs/etc/services.d/futurehome/run b/futurehome/rootfs/etc/services.d/futurehome/run index 2654ed1..b48410b 100755 --- a/futurehome/rootfs/etc/services.d/futurehome/run +++ b/futurehome/rootfs/etc/services.d/futurehome/run @@ -11,6 +11,10 @@ export FH_PASSWORD=$(bashio::config 'fh_password') export TP_USERNAME=$(bashio::config 'tp_username') export TP_PASSWORD=$(bashio::config 'tp_password') export TP_ALLOW_EMPTY=$(bashio::config 'tp_allow_empty') +export CUSTOM_MQTT_HOST=$(bashio::config 'custom_mqtt_host') +export CUSTOM_MQTT_PORT=$(bashio::config 'custom_mqtt_port') +export CUSTOM_MQTT_USER=$(bashio::config 'custom_mqtt_user') +export CUSTOM_MQTT_PWD=$(bashio::config 'custom_mqtt_pwd') export DEMO_MODE=$(bashio::config 'demo_mode') export SHOW_DEBUG_LOG=$(bashio::config 'show_debug_log') diff --git a/futurehome/src/index.ts b/futurehome/src/index.ts index 90a6c9a..1e00207 100644 --- a/futurehome/src/index.ts +++ b/futurehome/src/index.ts @@ -22,16 +22,22 @@ import { pollVinculum } from './fimp/vinculum'; const localApiPassword = process.env.FH_PASSWORD || ''; const thingsplexUsername = process.env.TP_USERNAME || ''; const thingsplexPassword = process.env.TP_PASSWORD || ''; - const thingsplexAllowEmpty = (process.env.TP_ALLOW_EMPTY || '').toLowerCase().includes('true'); + const thingsplexAllowEmpty = (process.env.TP_ALLOW_EMPTY || '') + .toLowerCase() + .includes('true'); const demoMode = (process.env.DEMO_MODE || '').toLowerCase().includes('true'); const showDebugLog = (process.env.SHOW_DEBUG_LOG || '') .toLowerCase() .includes('true'); - const mqttHost = process.env.MQTT_HOST || ''; - const mqttPort = Number(process.env.MQTT_PORT || '1883'); - const mqttUsername = process.env.MQTT_USER || ''; - const mqttPassword = process.env.MQTT_PWD || ''; + const mqttHost = process.env.CUSTOM_MQTT_HOST || process.env.MQTT_HOST || ''; + const mqttPort = Number( + process.env.CUSTOM_MQTT_PORT || process.env.MQTT_PORT || '1883', + ); + const mqttUsername = + process.env.CUSTOM_MQTT_USER || process.env.MQTT_USER || ''; + const mqttPassword = + process.env.CUSTOM_MQTT_PWD || process.env.MQTT_PWD || ''; setupLogger({ showDebugLog }); diff --git a/futurehome/translations/en.yaml b/futurehome/translations/en.yaml index 683bc56..ad1e8e5 100644 --- a/futurehome/translations/en.yaml +++ b/futurehome/translations/en.yaml @@ -17,6 +17,18 @@ configuration: tp_allow_empty: name: Allow Empty Thingsplex Credentials description: Allow empty Thingsplex username and/or password. + custom_mqtt_host: + name: Custom MQTT Host (Optional) + description: Your custom MQTT broker host. + custom_mqtt_port: + name: Custom MQTT Port (Optional) + description: Your custom MQTT broker port. + custom_mqtt_user: + name: Custom MQTT Username (Optional) + description: Your custom MQTT broker username. + custom_mqtt_pwd: + name: Custom MQTT Password (Optional) + description: Your custom MQTT broker password. demo_mode: name: Demo Mode description: Use a sample recorded state from a real Futurehome Smarthub to simulate devices.