Added debug bridge to publish state on mqtt
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-17 20:09:00 +01:00
parent f756562676
commit 4844bd5d79
10 changed files with 135 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ use automation::{
hue_bridge,
light_sensor, mqtt::Mqtt,
ntfy,
presence, error::ApiError,
presence, error::ApiError, debug_bridge,
};
use dotenvy::dotenv;
use rumqttc::{AsyncClient, MqttOptions, Transport};
@@ -95,11 +95,16 @@ async fn app() -> Result<(), Box<dyn std::error::Error>> {
ntfy::start(presence.clone(), &ntfy_config);
}
// Start he hue bridge if it is configured
// Start the hue bridge if it is configured
if let Some(hue_bridge_config) = config.hue_bridge {
hue_bridge::start(presence.clone(), light_sensor.clone(), hue_bridge_config);
}
// Start the debug bridge if it is configured
if let Some(debug_bridge_config) = config.debug_bridge {
debug_bridge::start(presence.clone(), light_sensor.clone(), debug_bridge_config, client.clone());
}
// Actually start listening for mqtt message,
// we wait until all the setup is done, as otherwise we might miss some messages
mqtt.start();