Add Human Shape Detect to ONVIF (#125335)

added Humap Shape Detect
This commit is contained in:
René Honig 2024-09-10 15:39:53 +02:00 committed by GitHub
parent ed907da190
commit 337335bfad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View File

@ -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

View File

@ -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