Add AMCREST_POLL_STORAGE option to allow user to skip polling storage information.

pull/19/head
Ben Homan 4 years ago
parent 30c4b09c5a
commit abe9b5ce5e

@ -9,7 +9,7 @@ It supports the following environment variables:
- `AMCREST_PORT` (optional, default = 80) - `AMCREST_PORT` (optional, default = 80)
- `AMCREST_USERNAME` (optional, default = admin) - `AMCREST_USERNAME` (optional, default = admin)
- `AMCREST_PASSWORD` (required) - `AMCREST_PASSWORD` (required)
- `AMCREST_PROBE_STORAGE` (optional, default = true) - `AMCREST_POLL_STORAGE` (optional, default = true)
- `MQTT_USERNAME` (required) - `MQTT_USERNAME` (required)
- `MQTT_PASSWORD` (optional, default = empty password) - `MQTT_PASSWORD` (optional, default = empty password)
- `MQTT_HOST` (optional, default = 'localhost') - `MQTT_HOST` (optional, default = 'localhost')

@ -17,7 +17,7 @@ amcrest_host = os.getenv("AMCREST_HOST")
amcrest_port = int(os.getenv("AMCREST_PORT") or 80) amcrest_port = int(os.getenv("AMCREST_PORT") or 80)
amcrest_username = os.getenv("AMCREST_USERNAME") or "admin" amcrest_username = os.getenv("AMCREST_USERNAME") or "admin"
amcrest_password = os.getenv("AMCREST_PASSWORD") 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_host = os.getenv("MQTT_HOST") or "localhost"
mqtt_qos = int(os.getenv("MQTT_QOS") or 0) mqtt_qos = int(os.getenv("MQTT_QOS") or 0)
@ -240,7 +240,7 @@ if home_assistant:
json=True, json=True,
) )
if amcrest_probe_storage: if amcrest_poll_storage:
mqtt_publish( mqtt_publish(
topics["home_assistant"]["storage_used_percent"], topics["home_assistant"]["storage_used_percent"],
base_config base_config
@ -290,7 +290,7 @@ mqtt_publish(topics["config"], {
"serial_number": serial_number, "serial_number": serial_number,
}, json=True) }, json=True)
if amcrest_probe_storage: if amcrest_poll_storage:
refresh_storage_sensors() refresh_storage_sensors()
log("Listening for events...") log("Listening for events...")

Loading…
Cancel
Save