use crate::{ error::AppError, home_assistant, influxdb, models::{ Automation, AutomationPlanRule, ClimateGroup, ConnectionStatus, ConnectionType, ControlPlan, ControlPlanEvent, Device, DeviceCommand, DeviceGroup, EnergyReading, HORIZONTAL_SWING_MAX, VERTICAL_SWING_MAX, EnergySourcePreference, GroupControlPatch, HaReading, NetworkReading, NightModeSettings, Reading, RuntimeSettings, Schedule, TemporaryQuickThermostat, Zone, ZoneControlPlan, ZoneReading, }, state::{AppState, ControlPlanSnapshot, PendingControllerCommand}, }; use anyhow::Result; use chrono::{DateTime, Datelike, Local, NaiveTime, Timelike, Utc, Weekday}; use serde_json::{json, Value}; use std::{ collections::{HashMap, HashSet}, sync::{atomic::Ordering, Arc}, time::{Duration, Instant}, }; use tokio::{sync::broadcast, time::sleep}; // Functional source split intentionally keeps items in the existing module namespace. include!("engine/runtime.rs"); include!("engine/commands.rs"); include!("engine/polling.rs"); include!("engine/local_thermostat.rs"); include!("engine/temporary_thermostat.rs"); include!("engine/deadlines.rs"); include!("engine/ownership.rs"); include!("engine/groups.rs"); include!("engine/zone_actions.rs"); include!("engine/zone_control.rs"); include!("engine/history.rs"); include!("engine/connectivity.rs"); include!("engine/energy.rs"); include!("engine/temperature.rs"); include!("engine/targets.rs"); include!("engine/schedules.rs"); include!("engine/control_plan.rs"); include!("engine/automations.rs"); include!("engine/tests.rs");