From 773890dc7b14a8e0efc860210a37fb590240f309 Mon Sep 17 00:00:00 2001 From: Bjarne Riis Date: Mon, 18 Apr 2022 05:07:14 +0000 Subject: [PATCH] Added event_score_humand and event_score_vehicle Threshold setting for Human / Vehicle classification to reduce false positives? #38 --- custom_components/securityspy/binary_sensor.py | 6 ++++-- custom_components/securityspy/const.py | 3 ++- custom_components/securityspy/sensor.py | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/custom_components/securityspy/binary_sensor.py b/custom_components/securityspy/binary_sensor.py index 996756e..1da593c 100644 --- a/custom_components/securityspy/binary_sensor.py +++ b/custom_components/securityspy/binary_sensor.py @@ -18,7 +18,8 @@ from .const import ( ATTR_EVENT_LENGTH, ATTR_EVENT_OBJECT, - ATTR_EVENT_SCORE, + ATTR_EVENT_SCORE_HUMAN, + ATTR_EVENT_SCORE_VEHICLE, DOMAIN, ) from .entity import SecuritySpyEntity @@ -121,7 +122,8 @@ def extra_state_attributes(self): ATTR_LAST_TRIP_TIME: self._device_data["last_motion"], ATTR_EVENT_LENGTH: self._device_data["event_length"], ATTR_EVENT_OBJECT: self._device_data["event_object"], - ATTR_EVENT_SCORE: self._device_data["event_score"], + ATTR_EVENT_SCORE_HUMAN: self._device_data["event_score_human"], + ATTR_EVENT_SCORE_VEHICLE: self._device_data["event_score_vehicle"], } return { **super().extra_state_attributes, diff --git a/custom_components/securityspy/const.py b/custom_components/securityspy/const.py index 01581fb..8687a12 100644 --- a/custom_components/securityspy/const.py +++ b/custom_components/securityspy/const.py @@ -29,7 +29,8 @@ ATTR_BRAND = "brand" ATTR_EVENT_LENGTH = "event_length" ATTR_EVENT_OBJECT = "event_object" -ATTR_EVENT_SCORE = "event_score" +ATTR_EVENT_SCORE_HUMAN = "event_score_human" +ATTR_EVENT_SCORE_VEHICLE = "event_score_vehicle" ATTR_PRESET_ID = "preset_id" ATTR_PTZ_CAPABILITIES = "ptz_capabilities" diff --git a/custom_components/securityspy/sensor.py b/custom_components/securityspy/sensor.py index 2686b2c..9ab6966 100644 --- a/custom_components/securityspy/sensor.py +++ b/custom_components/securityspy/sensor.py @@ -14,7 +14,8 @@ from .entity import SecuritySpyEntity from .const import ( - ATTR_EVENT_SCORE, + ATTR_EVENT_SCORE_HUMAN, + ATTR_EVENT_SCORE_VEHICLE, DEVICE_CLASS_DETECTION, DOMAIN, RECORDING_TYPE_ACTION, @@ -130,7 +131,8 @@ def extra_state_attributes(self): if self._description.device_type == DEVICE_CLASS_DETECTION: return { **super().extra_state_attributes, - ATTR_EVENT_SCORE: self._device_data["event_score"], + ATTR_EVENT_SCORE_HUMAN: self._device_data["event_score_human"], + ATTR_EVENT_SCORE_VEHICLE: self._device_data["event_score_vehicle"], } return { **super().extra_state_attributes,