mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add jobstate parser to Onvif integration (#46589)
This commit is contained in:
parent
a583f56bd8
commit
53a9c117ee
@ -387,3 +387,25 @@ async def async_parse_last_clock_sync(uid: str, msg) -> Event:
|
|||||||
)
|
)
|
||||||
except (AttributeError, KeyError, ValueError):
|
except (AttributeError, KeyError, ValueError):
|
||||||
return None
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user