diff --git a/homeassistant/components/onvif/event.py b/homeassistant/components/onvif/event.py index a8f1b7f702d..95aa0728a19 100644 --- a/homeassistant/components/onvif/event.py +++ b/homeassistant/components/onvif/event.py @@ -157,6 +157,7 @@ class EventManager: # tns1:RuleEngine/CellMotionDetector/Motion//. # tns1:RuleEngine/CellMotionDetector/Motion # tns1:RuleEngine/CellMotionDetector/Motion/ + # tns1:UserAlarm/IVA/HumanShapeDetect # # Our parser expects the topic to be # tns1:RuleEngine/CellMotionDetector/Motion diff --git a/homeassistant/components/onvif/parsers.py b/homeassistant/components/onvif/parsers.py index c67cdceed54..57bd8a974db 100644 --- a/homeassistant/components/onvif/parsers.py +++ b/homeassistant/components/onvif/parsers.py @@ -711,3 +711,29 @@ async def async_parse_count_aggregation_counter(uid: str, msg) -> Event | None: ) except (AttributeError, KeyError): return None + + +@PARSERS.register("tns1:UserAlarm/IVA/HumanShapeDetect") +async def async_parse_human_shape_detect(uid: str, msg) -> Event | None: + """Handle parsing event message. + + Topic: tns1:UserAlarm/IVA/HumanShapeDetect + """ + try: + topic, payload = extract_message(msg) + video_source = "" + for source in payload.Source.SimpleItem: + if source.Name == "VideoSourceConfigurationToken": + video_source = _normalize_video_source(source.Value) + break + + return Event( + f"{uid}_{topic}_{video_source}", + "Human Shape Detect", + "binary_sensor", + "motion", + None, + payload.Data.SimpleItem[0].Value == "true", + ) + except (AttributeError, KeyError): + return None