mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
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:
parent
5348ea3ac4
commit
f3838dde3a
@ -158,7 +158,16 @@ class EventManager:
|
|||||||
if not msg.Topic:
|
if not msg.Topic:
|
||||||
continue
|
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 not (parser := PARSERS.get(topic)):
|
||||||
if topic not in UNHANDLED_TOPICS:
|
if topic not in UNHANDLED_TOPICS:
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user