Add power protection entities for tplink (#132267)

Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Teemu R. 2025-01-29 06:34:26 +01:00 committed by GitHub
parent 48dfa037bd
commit 94e4863cbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 127 additions and 0 deletions

View File

@ -35,6 +35,10 @@ BINARY_SENSOR_DESCRIPTIONS: Final = (
key="overheated",
device_class=BinarySensorDeviceClass.PROBLEM,
),
TPLinkBinarySensorEntityDescription(
key="overloaded",
device_class=BinarySensorDeviceClass.PROBLEM,
),
TPLinkBinarySensorEntityDescription(
key="battery_low",
device_class=BinarySensorDeviceClass.BATTERY,

View File

@ -65,6 +65,10 @@ NUMBER_DESCRIPTIONS: Final = (
key="tilt_step",
mode=NumberMode.BOX,
),
TPLinkNumberEntityDescription(
key="power_protection_threshold",
mode=NumberMode.SLIDER,
),
TPLinkNumberEntityDescription(
key="clean_count",
mode=NumberMode.SLIDER,

View File

@ -109,6 +109,9 @@
"overheated": {
"name": "Overheated"
},
"overloaded": {
"name": "Overloaded"
},
"cloud_connection": {
"name": "Cloud connection"
},
@ -268,6 +271,9 @@
"temperature_offset": {
"name": "Temperature offset"
},
"power_protection_threshold": {
"name": "Power protection"
},
"pan_step": {
"name": "Pan degrees"
},

View File

@ -195,6 +195,11 @@
"type": "BinarySensor",
"category": "Info"
},
"overloaded": {
"value": false,
"type": "BinarySensor",
"category": "Info"
},
"battery_low": {
"value": false,
"type": "BinarySensor",
@ -284,6 +289,12 @@
"minimum_value": -10,
"maximum_value": 10
},
"power_protection_threshold": {
"value": 100,
"type": "Number",
"category": "Config",
"minimum_value": 0
},
"target_temperature": {
"value": false,
"type": "Number",

View File

@ -300,6 +300,53 @@
'state': 'off',
})
# ---
# name: test_states[binary_sensor.my_device_overloaded-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.my_device_overloaded',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Overloaded',
'platform': 'tplink',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'overloaded',
'unique_id': '123456789ABCDEFGH_overloaded',
'unit_of_measurement': None,
})
# ---
# name: test_states[binary_sensor.my_device_overloaded-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'my_device Overloaded',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.my_device_overloaded',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_states[binary_sensor.my_device_temperature_warning-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@ -145,6 +145,61 @@
'state': '10',
})
# ---
# name: test_states[number.my_device_power_protection-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 65536,
'min': 0,
'mode': <NumberMode.SLIDER: 'slider'>,
'step': 1.0,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'number',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'number.my_device_power_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': 'Power protection',
'platform': 'tplink',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'power_protection_threshold',
'unique_id': '123456789ABCDEFGH_power_protection_threshold',
'unit_of_measurement': None,
})
# ---
# name: test_states[number.my_device_power_protection-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'my_device Power protection',
'max': 65536,
'min': 0,
'mode': <NumberMode.SLIDER: 'slider'>,
'step': 1.0,
}),
'context': <ANY>,
'entity_id': 'number.my_device_power_protection',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '100',
})
# ---
# name: test_states[number.my_device_smooth_off-entry]
EntityRegistryEntrySnapshot({
'aliases': set({