Add battery status and configuration entities to Tuya thermostat (wk) (#148821)

This commit is contained in:
epenet 2025-07-16 10:15:44 +02:00 committed by GitHub
parent 84e3dac406
commit 6833bf1900
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 128 additions and 0 deletions

View File

@ -352,6 +352,7 @@ class DPCode(StrEnum):
TEMP_BOILING_C = "temp_boiling_c"
TEMP_BOILING_F = "temp_boiling_f"
TEMP_CONTROLLER = "temp_controller"
TEMP_CORRECTION = "temp_correction"
TEMP_CURRENT = "temp_current" # Current temperature in °C
TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F
TEMP_CURRENT_EXTERNAL = (

View File

@ -295,6 +295,15 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Thermostat
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
"wk": (
NumberEntityDescription(
key=DPCode.TEMP_CORRECTION,
translation_key="temp_correction",
entity_category=EntityCategory.CONFIG,
),
),
# Vibration Sensor
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
"zd": (

View File

@ -1077,6 +1077,9 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
*BATTERY_SENSORS,
),
# Thermostat
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
"wk": (*BATTERY_SENSORS,),
# Two-way temperature and humidity switch
# "MOES Temperature and Humidity Smart Switch Module MS-103"
# Documentation not found

View File

@ -219,6 +219,9 @@
},
"down_delay": {
"name": "Down delay"
},
"temp_correction": {
"name": "Temperature correction"
}
},
"select": {

View File

@ -126,6 +126,8 @@ DEVICE_MOCKS = {
"wk_wifi_smart_gas_boiler_thermostat": [
# https://github.com/orgs/home-assistant/discussions/243
Platform.CLIMATE,
Platform.NUMBER,
Platform.SENSOR,
Platform.SWITCH,
],
"wsdcg_temperature_humidity": [

View File

@ -56,3 +56,60 @@
'state': '1.0',
})
# ---
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][number.wifi_smart_gas_boiler_thermostat_temperature_correction-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 9.9,
'min': -9.9,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.1,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'number',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'number.wifi_smart_gas_boiler_thermostat_temperature_correction',
'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': 'Temperature correction',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'temp_correction',
'unique_id': 'tuya.bfb45cb8a9452fba66lexgtemp_correction',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][number.wifi_smart_gas_boiler_thermostat_temperature_correction-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'WiFi Smart Gas Boiler Thermostat Temperature correction',
'max': 9.9,
'min': -9.9,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.1,
}),
'context': <ANY>,
'entity_id': 'number.wifi_smart_gas_boiler_thermostat_temperature_correction',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '-1.5',
})
# ---

View File

@ -1966,6 +1966,59 @@
'state': '0.0',
})
# ---
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][sensor.wifi_smart_gas_boiler_thermostat_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.wifi_smart_gas_boiler_thermostat_battery',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.BATTERY: 'battery'>,
'original_icon': None,
'original_name': 'Battery',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'battery',
'unique_id': 'tuya.bfb45cb8a9452fba66lexgbattery_percentage',
'unit_of_measurement': '%',
})
# ---
# name: test_platform_setup_and_discovery[wk_wifi_smart_gas_boiler_thermostat][sensor.wifi_smart_gas_boiler_thermostat_battery-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'battery',
'friendly_name': 'WiFi Smart Gas Boiler Thermostat Battery',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.wifi_smart_gas_boiler_thermostat_battery',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '100.0',
})
# ---
# name: test_platform_setup_and_discovery[wsdcg_temperature_humidity][sensor.np_downstairs_north_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({