diff --git a/homeassistant/components/tplink/binary_sensor.py b/homeassistant/components/tplink/binary_sensor.py index e08495f5c8878f3a152b8864e7834fe16260ee21..6986765b1106f1347ab27e11992f2a61a80d51da 100644 --- a/homeassistant/components/tplink/binary_sensor.py +++ b/homeassistant/components/tplink/binary_sensor.py @@ -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, diff --git a/homeassistant/components/tplink/number.py b/homeassistant/components/tplink/number.py index b47c50d688f554d9d22afec2bdb4fe63b7522fe5..a9d002c00835ed8aca5d46b2d40adf888910ca74 100644 --- a/homeassistant/components/tplink/number.py +++ b/homeassistant/components/tplink/number.py @@ -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, diff --git a/homeassistant/components/tplink/strings.json b/homeassistant/components/tplink/strings.json index 034aff7a7639b1aa99e4d234f661e9cc5f39910b..fe661fa25296ee699455807dbf9ac53d5d15ba0e 100644 --- a/homeassistant/components/tplink/strings.json +++ b/homeassistant/components/tplink/strings.json @@ -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" }, diff --git a/tests/components/tplink/fixtures/features.json b/tests/components/tplink/fixtures/features.json index d366a91c33ca3b6abe3d6c87a0e21aa7719feb78..c49c5881d5c94e69fb9fdee15ef3c43894d1dffe 100644 --- a/tests/components/tplink/fixtures/features.json +++ b/tests/components/tplink/fixtures/features.json @@ -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", diff --git a/tests/components/tplink/snapshots/test_binary_sensor.ambr b/tests/components/tplink/snapshots/test_binary_sensor.ambr index e16d440951161fedfeb6893bf3a8a2bd64d2e862..125592b053c3ff9409d0d11203d014f01cbdbc5d 100644 --- a/tests/components/tplink/snapshots/test_binary_sensor.ambr +++ b/tests/components/tplink/snapshots/test_binary_sensor.ambr @@ -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({ diff --git a/tests/components/tplink/snapshots/test_number.ambr b/tests/components/tplink/snapshots/test_number.ambr index 6733c5423a049066c2f8e10463a4f5e34804bb08..4bdb92aeab69ebdc24ec69fe386f85435c090a1b 100644 --- a/tests/components/tplink/snapshots/test_number.ambr +++ b/tests/components/tplink/snapshots/test_number.ambr @@ -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({