diff --git a/src/amcrest2mqtt/mixins/amcrest_api.py b/src/amcrest2mqtt/mixins/amcrest_api.py index 2661dff..63aecc0 100644 --- a/src/amcrest2mqtt/mixins/amcrest_api.py +++ b/src/amcrest2mqtt/mixins/amcrest_api.py @@ -4,7 +4,7 @@ from amcrest import AmcrestCamera from amcrest.exceptions import LoginError, AmcrestError, CommError import asyncio import base64 -from datetime import datetime, timezone +from datetime import datetime import random from typing import TYPE_CHECKING, Any, cast @@ -262,10 +262,6 @@ class AmcrestAPIMixin: self.upsert_state( device_id, image={"snapshot": encoded}, - sensor={ - "event_text": "Got snapshot", - "event_time": datetime.now(timezone.utc).isoformat(), - }, ) self.publish_device_state(device_id) diff --git a/src/amcrest2mqtt/mixins/events.py b/src/amcrest2mqtt/mixins/events.py index dfd3435..1382a93 100644 --- a/src/amcrest2mqtt/mixins/events.py +++ b/src/amcrest2mqtt/mixins/events.py @@ -61,9 +61,7 @@ class EventsMixin: if event in ["motion", "human", "doorbell"] and states["switch"]["privacy"] != "OFF": self.upsert_state(device_id, switch={"privacy_mode": "OFF"}) - # send most everything to the device's event_text/time - if event not in ["NTPAdjustTime"]: - self.logger.debug(f'got event {{{event}: {payload}}} for "{self.get_device_name(device_id)}"') + # record just these "events": text and time self.upsert_state( device_id, sensor={ @@ -72,6 +70,8 @@ class EventsMixin: }, ) needs_publish.add(device_id) + else: + self.logger.info(f'Ignored event for "{self.get_device_name(device_id)}": {event} with {payload}') for id in needs_publish: self.publish_device_state(id)