69 lines
3.8 KiB
Rust
69 lines
3.8 KiB
Rust
fn public_settings(settings: &RuntimeSettings) -> Value {
|
|
json!({
|
|
"controller_id": settings.controller_id,
|
|
"simulator_enabled": settings.simulator_enabled,
|
|
"poll_interval_seconds": settings.poll_interval_seconds,
|
|
"zone_interval_seconds": settings.zone_interval_seconds,
|
|
"discovery_timeout_ms": settings.discovery_timeout_ms,
|
|
"discovery_broadcast": settings.discovery_broadcast,
|
|
"house_mode": settings.house_mode,
|
|
"house_power_enabled": true,
|
|
"control_strategy": settings.control_strategy,
|
|
"outdoor_assist_enabled": settings.outdoor_assist_enabled,
|
|
"history_retention_days": settings.history_retention_days,
|
|
"history_compaction_enabled": settings.history_compaction_enabled,
|
|
"event_log_retention_days": settings.event_log_retention_days,
|
|
"suppress_device_beep": settings.suppress_device_beep,
|
|
"compressor_protection_enabled": settings.compressor_protection_enabled,
|
|
"compressor_protection_seconds": settings.compressor_protection_seconds,
|
|
"debug": settings.debug,
|
|
"night_mode": settings.night_mode,
|
|
"notifications": {
|
|
"enabled": settings.notifications.enabled,
|
|
"mode": settings.notifications.mode,
|
|
"provider": settings.notifications.provider,
|
|
"pushover_app_token": "",
|
|
"pushover_user_key": "",
|
|
"pushover_configured": !settings.notifications.pushover_app_token.trim().is_empty() && !settings.notifications.pushover_user_key.trim().is_empty(),
|
|
"slack_webhook_url": "",
|
|
"slack_configured": !settings.notifications.slack_webhook_url.trim().is_empty(),
|
|
"discord_webhook_url": "",
|
|
"discord_configured": !settings.notifications.discord_webhook_url.trim().is_empty(),
|
|
"cooldown_seconds": settings.notifications.cooldown_seconds,
|
|
"communication_failure_threshold": settings.notifications.communication_failure_threshold,
|
|
"target_timeout_minutes": settings.notifications.target_timeout_minutes,
|
|
"alert_types": &settings.notifications.alert_types,
|
|
},
|
|
"influxdb": {
|
|
"enabled": settings.influxdb.enabled,
|
|
"version": settings.influxdb.version,
|
|
"url": settings.influxdb.url,
|
|
"database": settings.influxdb.database,
|
|
"username": settings.influxdb.username,
|
|
"password": "",
|
|
"password_configured": !settings.influxdb.password.trim().is_empty(),
|
|
"org": settings.influxdb.org,
|
|
"bucket": settings.influxdb.bucket,
|
|
"token": "",
|
|
"token_configured": !settings.influxdb.token.trim().is_empty(),
|
|
"history_threshold_days": settings.influxdb.history_threshold_days,
|
|
},
|
|
"home_assistant": {
|
|
"url": home_assistant::effective_url(&settings.home_assistant),
|
|
"manual_url": settings.home_assistant.url,
|
|
"auth_mode": home_assistant::auth_mode(&settings.home_assistant),
|
|
"token": "",
|
|
"token_configured": home_assistant::token_configured(&settings.home_assistant),
|
|
"manual_token_configured": !settings.home_assistant.token.trim().is_empty(),
|
|
"supervisor_detected": home_assistant::supervisor_detected(),
|
|
"supervisor_token_detected": home_assistant::supervisor_token_detected(),
|
|
"manual_auth_override": settings.home_assistant.manual_auth_override,
|
|
"outdoor_entity_id": settings.home_assistant.outdoor_entity_id,
|
|
"sensor_stale_after_seconds": settings.home_assistant.sensor_stale_after_seconds,
|
|
"allow_invalid_tls": settings.home_assistant.allow_invalid_tls,
|
|
"sensor_aliases": settings.home_assistant.sensor_aliases,
|
|
"flow_inputs": settings.home_assistant.flow_inputs,
|
|
}
|
|
})
|
|
}
|