Commit Graph

52 Commits

Author SHA1 Message Date
Nerivec 1a9c79bb2f feat: Typing for MQTT API (#25098) 2024-12-07 20:21:30 +00:00
Koen Kanters 51f364a1d5 fix(ignore): Fix external converter loading (#25063) 2024-12-05 19:58:55 +01:00
Koen Kanters 9bd20afb9c fix(ignore): Update usb discovery discussion link 2024-12-01 20:54:46 +01:00
Nerivec 9907005256 feat: Live loading of external JS (converters/extensions) (#24764)
* feat: Live loading of external JS (converters/extensions)

* Fix imports

* Improve error message on MQTT save

* Handle non-existing base path

* Throw on bad converter

* Add tests

* Fix use of ext conv in network map tests.

* More coverage.

* Dont mock zhc for basics, tests actual live loading

* Update

* feat: Live loading of external JS (converters/extensions)

* Fix imports

* Improve error message on MQTT save

* Handle non-existing base path

* Throw on bad converter

* Add tests

* Fix use of ext conv in network map tests.

* More coverage.

* Dont mock zhc for basics, tests actual live loading

* Update

* Fix rebase

* Fix

* Bump zhc

* pretty

* fix typing

* Cleanup `external_converters` setting remnants.

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-12-01 20:11:34 +01:00
Nerivec e052988663 fix: Use built-in async for mqtt (#24786)
* fix: Use async for mqtt.

* Update mocks, fix expects

* Prettier.

* Use appropriate error for publish

* Set max listeners immediately after connect

* Add mqtt v5+ `disconnect` event handler

* Set maximum packet size in `CONNECT` packet

* Fix tests.

* Add setting for maximum packet size.

* Add `reasonString` to disconnect logs

* Fix tests

* Fix

* Prettier
2024-12-01 20:11:34 +01:00
Nerivec 6f6e7c3ee0 fix: Refactor tests to TS (#24357) 2024-12-01 20:09:27 +01:00
Nerivec 2124d3450c fix!: Improve permit join (#24257)
* fix: Improve permit join

* Update Home Assistant permit join switch

* Remove `permit_join` from `settings.schema.json`

* Update zigbee-herdsman version to pre-release.

* Fix pnpm overrides

* Update test/homeassistant.test.js

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2024-12-01 20:07:06 +01:00
Koen Kanters b6186623f0 feat!: The big cleanup (#24200)
* Remove `deviceGroupMembership`

* Fix controller.ts

* Remove `legacy_api` logic from non-legacy extensions.

* Fix network map coverage.

* Remove all `legacy` extensions.

* Remove `legacy_availability_payload`, `legacy_api`. Remove legacy from configure.

* Fix prettier.

* Remove some leftovers

* Renamed `updateAvailable` to `update_available`

* Remove emitPublishAvailability

* Remove `configuration.yaml`

* Switch to pnpm

* Remove direct mqtt-packet dependency.

* fix pretty

* fix `getDependencyVersion`

* fix pnpm publish

* fix(ignore): fix pnpm publish

* Remove deprecated bridge `config/*`

* Improve update script

* Improve update.sh

---------

Co-authored-by: Nerivec <62446222+Nerivec@users.noreply.github.com>
2024-12-01 20:06:49 +01:00
Koen Kanters 98b977030e fix(ignore): Changes for improved adapter discovery (#24147)
* fix: Comment serial config in example configuration

* Link to issue

* Update link

* Update example config

* Feedback
2024-12-01 20:06:37 +01:00
Koen Kanters e642f7c86a fix(ignore): Sync eslint settings from zhc (#23951)
* fix(ignore): Sync eslint settings from zhc

* u
2024-09-12 19:36:57 +00:00
Koen Kanters afd80449b3 fix(ignore): Migrate to eslint 9 (#23800)
* Eslint 9

* Automatic changes

* Manual changes

* Process feedback

* u
2024-09-08 14:26:18 +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
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 282dfd5b01 fix: Fix floating promises originating from index.js (#22943) 2024-06-05 20:19:53 +02:00
Nerivec 2b8eaa196a fix: Enforce no floating promises (#22880)
* Enforce no floating promises.

* forEach => for/of. Fix tests.
2024-06-04 20:05:39 +02:00
Koen Kanters 04e88baf60 fix: Fix custom cluster not available in frontend https://github.com/Koenkk/zigbee2mqtt/issues/22425 2024-05-10 22:15:38 +02:00
Nerivec d26ccaed65 fix: Fix logger crashing on restart (#22565) 2024-05-09 21:42:28 +02:00
Nerivec 3c1a4afcb7 fix: Convert logger into a class (#22129) 2024-04-07 20:52:55 +02: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
koenkk f83709d96c fix(ignore): set zhc logger 2024-02-03 12:27:04 +01: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 0bc685a8e3 Sanatize manufacturerName. https://github.com/home-assistant/core/issues/85691 2023-01-24 17:19:56 +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 b68b984de6 Log Zigbee2MQTT started! on startup. https://github.com/Koenkk/zigbee2mqtt/issues/14283 2022-11-10 17:45:48 +01:00
Matt 4d7b1a6c03 Allow Zigbee2MQTT to be installed as a module (#14396)
* Fix mnodule resolution

Allows the correct module path to be found if installed as a package

* Correct signature to avoid TS error

* Allow module to be included in another module

Only create hash ot auto-start if it is the main module, otherwise export the `start` function
2022-10-08 10:48:15 +02:00
Koen Kanters 125ca61812 Log MQTT disconnect reason. #13965 2022-09-12 09:34:20 +02:00
Koen Kanters 420b34c909 Fix group and device states changing when cached states are published. https://github.com/Koenkk/zigbee2mqtt/issues/13028 2022-07-12 17:01:29 +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
Koen Kanters 41ece365aa Allow to configure availablility payloads to be a JSON object. #10802 2022-02-02 19:28:44 +01:00
Joshua Spence 1a70b80282 Flush logger before exiting process (#10905)
* Wait for async logs

* Fix tests

* Better solution

Based on https://stackoverflow.com/a/59260151

* Fix lint/test coverage

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
2022-01-26 15:57:51 +00:00
Koen Kanters 30177b0db4 Restructure settings (#10437)
* -

* deep copy schema

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -
2022-01-09 22:28:44 +01:00
Koen Kanters 22836f224d Fix filtered attributes being published as null. #10099 2021-12-09 19:52:21 +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 cc03be46df Fix properties missing when debounce is used under some conditions #9658 (#9682)
* Add logging

* Kill bugs

* Updates
2021-11-17 17:59:00 +00:00
Koen Kanters 89af770d96 Fix external extensions not started. https://github.com/Koenkk/zigbee2mqtt/issues/9520 2021-11-05 20:24:09 +01:00
Koen Kanters 62bf76c11f Fix site links 2021-11-01 18:12:27 +01:00
Koen Kanters 549ccf036e Fix start being called twice for external extensions. https://github.com/Koenkk/zigbee2mqtt/issues/9165 2021-10-17 18:19:13 +02:00
Koen Kanters 8fac172ced Fix crash when event listener throws exception. https://github.com/Koenkk/zigbee2mqtt/commit/749381bf2f6fdb8788d5f5f7857ae75e5f73303a 2021-10-13 21:57:04 +02:00
Koen Kanters a774b43d63 Fix Home Assistant template variable warnings (#9088)
* Fix more template warnings. https://github.com/Koenkk/zigbee2mqtt/issues/8769

* Update

* Updates
2021-10-09 19:41:00 +02:00
Koen Kanters 6f9371e4b0 Fix incorrect state when last_seen and debounce is enabled. https://github.com/Koenkk/zigbee2mqtt/issues/8958 https://github.com/Koenkk/zigbee2mqtt/issues/9010 2021-10-07 20:36:42 +02:00
Koen Kanters 42497f3176 Fix some todos 2021-10-06 21:27:23 +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 c28731957a Fix last seen not published when changed. https://github.com/Koenkk/zigbee2mqtt/issues/7423 2021-10-02 10:49:47 +02:00