Add frost protection and valve status to Tuya thermostats (#150177)

This commit is contained in:
epenet
2025-08-10 21:37:14 +02:00
committed by GitHub
parent 79cfea3fea
commit b760bf342a
7 changed files with 217 additions and 0 deletions

View File

@@ -324,6 +324,15 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
on_value="alarm",
),
),
# Thermostat
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
"wk": (
TuyaBinarySensorEntityDescription(
key=DPCode.VALVE_STATE,
translation_key="valve",
on_value="open",
),
),
# Thermostatic Radiator Valve
# Not documented
"wkf": (

View File

@@ -209,6 +209,7 @@ class DPCode(StrEnum):
FLOODLIGHT_LIGHTNESS = "floodlight_lightness"
FLOODLIGHT_SWITCH = "floodlight_switch"
FORWARD_ENERGY_TOTAL = "forward_energy_total"
FROST = "frost" # Frost protection
GAS_SENSOR_STATE = "gas_sensor_state"
GAS_SENSOR_STATUS = "gas_sensor_status"
GAS_SENSOR_VALUE = "gas_sensor_value"
@@ -408,6 +409,7 @@ class DPCode(StrEnum):
VA_BATTERY = "va_battery"
VA_HUMIDITY = "va_humidity"
VA_TEMPERATURE = "va_temperature"
VALVE_STATE = "valve_state"
VOC_STATE = "voc_state"
VOC_VALUE = "voc_value"
VOICE_SWITCH = "voice_switch"

View File

@@ -15,6 +15,9 @@
},
"tilt": {
"default": "mdi:spirit-level"
},
"valve": {
"default": "mdi:pipe-valve"
}
},
"button": {

View File

@@ -63,6 +63,9 @@
"defrost": {
"name": "Defrost"
},
"valve": {
"name": "Valve"
},
"wet": {
"name": "Wet"
}
@@ -892,6 +895,9 @@
},
"siren": {
"name": "Siren"
},
"frost_protection": {
"name": "Frost protection"
}
}
},

View File

@@ -802,6 +802,11 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="child_lock",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.FROST,
translation_key="frost_protection",
entity_category=EntityCategory.CONFIG,
),
),
# Two-way temperature and humidity switch
# "MOES Temperature and Humidity Smart Switch Module MS-103"

View File

@@ -783,6 +783,54 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.smart_thermostats_valve-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.smart_thermostats_valve',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Valve',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'valve',
'unique_id': 'tuya.sb3zdertrw50bgogkwvalve_state',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.smart_thermostats_valve-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'smart thermostats Valve',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.smart_thermostats_valve',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.smoke_detector_upstairs_smoke-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@@ -2080,6 +2080,54 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.kabinet_frost_protection-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.kabinet_frost_protection',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Frost protection',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'frost_protection',
'unique_id': 'tuya.dn7cjik6kwfrost',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.kabinet_frost_protection-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Кабінет Frost protection',
}),
'context': <ANY>,
'entity_id': 'switch.kabinet_frost_protection',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.kalado_air_purifier_filter_cartridge_reset-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -3047,6 +3095,54 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_thermostats_frost_protection-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.smart_thermostats_frost_protection',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Frost protection',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'frost_protection',
'unique_id': 'tuya.sb3zdertrw50bgogkwfrost',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.smart_thermostats_frost_protection-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'smart thermostats Frost protection',
}),
'context': <ANY>,
'entity_id': 'switch.smart_thermostats_frost_protection',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_platform_setup_and_discovery[switch.socket3_switch_1-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -3771,6 +3867,54 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.wifi_smart_gas_boiler_thermostat_frost_protection-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.wifi_smart_gas_boiler_thermostat_frost_protection',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Frost protection',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'frost_protection',
'unique_id': 'tuya.j6mn1t4ut5end6ifkwfrost',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.wifi_smart_gas_boiler_thermostat_frost_protection-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'WiFi Smart Gas Boiler Thermostat Frost protection',
}),
'context': <ANY>,
'entity_id': 'switch.wifi_smart_gas_boiler_thermostat_frost_protection',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.xoca_dac212xc_v2_s1_switch-entry]
EntityRegistryEntrySnapshot({
'aliases': set({