Cleanup onvif topic before lookup (#91914)

* Cleanup onvif topic before lookup

Some devices will append . and / to the path. We need
to strip it off to find the correct matcher

fixes #51870

* Update homeassistant/components/onvif/event.py

* Update homeassistant/components/onvif/event.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
J. Nick Koston 2023-04-23 22:02:08 -05:00 committed by GitHub
parent 5348ea3ac4
commit f3838dde3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,16 @@ class EventManager:
if not msg.Topic:
continue
topic = msg.Topic._value_1
# Topic may look like the following
#
# tns1:RuleEngine/CellMotionDetector/Motion//.
# tns1:RuleEngine/CellMotionDetector/Motion
# tns1:RuleEngine/CellMotionDetector/Motion/
#
# Our parser expects the topic to be
# tns1:RuleEngine/CellMotionDetector/Motion
topic = msg.Topic._value_1.rstrip("/.")
if not (parser := PARSERS.get(topic)):
if topic not in UNHANDLED_TOPICS:
LOGGER.info(