|
|
|
@@ -11,7 +11,9 @@ from homeassistant.util.decorator import Registry
|
|
|
|
|
|
|
|
|
|
from .models import Event
|
|
|
|
|
|
|
|
|
|
PARSERS: Registry[str, Callable[[str, Any], Coroutine[Any, Any, Event]]] = Registry()
|
|
|
|
|
PARSERS: Registry[
|
|
|
|
|
str, Callable[[str, Any], Coroutine[Any, Any, Event | None]]
|
|
|
|
|
] = Registry()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def local_datetime_or_none(value: str) -> datetime.datetime | None:
|
|
|
|
@@ -28,7 +30,7 @@ def local_datetime_or_none(value: str) -> datetime.datetime | None:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/MotionAlarm")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_motion_alarm(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_motion_alarm(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:VideoSource/MotionAlarm
|
|
|
|
@@ -51,7 +53,7 @@ async def async_parse_motion_alarm(uid: str, msg) -> Event:
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooBlurry/ImagingService")
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooBlurry/RecordingService")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_image_too_blurry(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_image_too_blurry(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:VideoSource/ImageTooBlurry/*
|
|
|
|
@@ -75,7 +77,7 @@ async def async_parse_image_too_blurry(uid: str, msg) -> Event:
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooDark/ImagingService")
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooDark/RecordingService")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_image_too_dark(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_image_too_dark(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:VideoSource/ImageTooDark/*
|
|
|
|
@@ -99,7 +101,7 @@ async def async_parse_image_too_dark(uid: str, msg) -> Event:
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooBright/ImagingService")
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/ImageTooBright/RecordingService")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_image_too_bright(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_image_too_bright(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:VideoSource/ImageTooBright/*
|
|
|
|
@@ -123,7 +125,7 @@ async def async_parse_image_too_bright(uid: str, msg) -> Event:
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/GlobalSceneChange/ImagingService")
|
|
|
|
|
@PARSERS.register("tns1:VideoSource/GlobalSceneChange/RecordingService")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_scene_change(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_scene_change(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:VideoSource/GlobalSceneChange/*
|
|
|
|
@@ -144,7 +146,7 @@ async def async_parse_scene_change(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:AudioAnalytics/Audio/DetectedSound")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_detected_sound(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_detected_sound(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:AudioAnalytics/Audio/DetectedSound
|
|
|
|
@@ -175,7 +177,7 @@ async def async_parse_detected_sound(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:RuleEngine/FieldDetector/ObjectsInside")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_field_detector(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_field_detector(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:RuleEngine/FieldDetector/ObjectsInside
|
|
|
|
@@ -207,7 +209,7 @@ async def async_parse_field_detector(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:RuleEngine/CellMotionDetector/Motion")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_cell_motion_detector(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_cell_motion_detector(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:RuleEngine/CellMotionDetector/Motion
|
|
|
|
@@ -238,7 +240,7 @@ async def async_parse_cell_motion_detector(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:RuleEngine/MotionRegionDetector/Motion")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_motion_region_detector(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_motion_region_detector(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:RuleEngine/MotionRegionDetector/Motion
|
|
|
|
@@ -269,7 +271,7 @@ async def async_parse_motion_region_detector(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:RuleEngine/TamperDetector/Tamper")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_tamper_detector(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_tamper_detector(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:RuleEngine/TamperDetector/Tamper
|
|
|
|
@@ -301,7 +303,7 @@ async def async_parse_tamper_detector(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Device/Trigger/DigitalInput")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_digital_input(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_digital_input(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Device/Trigger/DigitalInput
|
|
|
|
@@ -322,7 +324,7 @@ async def async_parse_digital_input(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Device/Trigger/Relay")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_relay(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_relay(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Device/Trigger/Relay
|
|
|
|
@@ -343,7 +345,7 @@ async def async_parse_relay(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Device/HardwareFailure/StorageFailure")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_storage_failure(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_storage_failure(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Device/HardwareFailure/StorageFailure
|
|
|
|
@@ -365,7 +367,7 @@ async def async_parse_storage_failure(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Monitoring/ProcessorUsage")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_processor_usage(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_processor_usage(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Monitoring/ProcessorUsage
|
|
|
|
@@ -390,7 +392,7 @@ async def async_parse_processor_usage(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Monitoring/OperatingTime/LastReboot")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_last_reboot(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_last_reboot(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Monitoring/OperatingTime/LastReboot
|
|
|
|
@@ -414,7 +416,7 @@ async def async_parse_last_reboot(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Monitoring/OperatingTime/LastReset")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_last_reset(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_last_reset(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Monitoring/OperatingTime/LastReset
|
|
|
|
@@ -439,7 +441,7 @@ async def async_parse_last_reset(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Monitoring/Backup/Last")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_backup_last(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_backup_last(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Monitoring/Backup/Last
|
|
|
|
@@ -465,7 +467,7 @@ async def async_parse_backup_last(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:Monitoring/OperatingTime/LastClockSynchronization")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_last_clock_sync(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_last_clock_sync(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:Monitoring/OperatingTime/LastClockSynchronization
|
|
|
|
@@ -490,7 +492,7 @@ async def async_parse_last_clock_sync(uid: str, msg) -> Event:
|
|
|
|
|
|
|
|
|
|
@PARSERS.register("tns1:RecordingConfig/JobState")
|
|
|
|
|
# pylint: disable=protected-access
|
|
|
|
|
async def async_parse_jobstate(uid: str, msg) -> Event:
|
|
|
|
|
async def async_parse_jobstate(uid: str, msg) -> Event | None:
|
|
|
|
|
"""Handle parsing event message.
|
|
|
|
|
|
|
|
|
|
Topic: tns1:RecordingConfig/JobState
|
|
|
|
|