|
8 | 8 | import logging |
9 | 9 | from typing import TYPE_CHECKING, Any, Self |
10 | 10 |
|
11 | | -from zhaquirks.quirk_ids import TUYA_PLUG_MANUFACTURER, TUYA_PLUG_ONOFF |
| 11 | +from zhaquirks.danfoss import thermostat as danfoss_thermostat |
| 12 | +from zhaquirks.quirk_ids import ( |
| 13 | + DANFOSS_ALLY_THERMOSTAT, |
| 14 | + TUYA_PLUG_MANUFACTURER, |
| 15 | + TUYA_PLUG_ONOFF, |
| 16 | +) |
12 | 17 | from zhaquirks.xiaomi.aqara.magnet_ac01 import OppleCluster as MagnetAC01OppleCluster |
13 | 18 | from zhaquirks.xiaomi.aqara.switch_acn047 import OppleCluster as T2RelayOppleCluster |
14 | 19 | from zigpy import types |
|
28 | 33 | CLUSTER_HANDLER_INOVELLI, |
29 | 34 | CLUSTER_HANDLER_OCCUPANCY, |
30 | 35 | CLUSTER_HANDLER_ON_OFF, |
| 36 | + CLUSTER_HANDLER_THERMOSTAT, |
31 | 37 | ) |
32 | 38 |
|
33 | 39 | if TYPE_CHECKING: |
@@ -695,3 +701,105 @@ class KeypadLockout(ZCLEnumSelectEntity): |
695 | 701 | _attribute_name: str = "keypad_lockout" |
696 | 702 | _enum = KeypadLockoutEnum |
697 | 703 | _attr_translation_key: str = "keypad_lockout" |
| 704 | + |
| 705 | + |
| 706 | +@CONFIG_DIAGNOSTIC_MATCH( |
| 707 | + cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT, |
| 708 | + quirk_ids={DANFOSS_ALLY_THERMOSTAT}, |
| 709 | +) |
| 710 | +class DanfossExerciseDayOfTheWeek(ZCLEnumSelectEntity): |
| 711 | + """Danfoss proprietary attribute for setting the day of the week for exercising.""" |
| 712 | + |
| 713 | + _unique_id_suffix = "exercise_day_of_week" |
| 714 | + _attribute_name = "exercise_day_of_week" |
| 715 | + _attr_translation_key: str = "exercise_day_of_week" |
| 716 | + _enum = danfoss_thermostat.DanfossExerciseDayOfTheWeekEnum |
| 717 | + _attr_icon: str = "mdi:wrench-clock" |
| 718 | + |
| 719 | + |
| 720 | +class DanfossOrientationEnum(types.enum8): |
| 721 | + """Vertical or Horizontal.""" |
| 722 | + |
| 723 | + Horizontal = 0x00 |
| 724 | + Vertical = 0x01 |
| 725 | + |
| 726 | + |
| 727 | +@CONFIG_DIAGNOSTIC_MATCH( |
| 728 | + cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT, |
| 729 | + quirk_ids={DANFOSS_ALLY_THERMOSTAT}, |
| 730 | +) |
| 731 | +class DanfossOrientation(ZCLEnumSelectEntity): |
| 732 | + """Danfoss proprietary attribute for setting the orientation of the valve. |
| 733 | +
|
| 734 | + Needed for biasing the internal temperature sensor. |
| 735 | + This is implemented as an enum here, but is a boolean on the device. |
| 736 | + """ |
| 737 | + |
| 738 | + _unique_id_suffix = "orientation" |
| 739 | + _attribute_name = "orientation" |
| 740 | + _attr_translation_key: str = "valve_orientation" |
| 741 | + _enum = DanfossOrientationEnum |
| 742 | + |
| 743 | + |
| 744 | +@CONFIG_DIAGNOSTIC_MATCH( |
| 745 | + cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT, |
| 746 | + quirk_ids={DANFOSS_ALLY_THERMOSTAT}, |
| 747 | +) |
| 748 | +class DanfossAdaptationRunControl(ZCLEnumSelectEntity): |
| 749 | + """Danfoss proprietary attribute for controlling the current adaptation run.""" |
| 750 | + |
| 751 | + _unique_id_suffix = "adaptation_run_control" |
| 752 | + _attribute_name = "adaptation_run_control" |
| 753 | + _attr_translation_key: str = "adaptation_run_command" |
| 754 | + _enum = danfoss_thermostat.DanfossAdaptationRunControlEnum |
| 755 | + |
| 756 | + |
| 757 | +class DanfossControlAlgorithmScaleFactorEnum(types.enum8): |
| 758 | + """The time scale factor for changing the opening of the valve. |
| 759 | +
|
| 760 | + Not all values are given, therefore there are some extrapolated values with a margin of error of about 5 minutes. |
| 761 | + This is implemented as an enum here, but is a number on the device. |
| 762 | + """ |
| 763 | + |
| 764 | + quick_5min = 0x01 |
| 765 | + |
| 766 | + quick_10min = 0x02 # extrapolated |
| 767 | + quick_15min = 0x03 # extrapolated |
| 768 | + quick_25min = 0x04 # extrapolated |
| 769 | + |
| 770 | + moderate_30min = 0x05 |
| 771 | + |
| 772 | + moderate_40min = 0x06 # extrapolated |
| 773 | + moderate_50min = 0x07 # extrapolated |
| 774 | + moderate_60min = 0x08 # extrapolated |
| 775 | + moderate_70min = 0x09 # extrapolated |
| 776 | + |
| 777 | + slow_80min = 0x0A |
| 778 | + |
| 779 | + quick_open_disabled = 0x11 # not sure what it does; also requires lower 4 bits to be in [1, 10] I assume |
| 780 | + |
| 781 | + |
| 782 | +@CONFIG_DIAGNOSTIC_MATCH( |
| 783 | + cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT, |
| 784 | + quirk_ids={DANFOSS_ALLY_THERMOSTAT}, |
| 785 | +) |
| 786 | +class DanfossControlAlgorithmScaleFactor(ZCLEnumSelectEntity): |
| 787 | + """Danfoss proprietary attribute for setting the scale factor of the setpoint filter time constant.""" |
| 788 | + |
| 789 | + _unique_id_suffix = "control_algorithm_scale_factor" |
| 790 | + _attribute_name = "control_algorithm_scale_factor" |
| 791 | + _attr_translation_key: str = "setpoint_response_time" |
| 792 | + _enum = DanfossControlAlgorithmScaleFactorEnum |
| 793 | + |
| 794 | + |
| 795 | +@CONFIG_DIAGNOSTIC_MATCH( |
| 796 | + cluster_handler_names="thermostat_ui", |
| 797 | + quirk_ids={DANFOSS_ALLY_THERMOSTAT}, |
| 798 | +) |
| 799 | +class DanfossViewingDirection(ZCLEnumSelectEntity): |
| 800 | + """Danfoss proprietary attribute for setting the viewing direction of the screen.""" |
| 801 | + |
| 802 | + _unique_id_suffix = "viewing_direction" |
| 803 | + _attribute_name = "viewing_direction" |
| 804 | + _attr_translation_key: str = "viewing_direction" |
| 805 | + _enum = danfoss_thermostat.DanfossViewingDirectionEnum |
0 commit comments