Add motion sensor setting to tplink (#129393)

This commit is contained in:
Teemu R. 2024-11-06 13:40:17 +01:00 committed by GitHub
parent 27e81fe0ed
commit c6cb2884f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 63 additions and 0 deletions

View File

@ -71,6 +71,12 @@
},
"child_lock": {
"default": "mdi:account-lock"
},
"pir_enabled": {
"default": "mdi:motion-sensor-off",
"state": {
"on": "mdi:motion-sensor"
}
}
},
"sensor": {

View File

@ -193,6 +193,9 @@
},
"child_lock": {
"name": "Child lock"
},
"pir_enabled": {
"name": "Motion sensor"
}
},
"number": {

View File

@ -51,6 +51,9 @@ SWITCH_DESCRIPTIONS: tuple[TPLinkSwitchEntityDescription, ...] = (
TPLinkSwitchEntityDescription(
key="child_lock",
),
TPLinkSwitchEntityDescription(
key="pir_enabled",
),
)
SWITCH_DESCRIPTIONS_MAP = {desc.key: desc for desc in SWITCH_DESCRIPTIONS}

View File

@ -39,6 +39,11 @@
"type": "Switch",
"category": "Config"
},
"pir_enabled": {
"value": true,
"type": "Switch",
"category": "Config"
},
"current_consumption": {
"value": 5.23,
"type": "Sensor",

View File

@ -311,6 +311,52 @@
'state': 'on',
})
# ---
# name: test_states[switch.my_device_motion_sensor-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.my_device_motion_sensor',
'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': 'Motion sensor',
'platform': 'tplink',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'pir_enabled',
'unique_id': '123456789ABCDEFGH_pir_enabled',
'unit_of_measurement': None,
})
# ---
# name: test_states[switch.my_device_motion_sensor-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'my_device Motion sensor',
}),
'context': <ANY>,
'entity_id': 'switch.my_device_motion_sensor',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_states[switch.my_device_smooth_transitions-entry]
EntityRegistryEntrySnapshot({
'aliases': set({