Commit Graph

117 Commits

Author SHA1 Message Date
Tomer c6ca472ca1 fix: Improve performance when logging is disabled (#23893)
* Improve log performance

* Bug fix

* Revert sample configuration

* Align package versions

* Revert dependecies version to allow testing

* Update package-lock.json

* Fix prettier issue

* Coverage to 100%

* Fix CR comments

* remove uneeded changes

* Make the same perf optimization to the MQTT messages

* Fix MQTT tests

* prettier fix

* Allow easy mocking of stub logger callTransports function to receive the actual message

* cleanup leftover

* Fix prettier issues

* Finalize logger mock structure and add few lambda log calls

* fix prettier issue

* Run prettier

* Revert "fix prettier issue"

This reverts commit b409d538e3.

* Update zigbee.ts

Fix prettier issue

* Fix test issues

* Revert await removal
2024-09-12 20:33:05 +02:00
Nerivec 48d77e4b5e fix: Enforce TS strict type checking (#23601)
* Enforce TS `strict` type checking.

* updates

* updates

* updates

* Updates

* Updates

* pretty

* u

* u

* u

* Updates

* updates

* Updates

* Updates

* `ReadonlyArray`

* scenesChanged

* objectID

* Improve coverage

* u

* u

* process feedback

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-09-07 11:40:50 +00:00
Koen Kanters efd3d3dfb0 fix: Set zigbee-herdsman transmit power through settings on startup (#23566)
* fix: Set zigbee-herdsman transmit power through settings on startup

* use advanced
2024-08-09 12:33:59 +00:00
Nerivec 13ac8a0f53 fix: Improve looping performance (#23541)
* Use herdsman improved looping.

* Fix lint.

* Fix tests.

* Feedback
2024-08-08 20:21:40 +02:00
Koen Kanters bd7dec0f11 fix(ignore): update dependencies (#23508)
* fix(ignore): update dependencies

* update

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-08-05 21:08:40 +00:00
Koen Kanters 30227a13ae chore: Implement prettier (#23153)
* chore: Implement prettier

* Run prettier

* fix lint

* process feedback

* process feedback
2024-06-24 18:58:47 +00:00
Nerivec 9c2264e86e fix: MQTT code optimization/formatting (#23072)
* MQTT code optimization/formatting

* Feedback.

* Move `onConnect` logic inside `connect` event.
2024-06-18 13:59:07 +02:00
ghoz eff341bd14 fix: Differentiate the MQTT publish/ received from regular MQTT logs (#23026)
* Differentiate the spammy "MQTT publish"/"received MQTT message" from regular logs

Rather than creating subnamespaces, keep the z2m:mqtt logger namespace only for those 2 , move back to z2m default for the rest.

* fix tests
2024-06-12 21:01:16 +02:00
Laurent Chardin d484405cf0 fix: Expose custom clusters to MQTT (#22583)
* (feat) Expose Custom Clusters in MQTT

- Introducing bridge/definitions
- Updating test case for custom clusters
- Updating new path after ZCL revamp with 0.47.0

This change is needed for nurikk/zigbee2mqtt-frontend#2001

* Fixing test case

* Update lib/model/device.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>

* Update test/bridge.test.js

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>

* Removing the publishDefinition call from some events. updating tests

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-05-21 19:54:18 +02:00
Nerivec 2eec6a4d26 fix: Add namespace-specific levels support to logger (#22619)
* Add namespaced levels for logger. Add NS to mqtt. Deprecate 'warn'.

* Improve setting validation.

* Fix setting through frontend

* Support reload + frontend improvements

* update description

* remove requiresRestart

* Fix tests.

* Fix namespaced logging at lower levels. Add better tests.

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-05-19 15:47:40 +02:00
Koen Kanters bbb6f9e042 fix: Change MQTT publish log to debug (#22063) 2024-04-03 18:13:46 +00:00
Nerivec 73566dff98 feat: Unified logging across z2m/zh/zhc (#21984)
* Unified logging across z2m/zh/zhc

* Updates

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-04-02 22:33:51 +02:00
Koen Kanters 62844ff637 Update zigbee-herdsman-converters to 19.12.1 (#22044)
* fix(ignore): update zigbee-herdsman-converters to 19.12.1

* fix tests

---------

Co-authored-by: Koenkk <2892853+Koenkk@users.noreply.github.com>
2024-04-02 20:17:43 +00:00
chrthi 97eac16aaf fix: Notify systemd for start, stop, watchdog (#20482)
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-01-21 21:49:17 +01:00
koenkk 212c70913c fix: Prevent extension errors from crashing Zigbee2MQTT https://github.com/Koenkk/zigbee2mqtt/issues/20477 2024-01-06 10:19:56 +01:00
Koen Kanters 56f57625b0 feat: Support automatically generating device definitions (#20358)
* feat: Support automatically generating device definitions

* updates

* update template
2023-12-25 12:46:57 +01:00
Koen Kanters aa021d988d feat: Support generating extended_pan_id (#18596)
* feat: Support generating extended_pan_id

* Update configuration.example.yaml
2023-08-12 15:07:30 +02:00
koenkk b55cc0a037 fix(ignore): chore: Update dependencies (#18459) 2023-08-09 20:04:20 +02:00
koenkk b09b8ec3d6 fix(ignore): Revert "chore: Update dependencies (#18459)"
This reverts commit 53cb42103c.
2023-08-09 07:33:27 +02:00
Koen Kanters 53cb42103c chore: Update dependencies (#18459)
* fix(ignore): update dependencies

* Make compatible with MQTT 5

* updates

---------

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
2023-08-08 20:04:22 +02:00
Koen Kanters a7e02a7be8 fix(ignore): Better fix for #17891 (#17951)
* fix(ignore): Better fix for #17891

* remove onlythis
2023-06-08 09:04:14 +02:00
Sean Kelly c12bedb3e5 fix: Fix HA entities unavailable after broker restart when broker does not persist retained messages (#17891)
* Fix race condition with bridge status message cancelling reinitialize after a reconnect to mqtt

* Fix tests
2023-06-07 09:16:11 +02:00
Koen Kanters 0605a5e0e3 Attempt to improve Log when MQTT client is unavailable stability 2023-01-12 09:41:30 +01:00
Matt 19bd87de4a Keep cached device state until Zigbee2MQTT is stopped (#15770)
* Fix extension path to make debugginge easier in VScode

* Fix linting error

* Add setting "cache_state_persist_on_leave" (default false)

This setting does not remove a device from State if it leaves the network

* Merge from upstream kk/dev

* Re-define cache_state_persist_on_leave to be a timeout

Allows the config to specify how long the state should be held (and the device to re-join & maintain the state).

Remove all pending deletions if the system is stopped

* Add debug. Fix "time" test

* Disable esline warnings for long debug lines

* Simplify state maintenance for leave/join devices

* Restore default configuration.yaml

* Don't track device presence via events, but examine herdsman on system stop

* Update configuration.yaml

* Update state.ts

* Update state.ts

* Update controller.test.js

* Update eventBus.ts

* Update eventBus.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-12-31 10:15:11 +01:00
Koen Kanters 125ca61812 Log MQTT disconnect reason. #13965 2022-09-12 09:34:20 +02:00
Koen Kanters 281e3870d3 Fix tests 2022-08-11 20:32:01 +02:00
Koen Kanters 343ef7fd9f Only republish retained messages when none are received. #9629 2022-07-25 19:37:33 +02:00
Koen Kanters 316daee49d Republish retained messages when reconnected to MQTT server. #9629 2022-07-24 22:17:29 +02:00
Jorge Schrauwen a0255d0f2c Always treat filtered_* as full matches (#13083)
* Revert "update tests to use regex ^$ anchors"

This reverts commit 3d9bc552e9.

* utils: filterProperties should ensure full match
2022-07-11 17:24:34 +02:00
Jorge Schrauwen db021e6711 Allow regexes for filtered_attributes, filtered_cache and filtered_optimistic options (#13047)
* Ensure filtered_attributes and filtered_optimistic are also regex

Bring filtered_attributes and filtered_optimistic in line with the newer filtered_cache.
All three of them are now regex matches instead of absolute matches.

* update tests to use regex ^$ anchors

* utils: add filterProperties
2022-07-06 17:07:22 +02:00
Jorge Schrauwen dedbf336af Add filtered_cache option (#12988)
* want a way to prevent attribute from being cached

* Update filtered_cache description to be more clear

* Fix emitStateChange was returning wrong payload in to parameter

* Directly get filtered_cache from entity and forgo parameter to State.set()

* Add tests to cover filtered_cache

* Update state.ts

* Update controller.test.js

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-07-02 20:33:04 +02:00
Koen Kanters 8e2f0f613f Send cached group state on startup and when Home Assistant comes online. https://github.com/Koenkk/zigbee2mqtt/issues/12693 2022-06-09 20:52:39 +02:00
Koen Kanters 68035a1256 Fix restart not working (#12629) 2022-05-29 08:15:47 +00:00
John Doe 84bac2b8d8 Add compatibility tests (#12527)
* Add tests gh action

* Fix zigbee_ota_override_index_location

* Fix Shouldnt crash when it cannot save state test

* Add node17

* Update tests.yml

* Drop old versions

* Move to ci.yml

* Update controller.test.js

* Fix linebraks on windows

* Ignore windows and node 17

* Fail on error

* Add comment

* Mark node 18 as supported

Co-authored-by: nurikk <ainur@yojee.com>
2022-05-21 08:37:39 +02:00
Koen Kanters 30177b0db4 Restructure settings (#10437)
* -

* deep copy schema

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -
2022-01-09 22:28:44 +01:00
Koen Kanters cd4ac0c174 Ignore messages from coordinator. https://github.com/Koenkk/zigbee2mqtt/issues/9218 2021-11-28 20:08:09 +01:00
Koen Kanters 0a7a477281 Send only 1 MQTT message when last_seen is enabled and Zigbee message is received. https://github.com/Koenkk/zigbee2mqtt/issues/9519 2021-11-27 09:31:31 +01:00
Koen Kanters 7e2a2bdd34 Remove led control (#9404) 2021-11-14 15:04:23 +00:00
Koen Kanters f7c0b46bef Catch exception when removing device via pass/blocklist. https://github.com/Koenkk/zigbee2mqtt/issues/9116 2021-10-14 22:18:37 +02:00
Koen Kanters 23b87755cf Stop Zigbee2MQTT with error when initial MQTT connect fails. https://github.com/Koenkk/zigbee2mqtt/issues/8956 2021-10-04 22:08:06 +02:00
Koen Kanters ab3a9da630 Revert "Improve MQTT error handling. https://github.com/Koenkk/zigbee2mqtt/issues/8956"
This reverts commit 45a4978ca8.
2021-10-04 20:51:09 +02:00
Koen Kanters 45a4978ca8 Improve MQTT error handling. https://github.com/Koenkk/zigbee2mqtt/issues/8956 2021-10-03 12:29:54 +02:00
Koen Kanters c28731957a Fix last seen not published when changed. https://github.com/Koenkk/zigbee2mqtt/issues/7423 2021-10-02 10:49:47 +02:00
Koen Kanters 045ee573a0 Final TypeScript refactor (#8859)
* Update

* Updates

* More refactoringzzz

* Bindoo

* Loadz of typescripting

* Logga

* Updates

* Updates

* Updates

* Updates

* cleanup

* updates

* Fix coverage

* Fixes

* Updates

* Updates
2021-10-02 10:09:38 +02:00
Koen Kanters 4125ae0888 TypeScript refactoring (#8567)
* Updates

* Updates

* Updates

* Rename

* Updates

* updates

* Updates

* Updates
2021-09-01 20:39:17 +02:00
Koen Kanters a76c13c461 Make tests compatible with Jest 27 2021-07-05 20:46:53 +02:00
Franck Nijhof 000884b080 Deprecate Home Assistant entity attributes (#7683)
* Deprecate Home Assistant entity attributes

* Adjust test to match latest dev

* Set default only for new installations

* Fix tests
2021-06-08 15:33:14 +02:00
Koen Kanters 0401a13d5d Disable legacy options on new network start. 2021-06-07 09:46:10 +02:00
Koen Kanters 723121d671 Fix tests 2021-05-08 15:52:14 +02:00
Koen Kanters 00c2894bb4 Reread settings on restart. https://github.com/Koenkk/zigbee2mqtt/discussions/6628 2021-03-09 19:50:05 +01:00