diff --git a/ha-hoymiles-wifi-addon-nightly/run.sh b/ha-hoymiles-wifi-addon-nightly/run.sh index 1c0dbe6e..d6b7dfd6 100644 --- a/ha-hoymiles-wifi-addon-nightly/run.sh +++ b/ha-hoymiles-wifi-addon-nightly/run.sh @@ -25,21 +25,21 @@ DEBUG_LOGGING=${DEBUG_LOGGING:-'false'} # Check if the required configs are provided if [[ -z "$INVERTER_HOST" ]]; then - echo "The inverter_host is not configured." - exit 1 + echo "The inverter_host is not configured." + exit 1 fi if [[ -z "$MQTT_BROKER_HOST" ]]; then - echo "The mqtt_broker_host is not configured." - exit 1 + echo "The mqtt_broker_host is not configured." + exit 1 fi -# print a warning if update interval is > 30500 -if [[ "$UPDATE_INTERVAL" -gt 30500 ]]; then - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - echo "The update_interval is set to a value greater than 30500." - echo "This is not recommended and may cause the inverter to become unresponsive." - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" +# print a warning if update interval is < 60500 +if [[ "$UPDATE_INTERVAL" -lt 60500 ]]; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "The update_interval is set to a value lower than 60500." + echo "This is not recommended and may cause the inverter to become unresponsive." + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" fi # Create the configuration file @@ -56,7 +56,7 @@ EOF # if DEBUG_LOGGING is true, set the RUST_LOG=debug environment variable to enable debug logging if [[ "$DEBUG_LOGGING" == "true" ]]; then - export RUST_LOG=debug + export RUST_LOG=debug fi # Execute the application diff --git a/ha-hoymiles-wifi-addon/run.sh b/ha-hoymiles-wifi-addon/run.sh index 26c03303..d6b7dfd6 100644 --- a/ha-hoymiles-wifi-addon/run.sh +++ b/ha-hoymiles-wifi-addon/run.sh @@ -13,6 +13,7 @@ MQTT_BROKER_HOST=$(bashio::config 'mqtt_broker_host') MQTT_USERNAME=$(bashio::config 'mqtt_username') MQTT_PASSWORD=$(bashio::config 'mqtt_password') MQTT_PORT=$(bashio::config 'mqtt_port') +UPDATE_INTERVAL=$(bashio::config 'update_interval') DEBUG_LOGGING=$(bashio::config 'debug_logging') # Use bashio::config values if they are defined, otherwise fall back to bashio::services values @@ -24,18 +25,27 @@ DEBUG_LOGGING=${DEBUG_LOGGING:-'false'} # Check if the required configs are provided if [[ -z "$INVERTER_HOST" ]]; then - echo "The inverter_host is not configured." - exit 1 + echo "The inverter_host is not configured." + exit 1 fi if [[ -z "$MQTT_BROKER_HOST" ]]; then - echo "The mqtt_broker_host is not configured." - exit 1 + echo "The mqtt_broker_host is not configured." + exit 1 +fi + +# print a warning if update interval is < 60500 +if [[ "$UPDATE_INTERVAL" -lt 60500 ]]; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "The update_interval is set to a value lower than 60500." + echo "This is not recommended and may cause the inverter to become unresponsive." + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" fi # Create the configuration file cat < ./config.toml inverter_host = "$INVERTER_HOST" +update_interval = $UPDATE_INTERVAL [home_assistant] host = "$MQTT_BROKER_HOST" @@ -46,7 +56,7 @@ EOF # if DEBUG_LOGGING is true, set the RUST_LOG=debug environment variable to enable debug logging if [[ "$DEBUG_LOGGING" == "true" ]]; then - export RUST_LOG=debug + export RUST_LOG=debug fi # Execute the application