forked from home-assistant/core
Add jobstate parser to Onvif integration (#46589)
This commit is contained in:
@@ -387,3 +387,25 @@ async def async_parse_last_clock_sync(uid: str, msg) -> Event:
|
||||
)
|
||||
except (AttributeError, KeyError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
@PARSERS.register("tns1:RecordingConfig/JobState")
|
||||
# pylint: disable=protected-access
|
||||
async def async_parse_jobstate(uid: str, msg) -> Event:
|
||||
"""Handle parsing event message.
|
||||
|
||||
Topic: tns1:RecordingConfig/JobState*
|
||||
"""
|
||||
|
||||
try:
|
||||
source = msg.Message._value_1.Source.SimpleItem[0].Value
|
||||
return Event(
|
||||
f"{uid}_{msg.Topic._value_1}_{source}",
|
||||
f"{source} JobState",
|
||||
"binary_sensor",
|
||||
None,
|
||||
None,
|
||||
msg.Message._value_1.Data.SimpleItem[0].Value == "Active",
|
||||
)
|
||||
except (AttributeError, KeyError):
|
||||
return None
|
||||
|
Reference in New Issue
Block a user