From 40e235c2dfee463a94ecdab4b1d15a44f40df4d0 Mon Sep 17 00:00:00 2001 From: Jeff Culverhouse Date: Wed, 5 Nov 2025 11:50:40 -0500 Subject: [PATCH] chore: no need for timezone in config, just set in ENV; update sample files and README --- README.md | 8 +++++++- config.yaml.sample | 3 --- docker-compose.yaml | 3 +-- src/amcrest2mqtt/base.py | 2 -- src/amcrest2mqtt/mixins/helpers.py | 1 - 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d9b5978..0284aef 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ It supports the following environment variables: - `MEDIA_PATH` (optional) - path to store motion recordings (mp4) files - `MEDIA_SOURCE` (optional) - HomeAssistant url for accessing those recordings (see config.yaml.sample) -- `TZ` (required, timezone identifier, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) - `STORAGE_UPDATE_INTERVAL` (optional, default = 900) - how often to fetch storage stats (in seconds) - `SNAPSHOT_UPDATE_INTERVAL` (optional, default = 60) - how often to fetch camera snapshot (in seconds) @@ -114,6 +113,13 @@ drwxrwxrwx 1 appuser appuser ... /media Once configured correctly, you should see new recordings appear in your mounted folder with ownership 1000:1000 and a symlink to the latest file. +Also, make sure you have +``` +environment: + - TZ=America/New_York +``` +in your docker-compose if you want the recording filenames to by local time and not UTC. + ## Out of Scope ### Non-Docker Environments diff --git a/config.yaml.sample b/config.yaml.sample index 9908af7..4520b6b 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -34,6 +34,3 @@ amcrest: media: path: /media media_source: media-source://media_source/local/videos - -timezone: America/New_York -hide_ts: False diff --git a/docker-compose.yaml b/docker-compose.yaml index 9d540c6..12d01ac 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,8 +9,7 @@ services: volumes: - ./config:/config environment: - - TZ=${TZ:-UTC} - - CONFIG_PATH=/config/config.yaml + - TZ=America/New_York healthcheck: test: ["CMD", "python3", "/app/src/healthcheck.py"] interval: 60s diff --git a/src/amcrest2mqtt/base.py b/src/amcrest2mqtt/base.py index 2c8fbe7..324f865 100644 --- a/src/amcrest2mqtt/base.py +++ b/src/amcrest2mqtt/base.py @@ -59,8 +59,6 @@ class Base: self.device_interval = self.config["amcrest"].get("device_interval", 30) self.device_list_interval = self.config["amcrest"].get("device_list_interval", 300) - self.timezone = self.config["timezone"] - self.api_calls = 0 self.last_call_date = "" self.rate_limited = False diff --git a/src/amcrest2mqtt/mixins/helpers.py b/src/amcrest2mqtt/mixins/helpers.py index 41d8132..9a997f8 100644 --- a/src/amcrest2mqtt/mixins/helpers.py +++ b/src/amcrest2mqtt/mixins/helpers.py @@ -212,7 +212,6 @@ class HelpersMixin: "amcrest": amcrest, "debug": bool(config.get("debug", os.getenv("DEBUG", "").lower() == "true")), "hide_ts": bool(config.get("hide_ts", os.getenv("HIDE_TS", "").lower() == "true")), - "timezone": str(config.get("timezone", os.getenv("TZ", "UTC"))), "media": media, "config_from": config_from, "config_path": config_path,