Skip to content

Commit

Permalink
Adjust "wk" category add "ECO" as switch #257
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jun 4, 2024
1 parent 388933c commit 23bed62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions custom_components/localtuya/core/ha_entities/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class DPCode(StrEnum):
DOWN_CONFIRM = "down_confirm" # cover reset.
DO_NOT_DISTURB = "do_not_disturb"
DUSTER_CLOTH = "duster_cloth"
ECO = "eco"
ECO2 = "eco2"
EDGE_BRUSH = "edge_brush"
ELECTRICITY_LEFT = "electricity_left"
Expand Down Expand Up @@ -579,6 +580,7 @@ class DPCode(StrEnum):
SWITCH_WELCOME = "switch_welcome"
SYNC_REQUEST = "sync_request"
SYNC_RESPONSE = "sync_response"
SYSTEMMODE = "systemmode"
TBD = "tbd"
TEMP = "temp" # Temperature setting
TEMPACTIVATE = "tempactivate"
Expand Down
9 changes: 6 additions & 3 deletions custom_components/localtuya/core/ha_entities/climates.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def localtuya_climate(
"wind": HVACMode.FAN_ONLY,
"fan": HVACMode.FAN_ONLY,
"off": HVACMode.OFF,
"0": HVACMode.COOL,
"1": HVACMode.HEAT,
"2": HVACMode.FAN_ONLY,
}
MAP_CLIMATE_ACTIONS = {
"heating": HVACAction.HEATING,
Expand All @@ -127,7 +130,7 @@ def localtuya_climate(
DPCode.TEMP_CURRENT_F,
DPCode.TEMPCURRENT,
),
hvac_mode_dp=DPCode.MODE,
hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.MODE),
hvac_action_dp=(DPCode.WORK_MODE, DPCode.WORK_STATUS, DPCode.WORK_STATE),
preset_dp=DPCode.MODE,
fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED),
Expand Down Expand Up @@ -217,7 +220,7 @@ def localtuya_climate(
DPCode.TEMP_CURRENT_F,
DPCode.TEMPCURRENT,
),
hvac_mode_dp=(DPCode.SWITCH, DPCode.MODE),
hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.SWITCH, DPCode.MODE),
hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS),
preset_dp=DPCode.MODE,
fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED, DPCode.SPEED),
Expand Down Expand Up @@ -245,7 +248,7 @@ def localtuya_climate(
DPCode.TEMP_CURRENT_F,
DPCode.TEMPCURRENT,
),
hvac_mode_dp=DPCode.MODE,
hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.MODE),
hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS),
preset_dp=DPCode.MODE,
fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED, DPCode.SPEED),
Expand Down
22 changes: 21 additions & 1 deletion custom_components/localtuya/core/ha_entities/switches.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,22 @@
entity_category=EntityCategory.CONFIG,
),
),
# Thermostat
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
"wk": (
LocalTuyaEntity(
id=DPCode.CHILD_LOCK,
name="Child Lock",
icon="mdi:account-lock",
entity_category=EntityCategory.CONFIG,
),
LocalTuyaEntity(
id=DPCode.ECO,
name="ECO",
icon="mdi:sprout",
entity_category=EntityCategory.CONFIG,
),
),
}

# Scene Switch
Expand All @@ -939,7 +955,11 @@
# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s
SWITCHES["cz"] = SWITCHES["pc"]

SWITCHES["wk"] = CHILD_LOCK
# Climates / heaters
SWITCHES["wkf"] = SWITCHES["wk"]
SWITCHES["rs"] = SWITCHES["wk"]
SWITCHES["qn"] = SWITCHES["wk"]
SWITCHES["kt"] = SWITCHES["wk"]

# Dehumidifier
# https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha
Expand Down

0 comments on commit 23bed62

Please sign in to comment.