Skip to content

Commit

Permalink
Add Nedis TRV ZBHTR20WT Tuya _TZE200_ne4pikwm (#3816)
Browse files Browse the repository at this point in the history
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
  • Loading branch information
prairiesnpr and TheJulianJES authored Feb 26, 2025
1 parent 4f20526 commit b070528
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_tuya_trv.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@
],
}

TUYA_SYS_MODE_V03 = {
Thermostat.SystemMode.Heat: [
b"\x01\x02\x00\x00\x02\x65\x01\x00\x01\x01",
],
Thermostat.SystemMode.Off: [
b"\x01\x03\x00\x00\x03\x65\x01\x00\x01\x00",
],
}

TUYA_SYS_MODE_V04 = {
Thermostat.SystemMode.Heat: [b"\x01\x02\x00\x00\x02\x02\x04\x00\x01\x03"],
Thermostat.SystemMode.Off: [b"\x01\x03\x00\x00\x03\x02\x04\x00\x01\x02"],
Expand Down Expand Up @@ -117,6 +126,15 @@
zha.DeviceType.THERMOSTAT, # quirk replaces device type with THERMOSTAT
True, # Enusure schedule is turned off
),
(
"_TZE200_ne4pikwm",
"TS0601",
TUYA_TEST_PLAN_V02,
TUYA_SP_V02,
TUYA_SYS_MODE_V03,
None, # test device has specific device type, real one has SMART_PLUG
False,
),
(
"_TZE204_qyr2m29i",
"TS0601",
Expand Down
94 changes: 94 additions & 0 deletions zhaquirks/tuya/tuya_trv.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,3 +842,97 @@ async def write_attributes(
.skip_configuration()
.add_to_registry()
)


(
TuyaQuirkBuilder("_TZE200_ne4pikwm", "TS0601") # Nedis ZBHTR20WT
.applies_to("_TZE284_ne4pikwm", "TS0601")
.tuya_dp(
dp_id=3,
ep_attribute=TuyaThermostatV2.ep_attribute,
attribute_name=TuyaThermostatV2.AttributeDefs.running_state.name,
converter=lambda x: RunningState.Heat_State_On if x else RunningState.Idle,
)
.tuya_switch(
dp_id=8,
attribute_name="window_detection",
translation_key="window_detection",
fallback_name="Open window detection",
)
.tuya_switch(
dp_id=10,
attribute_name="frost_protection",
translation_key="frost_protection",
fallback_name="Frost protection",
)
.tuya_number(
dp_id=27,
attribute_name=TuyaThermostatV2.AttributeDefs.local_temperature_calibration.name,
type=t.int32s,
min_value=-6,
max_value=6,
unit=UnitOfTemperature.CELSIUS,
step=1,
translation_key="local_temperature_calibration",
fallback_name="Local temperature calibration",
)
.tuya_switch(
dp_id=40,
attribute_name="child_lock",
translation_key="child_lock",
fallback_name="Child lock",
)
.tuya_dp(
dp_id=101,
ep_attribute=TuyaThermostatV2.ep_attribute,
attribute_name=TuyaThermostatV2.AttributeDefs.system_mode.name,
converter=lambda x: {
True: Thermostat.SystemMode.Heat,
False: Thermostat.SystemMode.Off,
}[x],
dp_converter=lambda x: {
Thermostat.SystemMode.Heat: True,
Thermostat.SystemMode.Off: False,
}[x],
)
.tuya_dp(
dp_id=102,
ep_attribute=TuyaThermostatV2.ep_attribute,
attribute_name=TuyaThermostatV2.AttributeDefs.local_temperature.name,
converter=lambda x: x * 10,
)
.tuya_dp(
dp_id=103,
ep_attribute=TuyaThermostatV2.ep_attribute,
attribute_name=TuyaThermostatV2.AttributeDefs.occupied_heating_setpoint.name,
converter=lambda x: x * 10,
dp_converter=lambda x: x // 10,
)
.tuya_binary_sensor(
dp_id=105,
attribute_name="battery_low",
device_class=BinarySensorDeviceClass.BATTERY,
fallback_name="Battery low",
)
.tuya_switch(
dp_id=106,
attribute_name="away_mode",
translation_key="away_mode",
fallback_name="Away mode",
)
.tuya_switch(
dp_id=108,
attribute_name="schedule_mode",
translation_key="schedule_mode",
fallback_name="Schedule mode",
)
.tuya_switch(
dp_id=130,
attribute_name="scale_protection",
translation_key="scale_protection",
fallback_name="Scale protection",
)
.adds(TuyaThermostatV2)
.skip_configuration()
.add_to_registry()
)

0 comments on commit b070528

Please sign in to comment.