diff --git a/src/amcrest2mqtt/mixins/amcrest.py b/src/amcrest2mqtt/mixins/amcrest.py index f95dab1..37def70 100644 --- a/src/amcrest2mqtt/mixins/amcrest.py +++ b/src/amcrest2mqtt/mixins/amcrest.py @@ -328,6 +328,9 @@ class AmcrestMixin: "device": device_block, } + # store device and any "modes" + self.upsert_device(device_id, component=component, modes=modes) + # defaults - which build_device_states doesn't update (events do) self.upsert_state( device_id, @@ -341,6 +344,11 @@ class AmcrestMixin: "human": False, }, sensor={ + "motion_detection": "ON", + "privacy": "OFF", + "storage_used": 0, + "storage_total": 0, + "storage_used_pct": 0, "motion_region": "n/a", "event_text": "", "event_time": None, @@ -348,7 +356,6 @@ class AmcrestMixin: "recording_url": "", }, ) - self.upsert_device(device_id, component=component, modes=modes) self.build_device_states(device_id) if not self.states[device_id]["internal"].get("discovered", None): diff --git a/src/amcrest2mqtt/mixins/amcrest_api.py b/src/amcrest2mqtt/mixins/amcrest_api.py index bcc2852..300aafc 100644 --- a/src/amcrest2mqtt/mixins/amcrest_api.py +++ b/src/amcrest2mqtt/mixins/amcrest_api.py @@ -114,7 +114,6 @@ class AmcrestAPIMixin: }, }, } - self.get_privacy_mode(serial_number) # Storage stats ------------------------------------------------------------------------------- @@ -124,9 +123,9 @@ class AmcrestAPIMixin: # return our last known state if we fail to get new stats current: dict[str, str | float] = { - "used_percent": states["sensor"]["used_percent"], - "used": states["sensor"]["used"], - "total": states["sensor"]["total"], + "used_percent": states["sensor"]["storage_used_pct"], + "used": states["sensor"]["storage_used"], + "total": states["sensor"]["storage_total"], } if not device["camera"]: