transforming to integration

This commit is contained in:
Constantin Pascal
2026-02-12 11:25:12 +02:00
parent c8d1e968d7
commit b5fbca8453
14 changed files with 1847 additions and 0 deletions
@@ -0,0 +1,203 @@
"""Constants for the Boiler Auxiliary Heater Control integration."""
DOMAIN = "boiler_aux_heater"
MANUFACTURER = "Custom"
# Config entry keys
CONF_BOILER_TEMP_SENSOR = "boiler_temp_sensor"
CONF_HEATER_RELAY = "heater_relay"
CONF_CT1_POWER = "ct1_power"
CONF_CT2_POWER = "ct2_power"
CONF_CT3_POWER = "ct3_power"
CONF_HP_AUX_HEATER = "hp_aux_heater"
CONF_CIRCULATION_PUMP = "circulation_pump"
CONF_PUMP_SCHEDULE = "pump_schedule"
# Platforms
PLATFORMS = [
"climate",
"switch",
"number",
"binary_sensor",
"sensor",
"button",
]
# Presets (order matters for UI)
PRESET_NORMAL = "Normal"
PRESET_ECO = "Eco"
PRESET_BOOST = "Boost"
PRESET_SLEEP = "Sleep"
PRESET_AWAY = "Away"
PRESETS = [PRESET_NORMAL, PRESET_ECO, PRESET_BOOST, PRESET_SLEEP, PRESET_AWAY]
# PV state machine states
PV_STATE_IDLE = "idle"
PV_STATE_WAITING_START = "waiting_to_start"
PV_STATE_ACTIVE = "active"
PV_STATE_WAITING_STOP = "waiting_to_stop"
# Number entity definitions: (key, name, min, max, step, unit, icon, default)
NUMBER_DEFINITIONS = {
"cut_off_temp": {
"name": "Cut-off Temperature",
"min": 40,
"max": 85,
"step": 1,
"unit": "°C",
"icon": "mdi:thermometer-high",
"default": 60,
},
"temp_hysteresis": {
"name": "Temperature Hysteresis",
"min": 1,
"max": 15,
"step": 0.5,
"unit": "°C",
"icon": "mdi:thermometer-lines",
"default": 4,
},
"pv_target_temp": {
"name": "PV Target Temperature",
"min": 40,
"max": 70,
"step": 1,
"unit": "°C",
"icon": "mdi:solar-power",
"default": 55,
},
"pv_buffer": {
"name": "PV Excess Buffer",
"min": 0,
"max": 1000,
"step": 50,
"unit": "W",
"icon": "mdi:buffer",
"default": 100,
},
"heater_power": {
"name": "Heater Power Rating",
"min": 1500,
"max": 9000,
"step": 1500,
"unit": "W",
"icon": "mdi:lightning-bolt",
"default": 4500,
},
"pv_start_delay": {
"name": "PV Excess Start Delay",
"min": 1,
"max": 300,
"step": 1,
"unit": "s",
"icon": "mdi:timer-play",
"default": 60,
},
"pv_stop_delay": {
"name": "PV Excess Stop Delay",
"min": 1,
"max": 300,
"step": 1,
"unit": "s",
"icon": "mdi:timer-stop",
"default": 60,
},
"temp_normal": {
"name": "Normal Preset Temperature",
"min": 30,
"max": 65,
"step": 1,
"unit": "°C",
"icon": "mdi:thermometer",
"default": 44,
},
"temp_eco": {
"name": "Eco Preset Temperature",
"min": 30,
"max": 60,
"step": 1,
"unit": "°C",
"icon": "mdi:leaf",
"default": 40,
},
"temp_boost": {
"name": "Boost Preset Temperature",
"min": 40,
"max": 70,
"step": 1,
"unit": "°C",
"icon": "mdi:flash",
"default": 50,
},
"temp_sleep": {
"name": "Sleep Preset Temperature",
"min": 25,
"max": 55,
"step": 1,
"unit": "°C",
"icon": "mdi:sleep",
"default": 38,
},
"temp_away": {
"name": "Away Preset Temperature",
"min": 20,
"max": 50,
"step": 1,
"unit": "°C",
"icon": "mdi:home-export-outline",
"default": 35,
},
"bath_boost_duration": {
"name": "Bath Boost Duration",
"min": 5,
"max": 120,
"step": 5,
"unit": "min",
"icon": "mdi:timer-sand",
"default": 30,
},
}
# Map preset name to number entity key
PRESET_TEMP_MAP = {
PRESET_NORMAL: "temp_normal",
PRESET_ECO: "temp_eco",
PRESET_BOOST: "temp_boost",
PRESET_SLEEP: "temp_sleep",
PRESET_AWAY: "temp_away",
}
# Switch entity definitions: (key, name, icon, default)
SWITCH_DEFINITIONS = {
"manual_override": {
"name": "Manual Override",
"icon": "mdi:water-boiler",
"default": False,
},
"allow_usage": {
"name": "Allow Aux Heater Usage",
"icon": "mdi:check-circle",
"default": True,
},
"pv_excess_mode": {
"name": "PV Excess Mode",
"icon": "mdi:solar-power",
"default": True,
},
"boost_all_modes": {
"name": "Boost in All Modes",
"icon": "mdi:thermostat",
"default": False,
},
}
# Thermostat tolerances (matching YAML)
MAIN_COLD_TOLERANCE = 4.0
MAIN_HOT_TOLERANCE = 0.0
PV_COLD_TOLERANCE = 1.0
PV_HOT_TOLERANCE = 0.5
MIN_CYCLE_DURATION = 120 # seconds
# Coordinator debounce
DEBOUNCE_SECONDS = 1.0