Skip to content

Commit f811d82

Browse files
committed
Add HA entities for Schneider Electric Thermostats
1 parent 97413e3 commit f811d82

File tree

1 file changed

+218
-3
lines changed

1 file changed

+218
-3
lines changed

zhaquirks/schneiderelectric/thermostat.py

Lines changed: 218 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
from typing import Final
44

55
from zigpy.quirks import CustomCluster
6-
from zigpy.quirks.v2 import QuirkBuilder
6+
from zigpy.quirks.v2 import EntityType, QuirkBuilder
7+
from zigpy.quirks.v2.homeassistant import(
8+
EntityPlatform,
9+
UnitOfPower,
10+
UnitOfTemperature,
11+
UnitOfTime,
12+
)
13+
from zigpy.quirks.v2.homeassistant.number import NumberDeviceClass
714
import zigpy.types as t
815
from zigpy.zcl.clusters.hvac import SystemMode, Thermostat, UserInterface
916
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
@@ -285,7 +292,7 @@ class AttributeDefs(Thermostat.AttributeDefs):
285292
access="r",
286293
is_manufacturer_specific=True,
287294
)
288-
se_local_temperature_souce_select: Final = ZCLAttributeDef(
295+
se_local_temperature_source_select: Final = ZCLAttributeDef(
289296
id=0xE212,
290297
type=SELocalTemperatureSourceSelect,
291298
access="rw",
@@ -328,7 +335,7 @@ class AttributeDefs(Thermostat.AttributeDefs):
328335
is_manufacturer_specific=True,
329336
)
330337
se_heating_emitter_type: Final = ZCLAttributeDef(
331-
id=0xE218,
338+
id=0xE21A,
332339
type=SEHeatingEmitterType,
333340
access="rw",
334341
is_manufacturer_specific=True,
@@ -572,5 +579,213 @@ class AttributeDefs(CustomCluster.AttributeDefs):
572579
.replaces(SEMetering, endpoint_id=5)
573580
.replaces(SECycleTime)
574581
.replaces(SEHeatingCoolingOutput)
582+
.number(
583+
cluster_id=SEMetering.cluster_id,
584+
endpoint_id=5,
585+
attribute_name=SEMetering.AttributeDefs.se_fixed_load_demand.name,
586+
translation_key="fixed_load_demand",
587+
fallback_name="Fixed load demand",
588+
device_class=NumberDeviceClass.POWER,
589+
unit=UnitOfPower.WATT,
590+
min_value=0,
591+
max_value=10000,
592+
step=1,
593+
)
594+
.number(
595+
cluster_id=SEUserInterface.cluster_id,
596+
endpoint_id=1,
597+
attribute_name=SEUserInterface.AttributeDefs.se_brightness.name,
598+
translation_key="display_brightness",
599+
fallback_name="Display brightness",
600+
# unit="%",
601+
min_value=0,
602+
max_value=100,
603+
step=1,
604+
)
605+
.number(
606+
cluster_id=SEUserInterface.cluster_id,
607+
endpoint_id=1,
608+
attribute_name=SEUserInterface.AttributeDefs.se_inactive_brightness.name,
609+
translation_key="display_inactive_brightness",
610+
fallback_name="Display inactive brightness",
611+
# unit="%",
612+
min_value=0,
613+
max_value=100,
614+
step=1,
615+
)
616+
.number(
617+
cluster_id=SEUserInterface.cluster_id,
618+
endpoint_id=1,
619+
attribute_name=SEUserInterface.AttributeDefs.se_activity_timeout.name,
620+
translation_key="display_activity_timeout",
621+
fallback_name="Display activity timeout",
622+
device_class=NumberDeviceClass.DURATION,
623+
unit=UnitOfTime.SECONDS,
624+
min_value=0,
625+
max_value=3600,
626+
step=1,
627+
)
628+
.binary_sensor(
629+
cluster_id=SEThermostat.cluster_id,
630+
endpoint_id=1,
631+
attribute_name=SEThermostat.AttributeDefs.se_open_window_detection_status.name,
632+
translation_key="open_window_detection_status",
633+
fallback_name="Open window detection status",
634+
entity_type=EntityType.DIAGNOSTIC,
635+
)
636+
.number(
637+
cluster_id=SEThermostat.cluster_id,
638+
endpoint_id=1,
639+
attribute_name=SEThermostat.AttributeDefs.se_open_window_detection_threshold.name,
640+
translation_key="open_window_detection_threshold",
641+
fallback_name="Open window detection threshold",
642+
device_class=NumberDeviceClass.TEMPERATURE,
643+
unit=UnitOfTemperature.CELSIUS,
644+
min_value=0,
645+
max_value=12,
646+
multiplier=0.1,
647+
step=0.1,
648+
)
649+
.number(
650+
cluster_id=SEThermostat.cluster_id,
651+
endpoint_id=1,
652+
attribute_name=SEThermostat.AttributeDefs.se_open_window_event_duration.name,
653+
translation_key="open_window_event_duration",
654+
fallback_name="Open window event duration",
655+
device_class=NumberDeviceClass.DURATION,
656+
unit=UnitOfTime.SECONDS,
657+
min_value=0,
658+
max_value=7620,
659+
step=1,
660+
)
661+
.number(
662+
cluster_id=SEThermostat.cluster_id,
663+
endpoint_id=1,
664+
attribute_name=SEThermostat.AttributeDefs.se_open_window_detection_guard_period.name,
665+
translation_key="open_window_detection_guard_period",
666+
fallback_name="Open window detection guard period",
667+
device_class=NumberDeviceClass.DURATION,
668+
unit=UnitOfTime.SECONDS,
669+
min_value=0,
670+
max_value=7620,
671+
step=1,
672+
)
673+
.number(
674+
cluster_id=SEThermostat.cluster_id,
675+
endpoint_id=1,
676+
attribute_name=SEThermostat.AttributeDefs.se_fallback_timeout.name,
677+
translation_key="fallback_timeout",
678+
fallback_name="Fallback timeout",
679+
device_class=NumberDeviceClass.DURATION,
680+
unit=UnitOfTime.SECONDS,
681+
min_value=30,
682+
max_value=10800,
683+
step=1,
684+
)
685+
.number(
686+
cluster_id=SEThermostat.cluster_id,
687+
endpoint_id=1,
688+
attribute_name=SEThermostat.AttributeDefs.se_boost_amount.name,
689+
translation_key="boost_amount",
690+
fallback_name="Boost amount",
691+
device_class=NumberDeviceClass.TEMPERATURE,
692+
unit=UnitOfTemperature.CELSIUS,
693+
min_value=0,
694+
max_value=10,
695+
multiplier=0.01,
696+
step=0.5,
697+
)
698+
.enum(
699+
cluster_id=SEThermostat.cluster_id,
700+
endpoint_id=1,
701+
attribute_name=SEThermostat.AttributeDefs.se_control_status.name,
702+
translation_key="control_status",
703+
fallback_name="Control status",
704+
enum_class=SEControlStatus,
705+
entity_platform=EntityPlatform.SENSOR,
706+
entity_type=EntityType.DIAGNOSTIC,
707+
)
708+
.enum(
709+
cluster_id=SEThermostat.cluster_id,
710+
endpoint_id=1,
711+
attribute_name=SEThermostat.AttributeDefs.se_local_temperature_source_select.name,
712+
translation_key="local_temperature_source",
713+
fallback_name="Local temperature source",
714+
enum_class=SELocalTemperatureSourceSelect,
715+
)
716+
.enum(
717+
cluster_id=SEThermostat.cluster_id,
718+
endpoint_id=1,
719+
attribute_name=SEThermostat.AttributeDefs.se_control_type.name,
720+
translation_key="control_type",
721+
fallback_name="Control type",
722+
enum_class=SEControlType,
723+
)
724+
.enum(
725+
cluster_id=SEThermostat.cluster_id,
726+
endpoint_id=1,
727+
attribute_name=SEThermostat.AttributeDefs.se_thermostat_application.name,
728+
translation_key="thermostat_application",
729+
fallback_name="Thermostat application",
730+
enum_class=SEThermostatApplication,
731+
)
732+
.enum(
733+
cluster_id=SEThermostat.cluster_id,
734+
endpoint_id=1,
735+
attribute_name=SEThermostat.AttributeDefs.se_heating_fuel.name,
736+
translation_key="heating_fuel",
737+
fallback_name="Heating fuel",
738+
enum_class=SEHeatingFuel,
739+
)
740+
.enum(
741+
cluster_id=SEThermostat.cluster_id,
742+
endpoint_id=1,
743+
attribute_name=SEThermostat.AttributeDefs.se_heat_transfer_medium.name,
744+
translation_key="heat_transfer_medium",
745+
fallback_name="Heat transfer medium",
746+
enum_class=SEHeatTransferMedium,
747+
)
748+
.enum(
749+
cluster_id=SEThermostat.cluster_id,
750+
endpoint_id=1,
751+
attribute_name=SEThermostat.AttributeDefs.se_heating_emitter_type.name,
752+
translation_key="heating_emitter_type",
753+
fallback_name="Heating emitter type",
754+
enum_class=SEHeatingEmitterType,
755+
)
756+
.number(
757+
cluster_id=SETemperatureMeasurement.cluster_id,
758+
endpoint_id=2,
759+
attribute_name=SETemperatureMeasurement.AttributeDefs.se_sensor_correction.name,
760+
translation_key="ambient_sensor_correction",
761+
fallback_name="Ambient sensor correction",
762+
device_class=NumberDeviceClass.TEMPERATURE,
763+
unit=UnitOfTemperature.CELSIUS,
764+
min_value=-10,
765+
max_value=10,
766+
step=0.1,
767+
multiplier=0.01,
768+
)
769+
.number(
770+
cluster_id=SETemperatureMeasurementExternal.cluster_id,
771+
endpoint_id=3,
772+
attribute_name=SETemperatureMeasurementExternal.AttributeDefs.se_sensor_correction.name,
773+
translation_key="external_sensor_correction",
774+
fallback_name="External sensor correction",
775+
device_class=NumberDeviceClass.TEMPERATURE,
776+
unit=UnitOfTemperature.CELSIUS,
777+
min_value=-10,
778+
max_value=10,
779+
step=0.1,
780+
multiplier=0.01,
781+
)
782+
.enum(
783+
cluster_id=SETemperatureMeasurementExternal.cluster_id,
784+
endpoint_id=3,
785+
attribute_name=SETemperatureMeasurementExternal.AttributeDefs.se_temperature_sensor_type.name,
786+
translation_key="external_temperature_sensor_type",
787+
fallback_name="External temperature sensor type",
788+
enum_class=SETemperatureSensorType,
789+
)
575790
.add_to_registry()
576791
)

0 commit comments

Comments
 (0)