From abe9b5ce5ea58ebf433416ec67b8f37b8c92be71 Mon Sep 17 00:00:00 2001 From: Ben Homan Date: Thu, 10 Jun 2021 09:10:33 -0400 Subject: [PATCH] Add AMCREST_POLL_STORAGE option to allow user to skip polling storage information. --- README.md | 2 +- src/amcrest2mqtt.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10817d5..ce4e828 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It supports the following environment variables: - `AMCREST_PORT` (optional, default = 80) - `AMCREST_USERNAME` (optional, default = admin) - `AMCREST_PASSWORD` (required) -- `AMCREST_PROBE_STORAGE` (optional, default = true) +- `AMCREST_POLL_STORAGE` (optional, default = true) - `MQTT_USERNAME` (required) - `MQTT_PASSWORD` (optional, default = empty password) - `MQTT_HOST` (optional, default = 'localhost') diff --git a/src/amcrest2mqtt.py b/src/amcrest2mqtt.py index cee0f7d..142c4de 100644 --- a/src/amcrest2mqtt.py +++ b/src/amcrest2mqtt.py @@ -17,7 +17,7 @@ amcrest_host = os.getenv("AMCREST_HOST") amcrest_port = int(os.getenv("AMCREST_PORT") or 80) amcrest_username = os.getenv("AMCREST_USERNAME") or "admin" amcrest_password = os.getenv("AMCREST_PASSWORD") -amcrest_probe_storage = os.getenv("AMCREST_PROBE_STORAGE") == "true" +amcrest_poll_storage = os.getenv("AMCREST_POLL_STORAGE") == "true" mqtt_host = os.getenv("MQTT_HOST") or "localhost" mqtt_qos = int(os.getenv("MQTT_QOS") or 0) @@ -240,7 +240,7 @@ if home_assistant: json=True, ) - if amcrest_probe_storage: + if amcrest_poll_storage: mqtt_publish( topics["home_assistant"]["storage_used_percent"], base_config @@ -290,7 +290,7 @@ mqtt_publish(topics["config"], { "serial_number": serial_number, }, json=True) -if amcrest_probe_storage: +if amcrest_poll_storage: refresh_storage_sensors() log("Listening for events...")