* OTA privacy enhancement
Adds the option to disallow device-initiated OTA update checks.
Currently these OTA update checks can be quite frequent, and essentially mean the device is indirectly able to ping a cloud server. In the EU it's wise to handle an IP address as personal information, and therefore it might be wise to not enable OTA checking by default. Ideally a user would agree to a privacy policy that clarifies things a bit first.
* Added default settings for OTA update management
* Set update interval in minutes
* OTA update settings
* Adds both settings for OTA updates control
* Update settings.schema.json
* Update settings.js
* Update otaUpdate.js
* Update otaUpdate.test.js
* Update bridge.test.js
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* Do not fallback to string if array can be parsed
This in needed, otherwise ZIGBEE2MQTT_CONFIG_ADVANCED_NETWORK_KEY can never be set to a JSON object (array).
* Update settings.js
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* support configurable retain on mqtt settings since some servers throw errors and drop the connections if you try (e.g. aws iot)
* Revert "support configurable retain on mqtt settings since some servers throw errors and drop the connections if you try (e.g. aws iot)"
This reverts commit 40d3a9c0bc84c83d2b167e2e3c3a06ca6df80f47.
* support configurable retain on mqtt settings
* support subscribing to the whole base prefix
* Update mqtt.js
* Fixes
* Fixes
* Fix tests
* Updates
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* Add Environment Variable Override
I need to be able to manage settings on this service via Environment Variables. I've added the ability to override anything in the settings schema with a corresponding environment variable.
e.g. to override settings.serial.port you can set ZIGBEE2MQTT_SERIAL_PORT=/dev/ttyS0
to override the mqtt username you can set ZIGBEE2MQTT_MQTT_USER=testusername
This new addition will not perform any action on existing installations unless the matching environment variable is set. I have tested this setting string, number, boolean, object and array values.
* Adding test case for environment variables and slight modification to ensure 100% code coverage.
* Adding a test to confirm that env variables will set non default values. Also realized that I was errantly applying the env variables to the defaults for testing. Understanding what this is doing more clearly I realize that should be clean.
* Refactoring to
1. Remove the test variables from the schema and defaults and manually reflect the tests in the test.
2. Rename environment variable base from ZIGBEE2MQTT_ to ZIGBEE2MQTT_CONFIG_
* Small improvements
* Removing the unneeded test.
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* Add support for expiring retained messages.
For most of my environmental monitoring use cases, I want the readings
retained so I can pick them up from clients at any time, but if the
sensor (or zigbee2mqtt) fails, I want the readings to go away so I can
tell the difference between a stale reading and a missing reading.
This is easily accomplished in MQTTv5 using the "message expiry
interval" property. To add that to zigbee2mqtt, I added a 'version'
option to the mqtt section so I can specify to connect with version 5
and added a 'retention' property to devices allowing me to specify how
long items should be retained.
e.g.
mqtt:
base_topic: site/zigbee2mqtt
server: 'mqtt://myserver'
user: zigbee
version: 5
serial:
port: /dev/ttyACM0
devices:
'0x00358d00022308da':
friendly_name: someroom
retain: true
retention: 900
* Also get from deviceOptions
* Update settings.js
* Update controller.js
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* Allow filtering of attributes in mqtt json payload or published attributes
* Add test for mqtt_attribute_filter
Just doing attribute_and_json should be fine as the code changes are run before this. Doing this tests lets us varify both json or seperate topic get properly filtered.
* Add test for mqtt_attribute_filter on group
* Rename mqtt_attribute_filter to filtered_attributes
* Added log_file name setting
Added log_file to schema while preserving the default log.txt setting.
Added option to logger to use the filename and support for the %timestamp% var.
* Update logger.js
Added the filename to the console/log output.