Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugwise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Plugwise module."""

__version__ = "0.8.0a2"
__version__ = "0.8.0a3"

from plugwise.smile import Smile
from plugwise.stick import stick
104 changes: 104 additions & 0 deletions plugwise/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Stick constants ###

UTF8_DECODE = "utf-8"

# Serial connection settings for plugwise USB stick
Expand Down Expand Up @@ -260,3 +262,105 @@
HA_SWITCH = "switch"
HA_SENSOR = "sensor"
HA_BINARY_SENSOR = "binary_sensor"


### Smile constants ###

APPLIANCES = "/core/appliances"
DOMAIN_OBJECTS = "/core/domain_objects"
LOCATIONS = "/core/locations"
NOTIFICATIONS = "/core/notifications"
RULES = "/core/rules"
SYSTEM = "/system"
STATUS = "/system/status.xml"

DEFAULT_TIMEOUT = 30
DEFAULT_USERNAME = "smile"
DEFAULT_PORT = 80

SWITCH_GROUP_TYPES = ["switching", "report"]

HOME_MEASUREMENTS = {
"electricity_consumed": "power",
"electricity_produced": "power",
"gas_consumed": "gas",
"outdoor_temperature": "temperature",
}

# Excluded:
# zone_thermosstat 'temperature_offset'
# radiator_valve 'uncorrected_temperature', 'temperature_offset'
DEVICE_MEASUREMENTS = {
# HA Core current_temperature
"temperature": "temperature",
# HA Core setpoint
"thermostat": "setpoint",
# Anna/Adam
"boiler_temperature": "water_temperature",
"domestic_hot_water_state": "dhw_state",
"intended_boiler_temperature": "intended_boiler_temperature", # non-zero when heating, zero when dhw-heating
"intended_central_heating_state": "heating_state", # use intended_c_h_state, this key shows the heating-behavior better than c-h_state
"modulation_level": "modulation_level",
"return_water_temperature": "return_temperature",
# Used with the Elga heatpump - marcelveldt
"compressor_state": "compressor_state",
"cooling_state": "cooling_state",
# Next 2 keys are used to show the state of the gas-heater used next to the Elga heatpump - marcelveldt
"slave_boiler_state": "slave_boiler_state",
"flame_state": "flame_state", # also present when there is a single gas-heater
# Anna only
"central_heater_water_pressure": "water_pressure",
"outdoor_temperature": "outdoor_temperature", # Outdoor temp as reported on the Anna, in the App
"schedule_temperature": "schedule_temperature", # Only present on legacy Anna and Anna_v3
# Legacy Anna: similar to flame-state on Anna/Adam
"boiler_state": "boiler_state",
# Legacy Anna: shows when heating is active, don't show dhw_state, cannot be determined reliably
"intended_boiler_state": "intended_boiler_state",
# Lisa and Tom
"battery": "battery",
"temperature_difference": "temperature_difference",
"valve_position": "valve_position",
# Plug
"electricity_consumed": "electricity_consumed",
"electricity_produced": "electricity_produced",
"relay": "relay",
}

SMILES = {
"smile_open_therm_v3": {
"type": "thermostat",
"friendly_name": "Adam",
},
"smile_open_therm_v2": {
"type": "thermostat",
"friendly_name": "Adam",
},
"smile_thermo_v4": {
"type": "thermostat",
"friendly_name": "Anna",
},
"smile_thermo_v3": {
"type": "thermostat",
"friendly_name": "Anna",
},
"smile_thermo_v1": {
"type": "thermostat",
"friendly_name": "Anna",
"legacy": True,
},
"smile_v4": {
"type": "power",
"friendly_name": "P1",
},
"smile_v3": {
"type": "power",
"friendly_name": "P1",
},
"smile_v2": {
"type": "power",
"friendly_name": "P1",
"legacy": True,
},
"stretch_v3": {"type": "stretch", "friendly_name": "Stretch", "legacy": True},
"stretch_v2": {"type": "stretch", "friendly_name": "Stretch", "legacy": True},
}
64 changes: 64 additions & 0 deletions plugwise/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (C) 2011 Sven Petai <hadara@bsd.ee>
# Use of this source code is governed by the MIT license found in the LICENSE file.

### Stick exceptions ###

class PlugwiseException(Exception):
"""Base error class for this Plugwise library"""
Expand Down Expand Up @@ -42,3 +43,66 @@ class TimeoutException(PlugwiseException):
"""Timeout expired while waiting for response from node"""

pass


### Smile exceptions ###


class PlugwiseError(Exception):
"""Plugwise exceptions class."""

pass


class ConnectionFailedError(PlugwiseError):
"""Raised when unable to connect."""

pass


class InvalidAuthentication(PlugwiseError):
"""Raised when unable to authenticate."""

pass


class UnsupportedDeviceError(PlugwiseError):
"""Raised when device is not supported."""

pass


class DeviceSetupError(PlugwiseError):
"""Raised when device is missing critical setup data."""

pass


class DeviceTimeoutError(PlugwiseError):
"""Raised when device is not supported."""

pass


class ErrorSendingCommandError(PlugwiseError):
"""Raised when device is not accepting the command."""

pass


class ResponseError(PlugwiseError):
"""Raised when empty or error in response returned."""

pass


class InvalidXMLError(PlugwiseError):
"""Raised when response holds incomplete or invalid XML data."""

pass


class XMLDataMissingError(PlugwiseError):
"""Raised when xml data is empty."""

pass
Loading