Skip to content

Commit bb95428

Browse files
authored
Merge pull request #251 from plugwise/p1-3ph-II
Support 3-phase measurements
2 parents 7a1a4be + 5e65a11 commit bb95428

20 files changed

+1456
-1673
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
# v0.26.0: Smile P1: support 3-phase measurements
4+
35
# v0.25.14: Improve, bugfix
46
- Anna+Elga: final solution for https://github.com/plugwise/plugwise-beta/issues/320
57
- Related to https://github.com/home-assistant/core/issues/83068: handle actuator_functionality or sensor depending on which one is present

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.25.14"
3+
__version__ = "0.26.0"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import Stick

plugwise/constants.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ATTR_STATE_CLASS: Final = "state_class"
1616
ATTR_UNIT_OF_MEASUREMENT: Final = "unit_of_measurement"
1717
DEGREE: Final = "°"
18+
ELECTRIC_POTENTIAL_VOLT: Final = "V"
1819
ENERGY_KILO_WATT_HOUR: Final = "kWh"
1920
ENERGY_WATT_HOUR: Final = "Wh"
2021
PERCENTAGE: Final = "%"
@@ -29,7 +30,7 @@
2930
VOLUME_CUBIC_METERS: Final = "m³"
3031
VOLUME_CUBIC_METERS_PER_HOUR: Final = "m³/h"
3132

32-
### Stick constants ###
33+
# --- Stick constants ---
3334

3435
UTF8_DECODE: Final = "utf-8"
3536

@@ -362,7 +363,7 @@
362363
}
363364

364365

365-
### Smile constants ###
366+
# --- Smile constants ---
366367

367368
ACTUATOR_CLASSES: Final[tuple[str, ...]] = (
368369
"heater_central",
@@ -444,7 +445,16 @@
444445
P1_MEASUREMENTS: Final[dict[str, UOM]] = {
445446
"electricity_consumed": UOM(POWER_WATT),
446447
"electricity_produced": UOM(POWER_WATT),
448+
"electricity_phase_one_consumed": UOM(POWER_WATT),
449+
"electricity_phase_two_consumed": UOM(POWER_WATT),
450+
"electricity_phase_three_consumed": UOM(POWER_WATT),
451+
"electricity_phase_one_produced": UOM(POWER_WATT),
452+
"electricity_phase_two_produced": UOM(POWER_WATT),
453+
"electricity_phase_three_produced": UOM(POWER_WATT),
447454
"gas_consumed": UOM(VOLUME_CUBIC_METERS),
455+
"voltage_phase_one": UOM(ELECTRIC_POTENTIAL_VOLT),
456+
"voltage_phase_two": UOM(ELECTRIC_POTENTIAL_VOLT),
457+
"voltage_phase_three": UOM(ELECTRIC_POTENTIAL_VOLT),
448458
}
449459
# Thermostat and Plug/Stretch related measurements
450460
# Excluded:
@@ -559,6 +569,12 @@
559569
"electricity_consumed_peak_interval",
560570
"electricity_consumed_peak_point",
561571
"electricity_consumed_point",
572+
"electricity_phase_one_consumed",
573+
"electricity_phase_two_consumed",
574+
"electricity_phase_three_consumed",
575+
"electricity_phase_one_produced",
576+
"electricity_phase_two_produced",
577+
"electricity_phase_three_produced",
562578
"electricity_produced",
563579
"electricity_produced_interval",
564580
"electricity_produced_off_peak_cumulative",
@@ -585,6 +601,9 @@
585601
"setpoint_low",
586602
"temperature_difference",
587603
"valve_position",
604+
"voltage_phase_one",
605+
"voltage_phase_two",
606+
"voltage_phase_three",
588607
"water_pressure",
589608
"water_temperature",
590609
)
@@ -664,6 +683,12 @@ class SmileSensors(TypedDict, total=False):
664683
electricity_consumed_peak_interval: int
665684
electricity_consumed_peak_point: int
666685
electricity_consumed_point: float
686+
electricity_phase_one_consumed: float
687+
electricity_phase_two_consumed: float
688+
electricity_phase_three_consumed: float
689+
electricity_phase_one_produced: float
690+
electricity_phase_two_produced: float
691+
electricity_phase_three_produced: float
667692
electricity_produced: float
668693
electricity_produced_interval: float
669694
electricity_produced_off_peak_cumulative: float
@@ -690,6 +715,9 @@ class SmileSensors(TypedDict, total=False):
690715
setpoint_low: float
691716
temperature_difference: float
692717
valve_position: float
718+
voltage_phase_one: float
719+
voltage_phase_two: float
720+
voltage_phase_three: float
693721
water_pressure: float
694722
water_temperature: float
695723

plugwise/exceptions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,49 @@
22

33

44
class PlugwiseException(Exception):
5-
"""Base error class for this Plugwise library"""
5+
"""Base error class for this Plugwise library."""
66

77

8-
### Stick exceptions ###
8+
# --- Stick exceptions ---
99

1010

1111
class PortError(PlugwiseException):
12-
"""Connection to USBstick failed"""
12+
"""Connection to USBstick failed."""
1313

1414

1515
class StickInitError(PlugwiseException):
16-
"""Initialization of USBstick failed"""
16+
"""Initialization of USBstick failed."""
1717

1818

1919
class NetworkDown(PlugwiseException):
20-
"""Zigbee network not online"""
20+
"""Zigbee network not online."""
2121

2222

2323
class CirclePlusError(PlugwiseException):
24-
"""Connection to Circle+ node failed"""
24+
"""Connection to Circle+ node failed."""
2525

2626

2727
class InvalidMessageLength(PlugwiseException):
28-
"""Invalid message length"""
28+
"""Invalid message length."""
2929

3030

3131
class InvalidMessageHeader(PlugwiseException):
32-
"""Invalid message header"""
32+
"""Invalid message header."""
3333

3434

3535
class InvalidMessageFooter(PlugwiseException):
36-
"""Invalid message footer"""
36+
"""Invalid message footer."""
3737

3838

3939
class InvalidMessageChecksum(PlugwiseException):
40-
"""Invalid data checksum"""
40+
"""Invalid data checksum."""
4141

4242

4343
class TimeoutException(PlugwiseException):
44-
"""Timeout expired while waiting for response from node"""
44+
"""Timeout expired while waiting for response from node."""
4545

4646

47-
### Smile exceptions ###
47+
# --- Smile exceptions ---
4848

4949

5050
class ConnectionFailedError(PlugwiseException):

0 commit comments

Comments
 (0)