Add motion detected binary_sensor for tplink (#127883)

* Add motion binary_sensor for tplink

* Remove strings definition as we have device class that handles this

* Simplify instructions

* Remove mentions about fixture creation and snapshot updates as requested

* re-add newline
This commit is contained in:
Teemu R. 2024-10-21 23:39:23 +02:00 committed by GitHub
parent 9cc934a972
commit 55ae43ed03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 0 deletions

View File

@ -58,6 +58,10 @@ BINARY_SENSOR_DESCRIPTIONS: Final = (
key="water_alert",
device_class=BinarySensorDeviceClass.MOISTURE,
),
TPLinkBinarySensorEntityDescription(
key="motion_detected",
device_class=BinarySensorDeviceClass.MOTION,
),
)
BINARYSENSOR_DESCRIPTIONS_MAP = {desc.key: desc for desc in BINARY_SENSOR_DESCRIPTIONS}

View File

@ -200,6 +200,11 @@
"type": "BinarySensor",
"category": "Primary"
},
"motion_detected": {
"value": false,
"type": "BinarySensor",
"category": "Primary"
},
"alarm": {
"value": false,
"type": "BinarySensor",

View File

@ -206,6 +206,53 @@
'state': 'off',
})
# ---
# name: test_states[binary_sensor.my_device_motion-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': None,
'entity_id': 'binary_sensor.my_device_motion',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
'original_icon': None,
'original_name': 'Motion',
'platform': 'tplink',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'motion_detected',
'unique_id': '123456789ABCDEFGH_motion_detected',
'unit_of_measurement': None,
})
# ---
# name: test_states[binary_sensor.my_device_motion-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'motion',
'friendly_name': 'my_device Motion',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.my_device_motion',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_states[binary_sensor.my_device_overheated-entry]
EntityRegistryEntrySnapshot({
'aliases': set({