Add lower/upper temperature to Tuya thermostats

This commit is contained in:
epenet
2025-08-14 08:19:53 +00:00
parent 616b031df8
commit 1caffd39a3
4 changed files with 432 additions and 0 deletions

View File

@@ -249,6 +249,7 @@ class DPCode(StrEnum):
LIQUID_LEVEL_PERCENT = "liquid_level_percent"
LIQUID_STATE = "liquid_state"
LOCK = "lock" # Lock / Child lock
LOWER_TEMP = "lower_temp"
MACH_OPERATE = "mach_operate"
MANUAL_FEED = "manual_feed"
MASTER_MODE = "master_mode" # alarm mode

View File

@@ -398,6 +398,18 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
translation_key="temp_correction",
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.LOWER_TEMP,
translation_key="lower_temperature",
device_class=NumberDeviceClass.TEMPERATURE,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.UPPER_TEMP,
translation_key="upper_temperature",
device_class=NumberDeviceClass.TEMPERATURE,
entity_category=EntityCategory.CONFIG,
),
),
# Tank Level Sensor
# Note: Undocumented

View File

@@ -231,6 +231,12 @@
},
"maximum_liquid_depth": {
"name": "Maximum liquid depth"
},
"lower_temperature": {
"name": "Lower temperature"
},
"upper_temperature": {
"name": "Upper temperature"
}
},
"select": {

View File

@@ -58,6 +58,65 @@
'state': '1.0',
})
# ---
# name: test_platform_setup_and_discovery[number.boiler_temperature_controller_lower_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 120.0,
'min': -40.0,
'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.boiler_temperature_controller_lower_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Lower temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'lower_temperature',
'unique_id': 'tuya.zgiyrxflahjowpcckwlower_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.boiler_temperature_controller_lower_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Boiler Temperature Controller Lower temperature',
'max': 120.0,
'min': -40.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.1,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.boiler_temperature_controller_lower_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '60.0',
})
# ---
# name: test_platform_setup_and_discovery[number.boiler_temperature_controller_temperature_correction-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -116,6 +175,65 @@
'state': '-0.8',
})
# ---
# name: test_platform_setup_and_discovery[number.boiler_temperature_controller_upper_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 120.0,
'min': -40.0,
'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.boiler_temperature_controller_upper_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Upper temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'upper_temperature',
'unique_id': 'tuya.zgiyrxflahjowpcckwupper_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.boiler_temperature_controller_upper_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Boiler Temperature Controller Upper temperature',
'max': 120.0,
'min': -40.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.1,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.boiler_temperature_controller_upper_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '58.5',
})
# ---
# name: test_platform_setup_and_discovery[number.c9_volume-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1231,6 +1349,65 @@
'state': '-2.0',
})
# ---
# name: test_platform_setup_and_discovery[number.kabinet_upper_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 95.0,
'min': 35.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
}),
'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.kabinet_upper_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Upper temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'upper_temperature',
'unique_id': 'tuya.dn7cjik6kwupper_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.kabinet_upper_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Кабінет Upper temperature',
'max': 95.0,
'min': 35.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.kabinet_upper_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '45.0',
})
# ---
# name: test_platform_setup_and_discovery[number.multifunction_alarm_alarm_delay-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1700,6 +1877,65 @@
'state': '10.0',
})
# ---
# name: test_platform_setup_and_discovery[number.smart_thermostats_lower_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 20.0,
'min': 5.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 1.0,
}),
'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.smart_thermostats_lower_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Lower temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'lower_temperature',
'unique_id': 'tuya.sb3zdertrw50bgogkwlower_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.smart_thermostats_lower_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'smart thermostats Lower temperature',
'max': 20.0,
'min': 5.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 1.0,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.smart_thermostats_lower_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '5.0',
})
# ---
# name: test_platform_setup_and_discovery[number.smart_thermostats_temperature_correction-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1758,6 +1994,65 @@
'state': '-2.0',
})
# ---
# name: test_platform_setup_and_discovery[number.smart_thermostats_upper_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 90.0,
'min': 30.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 1.0,
}),
'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.smart_thermostats_upper_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Upper temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'upper_temperature',
'unique_id': 'tuya.sb3zdertrw50bgogkwupper_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.smart_thermostats_upper_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'smart thermostats Upper temperature',
'max': 90.0,
'min': 30.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 1.0,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.smart_thermostats_upper_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '30.0',
})
# ---
# name: test_platform_setup_and_discovery[number.sous_vide_cook_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1932,6 +2227,65 @@
'state': '95.0',
})
# ---
# name: test_platform_setup_and_discovery[number.wifi_smart_gas_boiler_thermostat_lower_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 14.0,
'min': 5.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
}),
'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_lower_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Lower temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'lower_temperature',
'unique_id': 'tuya.j6mn1t4ut5end6ifkwlower_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.wifi_smart_gas_boiler_thermostat_lower_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'WiFi Smart Gas Boiler Thermostat Lower temperature',
'max': 14.0,
'min': 5.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.wifi_smart_gas_boiler_thermostat_lower_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '5.0',
})
# ---
# name: test_platform_setup_and_discovery[number.wifi_smart_gas_boiler_thermostat_temperature_correction-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1990,3 +2344,62 @@
'state': '-1.5',
})
# ---
# name: test_platform_setup_and_discovery[number.wifi_smart_gas_boiler_thermostat_upper_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 35.0,
'min': 15.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
}),
'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_upper_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Upper temperature',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'upper_temperature',
'unique_id': 'tuya.j6mn1t4ut5end6ifkwupper_temp',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---
# name: test_platform_setup_and_discovery[number.wifi_smart_gas_boiler_thermostat_upper_temperature-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'WiFi Smart Gas Boiler Thermostat Upper temperature',
'max': 35.0,
'min': 15.0,
'mode': <NumberMode.AUTO: 'auto'>,
'step': 0.5,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'number.wifi_smart_gas_boiler_thermostat_upper_temperature',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '35.0',
})
# ---