Skip to content

Commit bd9ecbb

Browse files
authored
Add Beok thermostat _TZE204_cvub6xbb (#3890)
1 parent 1833332 commit bd9ecbb

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

tests/test_tuya_thermostat.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
Thermostat.AttributeDefs.system_mode,
7373
Thermostat.SystemMode.Heat,
7474
), # Set to heat, dp 1
75+
(
76+
"_TZE204_cvub6xbb",
77+
b"\t\x13\x02\x00\x06\x01\x01\x00\x01\x01",
78+
Thermostat.AttributeDefs.system_mode,
79+
Thermostat.SystemMode.Heat,
80+
), # Set to heat, dp 1
7581
],
7682
)
7783
async def test_handle_get_data(zigpy_device_from_v2_quirk, manuf, msg, attr, value):
@@ -132,6 +138,12 @@ async def test_tuya_no_mcu_version(zigpy_device_from_v2_quirk):
132138
19,
133139
-99,
134140
), # Local temp calibration to -9.9, dp 19
141+
(
142+
"_TZE204_cvub6xbb",
143+
b"\t\x1d\x02\x00\x10\x13\x02\x00\x04\xff\xff\xff\x9d",
144+
19,
145+
-99,
146+
), # Local temp calibration to -9.9, dp 19
135147
],
136148
)
137149
async def test_handle_get_data_tmcu(

zhaquirks/tuya/tuya_thermostat.py

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ class PresetModeV03(t.enum8):
6161
Temporary_Manual = 0x02
6262

6363

64+
class PresetModeV04(t.enum8):
65+
"""Tuya preset mode v04 enum."""
66+
67+
Manual = 0x00
68+
Auto = 0x01
69+
Eco = 0x03
70+
71+
6472
class SensorMode(t.enum8):
6573
"""Tuya sensor mode enum."""
6674

@@ -473,3 +481,129 @@ def handle_mcu_version_response(
473481
)
474482
.add_to_registry(replacement_cluster=NoManufTimeNoVersionRespTuyaMCUCluster)
475483
)
484+
485+
486+
# Beok TGM50-ZB-WPB
487+
(
488+
TuyaQuirkBuilder("_TZE204_cvub6xbb", "TS0601")
489+
.tuya_dp(
490+
dp_id=1,
491+
ep_attribute=TuyaThermostat.ep_attribute,
492+
attribute_name=TuyaThermostat.AttributeDefs.system_mode.name,
493+
converter=lambda x: {
494+
True: Thermostat.SystemMode.Heat,
495+
False: Thermostat.SystemMode.Off,
496+
}[x],
497+
dp_converter=lambda x: {
498+
Thermostat.SystemMode.Heat: True,
499+
Thermostat.SystemMode.Off: False,
500+
}[x],
501+
)
502+
.tuya_dp(
503+
dp_id=2,
504+
ep_attribute=TuyaThermostat.ep_attribute,
505+
attribute_name=TuyaThermostat.AttributeDefs.occupied_heating_setpoint.name,
506+
converter=lambda x: x * 10,
507+
dp_converter=lambda x: x // 10,
508+
)
509+
.tuya_dp(
510+
dp_id=3,
511+
ep_attribute=TuyaThermostat.ep_attribute,
512+
attribute_name=TuyaThermostat.AttributeDefs.local_temperature.name,
513+
converter=lambda x: x * 10,
514+
)
515+
.tuya_enum(
516+
dp_id=4,
517+
attribute_name="preset_mode",
518+
enum_class=PresetModeV04,
519+
translation_key="preset_mode",
520+
fallback_name="Preset mode",
521+
)
522+
.tuya_switch(
523+
dp_id=9,
524+
attribute_name="child_lock",
525+
translation_key="child_lock",
526+
fallback_name="Child lock",
527+
)
528+
.tuya_dp(
529+
dp_id=15,
530+
ep_attribute=TuyaThermostat.ep_attribute,
531+
attribute_name=TuyaThermostat.AttributeDefs.max_heat_setpoint_limit.name,
532+
converter=lambda x: x * 10,
533+
dp_converter=lambda x: x // 10,
534+
)
535+
.tuya_number(
536+
dp_id=19,
537+
attribute_name=TuyaThermostat.AttributeDefs.local_temperature_calibration.name,
538+
type=t.int32s,
539+
min_value=-9.9,
540+
max_value=9.9,
541+
unit=UnitOfTemperature.CELSIUS,
542+
step=0.1,
543+
multiplier=0.1,
544+
translation_key="local_temperature_calibration",
545+
fallback_name="Local temperature calibration",
546+
)
547+
.tuya_dp(
548+
dp_id=101,
549+
ep_attribute=TuyaThermostat.ep_attribute,
550+
attribute_name=TuyaThermostat.AttributeDefs.running_state.name,
551+
converter=lambda x: RunningState.Heat_State_On if x else RunningState.Idle,
552+
)
553+
.tuya_switch(
554+
dp_id=102,
555+
attribute_name="frost_protection",
556+
translation_key="frost_protection",
557+
fallback_name="Frost protection",
558+
)
559+
.tuya_switch(
560+
dp_id=103,
561+
attribute_name="factory_reset",
562+
translation_key="factory_reset",
563+
fallback_name="Factory reset",
564+
)
565+
.tuya_switch(
566+
dp_id=105,
567+
attribute_name="sound_enabled",
568+
translation_key="sound_enabled",
569+
fallback_name="Sound enabled",
570+
)
571+
.tuya_enum(
572+
dp_id=106,
573+
attribute_name="temperature_sensor_select",
574+
enum_class=SensorMode,
575+
translation_key="sensor_mode",
576+
fallback_name="Sensor mode",
577+
)
578+
.tuya_number(
579+
dp_id=107,
580+
attribute_name="deadzone_temperature",
581+
type=t.uint16_t,
582+
unit=UnitOfTemperature.CELSIUS,
583+
min_value=0.5,
584+
max_value=10,
585+
step=0.5,
586+
multiplier=0.1,
587+
translation_key="deadzone_temperature",
588+
fallback_name="Deadzone temperature",
589+
)
590+
# 109 ZWT198 schedule, skipped
591+
.tuya_enum(
592+
dp_id=110,
593+
attribute_name="backlight_mode",
594+
enum_class=BacklightMode,
595+
translation_key="backlight_mode",
596+
fallback_name="Backlight mode",
597+
)
598+
.tuya_switch(
599+
dp_id=111,
600+
attribute_name="invert_relay",
601+
on_value=0,
602+
off_value=1,
603+
translation_key="invert_relay",
604+
fallback_name="Invert relay",
605+
)
606+
.adds(TuyaThermostat)
607+
.skip_configuration()
608+
.add_to_registry()
609+
)

0 commit comments

Comments
 (0)