Skip to content

Commit

Permalink
More rearranging
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew committed Sep 3, 2023
1 parent ee88f05 commit 99975fe
Showing 1 changed file with 70 additions and 61 deletions.
131 changes: 70 additions & 61 deletions plugwise/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,6 @@
VOLUME_CUBIC_METERS: Final = "m³"
VOLUME_CUBIC_METERS_PER_HOUR: Final = "m³/h"

ACTUATOR_CLASSES: Final[tuple[str, ...]] = (
"heater_central",
"thermostat",
"thermostatic_radiator_valve",
"zone_thermometer",
"zone_thermostat",
)
ActuatorType = Literal[
"domestic_hot_water_setpoint",
"max_dhw_temperature",
"maximum_boiler_temperature",
"temperature_offset",
"thermostat",
]
ACTIVE_ACTUATORS: Final[tuple[str, ...]] = get_args(ActuatorType)
ActuatorDataType = Literal[
"lower_bound",
"resolution",
"setpoint",
"setpoint_high",
"setpoint_low",
"upper_bound",
]
DAYS: Final[dict[str, int]] = {
"mo": 0,
"tu": 1,
Expand Down Expand Up @@ -108,36 +85,10 @@
"070051": "Switch",
"080029": "Switch",
}
LIMITS: Final[tuple[str, ...]] = (
"offset",
"setpoint",
"resolution",
"lower_bound",
"upper_bound",
)

MAX_SETPOINT: Final[float] = 30.0
MIN_SETPOINT: Final[float] = 4.0
NONE: Final = "None"
SPECIAL_FORMAT: Final[tuple[str, ...]] = (ENERGY_KILO_WATT_HOUR, VOLUME_CUBIC_METERS)
SWITCH_GROUP_TYPES: Final[tuple[str, ...]] = ("switching", "report")
ZONE_THERMOSTATS: Final[tuple[str, ...]] = (
"thermostat",
"thermostatic_radiator_valve",
"zone_thermometer",
"zone_thermostat",
)
THERMOSTAT_CLASSES: Final[tuple[str, ...]] = (
"thermostat",
"thermo_sensor",
"zone_thermometer",
"zone_thermostat",
"thermostatic_radiator_valve",
)
SPECIAL_PLUG_TYPES: Final[tuple[str, ...]] = (
"central_heating_pump",
"valve_actuator",
"heater_electric",
)

# XML data paths
APPLIANCES: Final = "/core/appliances"
Expand All @@ -151,6 +102,7 @@

UOM = namedtuple("UOM", "unit_of_measurement")
DATA = namedtuple("DATA", "name unit_of_measurement")

# P1 related measurements:
P1_MEASUREMENTS: Final[dict[str, UOM]] = {
"electricity_consumed": UOM(POWER_WATT),
Expand Down Expand Up @@ -234,15 +186,6 @@
"outdoor_temperature": DATA("outdoor_air_temperature", TEMP_CELSIUS),
}

ToggleNameType = Literal[
"cooling_ena_switch",
"dhw_cm_switch",
]
TOGGLES: Final[dict[str, ToggleNameType]] = {
"cooling_enabled": "cooling_ena_switch",
"domestic_hot_water_comfort_mode": "dhw_cm_switch",
}

# Known types of Smiles and Stretches
SMILE = namedtuple("SMILE", "smile_type smile_name")
SMILES: Final[dict[str, SMILE]] = {
Expand All @@ -258,7 +201,32 @@
"stretch_v3": SMILE("stretch", "Stretch"),
}

# All available Binary Sensor, Sensor, and Switch Types
# Class, Literal and related tuple-definitions

ACTUATOR_CLASSES: Final[tuple[str, ...]] = (
"heater_central",
"thermostat",
"thermostatic_radiator_valve",
"zone_thermometer",
"zone_thermostat",
)
ActuatorType = Literal[
"domestic_hot_water_setpoint",
"max_dhw_temperature",
"maximum_boiler_temperature",
"temperature_offset",
"thermostat",
]
ACTIVE_ACTUATORS: Final[tuple[str, ...]] = get_args(ActuatorType)

ActuatorDataType = Literal[
"lower_bound",
"resolution",
"setpoint",
"setpoint_high",
"setpoint_low",
"upper_bound",
]

ApplianceType = Literal[
"dev_class",
Expand Down Expand Up @@ -291,6 +259,14 @@
"temperature_offset",
]

LIMITS: Final[tuple[str, ...]] = (
"offset",
"setpoint",
"resolution",
"lower_bound",
"upper_bound",
)

SelectType = Literal[
"select_dhw_mode",
"select_regulation_mode",
Expand Down Expand Up @@ -357,6 +333,14 @@
]
SENSORS: Final[tuple[str, ...]] = get_args(SensorType)

SPECIAL_PLUG_TYPES: Final[tuple[str, ...]] = (
"central_heating_pump",
"valve_actuator",
"heater_electric",
)

SPECIAL_FORMAT: Final[tuple[str, ...]] = (ENERGY_KILO_WATT_HOUR, VOLUME_CUBIC_METERS)

SwitchType = Literal[
"cooling_ena_switch",
"dhw_cm_switch",
Expand All @@ -365,6 +349,32 @@
]
SWITCHES: Final[tuple[str, ...]] = get_args(SwitchType)

SWITCH_GROUP_TYPES: Final[tuple[str, ...]] = ("switching", "report")

THERMOSTAT_CLASSES: Final[tuple[str, ...]] = (
"thermostat",
"thermo_sensor",
"zone_thermometer",
"zone_thermostat",
"thermostatic_radiator_valve",
)

ToggleNameType = Literal[
"cooling_ena_switch",
"dhw_cm_switch",
]
TOGGLES: Final[dict[str, ToggleNameType]] = {
"cooling_enabled": "cooling_ena_switch",
"domestic_hot_water_comfort_mode": "dhw_cm_switch",
}

ZONE_THERMOSTATS: Final[tuple[str, ...]] = (
"thermostat",
"thermostatic_radiator_valve",
"zone_thermometer",
"zone_thermostat",
)


class GatewayData(TypedDict, total=False):
"""The Gateway Data class."""
Expand Down Expand Up @@ -434,7 +444,6 @@ class SmileSensors(TypedDict, total=False):
electricity_produced_peak_interval: int
electricity_produced_peak_point: int
electricity_produced_point: float
elga_status_code: int
gas_consumed_cumulative: float
gas_consumed_interval: float
humidity: float
Expand Down

0 comments on commit 99975fe

Please sign in to comment.