Add detection switches to tplink integration (#133828)
parent
4ed0c21a4a
commit
8ab936b87c
|
@ -89,6 +89,30 @@
|
||||||
"state": {
|
"state": {
|
||||||
"on": "mdi:motion-sensor"
|
"on": "mdi:motion-sensor"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"motion_detection": {
|
||||||
|
"default": "mdi:motion-sensor-off",
|
||||||
|
"state": {
|
||||||
|
"on": "mdi:motion-sensor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"person_detection": {
|
||||||
|
"default": "mdi:account-off",
|
||||||
|
"state": {
|
||||||
|
"on": "mdi:account"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tamper_detection": {
|
||||||
|
"default": "mdi:shield-off",
|
||||||
|
"state": {
|
||||||
|
"on": "mdi:shield"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"baby_cry_detection": {
|
||||||
|
"default": "mdi:baby-face-outline",
|
||||||
|
"state": {
|
||||||
|
"on": "mdi:baby-face"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
|
|
@ -233,6 +233,18 @@
|
||||||
},
|
},
|
||||||
"pir_enabled": {
|
"pir_enabled": {
|
||||||
"name": "Motion sensor"
|
"name": "Motion sensor"
|
||||||
|
},
|
||||||
|
"motion_detection": {
|
||||||
|
"name": "Motion detection"
|
||||||
|
},
|
||||||
|
"person_detection": {
|
||||||
|
"name": "Person detection"
|
||||||
|
},
|
||||||
|
"tamper_detection": {
|
||||||
|
"name": "Tamper detection"
|
||||||
|
},
|
||||||
|
"baby_cry_detection": {
|
||||||
|
"name": "Baby cry detection"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"number": {
|
"number": {
|
||||||
|
|
|
@ -54,6 +54,18 @@ SWITCH_DESCRIPTIONS: tuple[TPLinkSwitchEntityDescription, ...] = (
|
||||||
TPLinkSwitchEntityDescription(
|
TPLinkSwitchEntityDescription(
|
||||||
key="pir_enabled",
|
key="pir_enabled",
|
||||||
),
|
),
|
||||||
|
TPLinkSwitchEntityDescription(
|
||||||
|
key="motion_detection",
|
||||||
|
),
|
||||||
|
TPLinkSwitchEntityDescription(
|
||||||
|
key="person_detection",
|
||||||
|
),
|
||||||
|
TPLinkSwitchEntityDescription(
|
||||||
|
key="tamper_detection",
|
||||||
|
),
|
||||||
|
TPLinkSwitchEntityDescription(
|
||||||
|
key="baby_cry_detection",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
SWITCH_DESCRIPTIONS_MAP = {desc.key: desc for desc in SWITCH_DESCRIPTIONS}
|
SWITCH_DESCRIPTIONS_MAP = {desc.key: desc for desc in SWITCH_DESCRIPTIONS}
|
||||||
|
|
|
@ -44,6 +44,26 @@
|
||||||
"type": "Switch",
|
"type": "Switch",
|
||||||
"category": "Config"
|
"category": "Config"
|
||||||
},
|
},
|
||||||
|
"motion_detection": {
|
||||||
|
"value": true,
|
||||||
|
"type": "Switch",
|
||||||
|
"category": "Primary"
|
||||||
|
},
|
||||||
|
"person_detection": {
|
||||||
|
"value": true,
|
||||||
|
"type": "Switch",
|
||||||
|
"category": "Primary"
|
||||||
|
},
|
||||||
|
"tamper_detection": {
|
||||||
|
"value": true,
|
||||||
|
"type": "Switch",
|
||||||
|
"category": "Primary"
|
||||||
|
},
|
||||||
|
"baby_cry_detection": {
|
||||||
|
"value": true,
|
||||||
|
"type": "Switch",
|
||||||
|
"category": "Primary"
|
||||||
|
},
|
||||||
"current_consumption": {
|
"current_consumption": {
|
||||||
"value": 5.23,
|
"value": 5.23,
|
||||||
"type": "Sensor",
|
"type": "Sensor",
|
||||||
|
|
|
@ -173,6 +173,52 @@
|
||||||
'state': 'on',
|
'state': 'on',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[switch.my_device_baby_cry_detection-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': None,
|
||||||
|
'entity_id': 'switch.my_device_baby_cry_detection',
|
||||||
|
'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': 'Baby cry detection',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'baby_cry_detection',
|
||||||
|
'unique_id': '123456789ABCDEFGH_baby_cry_detection',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[switch.my_device_baby_cry_detection-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'my_device Baby cry detection',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'switch.my_device_baby_cry_detection',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'on',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[switch.my_device_child_lock-entry]
|
# name: test_states[switch.my_device_child_lock-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
@ -311,6 +357,52 @@
|
||||||
'state': 'on',
|
'state': 'on',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[switch.my_device_motion_detection-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': None,
|
||||||
|
'entity_id': 'switch.my_device_motion_detection',
|
||||||
|
'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 detection',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'motion_detection',
|
||||||
|
'unique_id': '123456789ABCDEFGH_motion_detection',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[switch.my_device_motion_detection-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'my_device Motion detection',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'switch.my_device_motion_detection',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'on',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[switch.my_device_motion_sensor-entry]
|
# name: test_states[switch.my_device_motion_sensor-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
@ -357,6 +449,52 @@
|
||||||
'state': 'on',
|
'state': 'on',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[switch.my_device_person_detection-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': None,
|
||||||
|
'entity_id': 'switch.my_device_person_detection',
|
||||||
|
'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': 'Person detection',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'person_detection',
|
||||||
|
'unique_id': '123456789ABCDEFGH_person_detection',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[switch.my_device_person_detection-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'my_device Person detection',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'switch.my_device_person_detection',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'on',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_states[switch.my_device_smooth_transitions-entry]
|
# name: test_states[switch.my_device_smooth_transitions-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
|
@ -403,3 +541,49 @@
|
||||||
'state': 'on',
|
'state': 'on',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_states[switch.my_device_tamper_detection-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': None,
|
||||||
|
'entity_id': 'switch.my_device_tamper_detection',
|
||||||
|
'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': 'Tamper detection',
|
||||||
|
'platform': 'tplink',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'tamper_detection',
|
||||||
|
'unique_id': '123456789ABCDEFGH_tamper_detection',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_states[switch.my_device_tamper_detection-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'my_device Tamper detection',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'switch.my_device_tamper_detection',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'on',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
|
Loading…
Reference in New Issue