mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-29 15:18:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea39d86e6b | ||
|
|
06fd8a4eb1 | ||
|
|
d26ccaed65 | ||
|
|
989f667c81 | ||
|
|
cce41c20fb | ||
|
|
350c682e8f | ||
|
|
6bcb4b66b1 | ||
|
|
58d37b0f92 | ||
|
|
aecdfe638b | ||
|
|
cc9a95c74e | ||
|
|
834626d2e9 | ||
|
|
6b886f6268 | ||
|
|
a0c9a1769f | ||
|
|
3544d5172e | ||
|
|
e44608a46d | ||
|
|
6a69c16170 | ||
|
|
b2e8b3e00c | ||
|
|
358e2eee45 | ||
|
|
316654b5d3 | ||
|
|
eb49f523bf | ||
|
|
b754b9d463 | ||
|
|
e4c9bac348 | ||
|
|
beedfaefac | ||
|
|
329d832337 | ||
|
|
23e97d0001 | ||
|
|
3a61f0acfa | ||
|
|
5899436d74 | ||
|
|
97d5c5c97a | ||
|
|
ee5cf5a901 | ||
|
|
907591c467 | ||
|
|
55b5f91a96 | ||
|
|
ce915a6797 |
@@ -0,0 +1,31 @@
|
||||
name: Release Charts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'charts/**'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
|
||||
- name: Run chart-releaser
|
||||
uses: helm/chart-releaser-action@v1.6.0
|
||||
with:
|
||||
skip_existing: true
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -26,6 +26,41 @@ jobs:
|
||||
target-branch: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
|
||||
# we use grep,awk,sed here because the output from release-please despite being JSON, it's not valid (probably shell-escaping) and
|
||||
# jq fails to parse it. Creates the output pr_branch
|
||||
- name: Get the branch of the release-please PR
|
||||
id: get_pr_branch
|
||||
if: ${{ steps.release.outputs.prs_created == 'true' }}
|
||||
run: |
|
||||
BRANCH=$(echo '${{ steps.release.outputs.prs }}' | grep -o -P '\"headBranchName\":\"(.*?)\"' | awk -F':' '{print $2}' | tr -d \")
|
||||
echo "pr_branch=${BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
# Checkout PR branch
|
||||
- uses: actions/checkout@v4
|
||||
if: ${{ steps.release.outputs.prs_created == 'true' }}
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m-pr
|
||||
ref: ${{ steps.get_pr_branch.outputs.pr_branch }}
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
|
||||
- name: Add updated helm chart release versions and documentation to release PR
|
||||
if: ${{ steps.release.outputs.prs_created == 'true' }}
|
||||
run: |
|
||||
pushd ./z2m-pr
|
||||
Z2M_VERSION="$(jq -r '."."' .release-please-manifest.json)"
|
||||
yq -i ".appVersion=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/Chart.yaml
|
||||
yq -i ".image.tag=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/values.yaml
|
||||
# Keep chart version in step lock with zigbee2mqtt
|
||||
jq ".\"charts/zigbee2mqtt\"=\"${Z2M_VERSION}\"" .release-please-manifest.json > .release-please-manifest.json.tmp
|
||||
mv .release-please-manifest.json.tmp .release-please-manifest.json
|
||||
go run github.com/norwoodj/helm-docs/cmd/helm-docs@latest
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add .
|
||||
git commit -m "chore(release): update helm-chart docs"
|
||||
git push
|
||||
|
||||
# Checkout repos
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -50,7 +85,7 @@ jobs:
|
||||
MASTER_ZHC_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman-converters"')
|
||||
MASTER_ZH_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman"')
|
||||
MASTER_FRONTEND_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee2mqtt-frontend"')
|
||||
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev--components--zigbee2mqtt/CHANGELOG.md > z2m/CHANGELOG.md
|
||||
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev/CHANGELOG.md > z2m/CHANGELOG.md
|
||||
cd z2m
|
||||
npm ci
|
||||
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION $MASTER_FRONTEND_VERSION >> ../changelog.md
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
".": "1.37.0"
|
||||
}
|
||||
".": "1.37.1",
|
||||
"charts/zigbee2mqtt": "1.37.1"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## [1.37.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.37.0...1.37.1) (2024-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add Helm chart ([#21852](https://github.com/Koenkk/zigbee2mqtt/issues/21852)) ([b2e8b3e](https://github.com/Koenkk/zigbee2mqtt/commit/b2e8b3e00c152540109e7b9101784f3b03261b40))
|
||||
* Add settings for finer control over debug log level ([#22426](https://github.com/Koenkk/zigbee2mqtt/issues/22426)) ([eb49f52](https://github.com/Koenkk/zigbee2mqtt/commit/eb49f523bf3a0c085655cfae7aac97d7da749db9))
|
||||
* Fix logger crashing on restart ([#22565](https://github.com/Koenkk/zigbee2mqtt/issues/22565)) ([d26ccae](https://github.com/Koenkk/zigbee2mqtt/commit/d26ccaed65b922b00f1a7599941289ead4b7fb31))
|
||||
* Fix MQTT `ECONNREFUSED error` https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/605 ([a0c9a17](https://github.com/Koenkk/zigbee2mqtt/commit/a0c9a1769f7e25673672e3a312b2e4bd3812ff32))
|
||||
* **ignore:** update dependencies ([#22456](https://github.com/Koenkk/zigbee2mqtt/issues/22456)) ([b754b9d](https://github.com/Koenkk/zigbee2mqtt/commit/b754b9d4635ef3300893acba51eadae4e41039a3))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.0 ([#22380](https://github.com/Koenkk/zigbee2mqtt/issues/22380)) ([55b5f91](https://github.com/Koenkk/zigbee2mqtt/commit/55b5f91a96f589fd0e3da5f4800dad32dbd57cf7))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.1 ([#22439](https://github.com/Koenkk/zigbee2mqtt/issues/22439)) ([329d832](https://github.com/Koenkk/zigbee2mqtt/commit/329d832337cda15b324c46a2adf6a24c5d38a8bd))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.2 ([#22470](https://github.com/Koenkk/zigbee2mqtt/issues/22470)) ([e4c9bac](https://github.com/Koenkk/zigbee2mqtt/commit/e4c9bac348680f5571cef0b79407fb9459757a36))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.3 ([#22471](https://github.com/Koenkk/zigbee2mqtt/issues/22471)) ([316654b](https://github.com/Koenkk/zigbee2mqtt/commit/316654b5d3acc6452e888d0e48a77908c431e783))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.4 ([#22501](https://github.com/Koenkk/zigbee2mqtt/issues/22501)) ([e44608a](https://github.com/Koenkk/zigbee2mqtt/commit/e44608a46dfe3baab1f82dd430f66afe0ac09c4f))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.5 ([#22552](https://github.com/Koenkk/zigbee2mqtt/issues/22552)) ([6bcb4b6](https://github.com/Koenkk/zigbee2mqtt/commit/6bcb4b66b1a69f19b49a3b9a4c9be32e8f1df4e4))
|
||||
* **ignore:** update zigbee-herdsman to 0.46.6 ([#22558](https://github.com/Koenkk/zigbee2mqtt/issues/22558)) ([989f667](https://github.com/Koenkk/zigbee2mqtt/commit/989f667c81e4f2b61edd379382d2c8f77c556e3b))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.33.0 ([#22381](https://github.com/Koenkk/zigbee2mqtt/issues/22381)) ([907591c](https://github.com/Koenkk/zigbee2mqtt/commit/907591c467f926af172427ff641e7b20e5fa309c))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.35.0 ([#22442](https://github.com/Koenkk/zigbee2mqtt/issues/22442)) ([beedfae](https://github.com/Koenkk/zigbee2mqtt/commit/beedfaefacdb53d3c379164dbb4dae5de396d40d))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.36.0 ([#22472](https://github.com/Koenkk/zigbee2mqtt/issues/22472)) ([358e2ee](https://github.com/Koenkk/zigbee2mqtt/commit/358e2eee4551baee58c4d212d9d65562d2e84bd6))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.36.1 ([#22503](https://github.com/Koenkk/zigbee2mqtt/issues/22503)) ([3544d51](https://github.com/Koenkk/zigbee2mqtt/commit/3544d5172e03cdcbd61cde13ebc20c2e5fbeaba5))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.37.0 ([#22531](https://github.com/Koenkk/zigbee2mqtt/issues/22531)) ([6b886f6](https://github.com/Koenkk/zigbee2mqtt/commit/6b886f626863cae8acc2895a7fe2482b068138d6))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.37.1 ([#22549](https://github.com/Koenkk/zigbee2mqtt/issues/22549)) ([cc9a95c](https://github.com/Koenkk/zigbee2mqtt/commit/cc9a95c74e53261636dc7329be2becddf4772fdc))
|
||||
* **ignore:** update zigbee-herdsman-converters to 19.37.2 ([#22570](https://github.com/Koenkk/zigbee2mqtt/issues/22570)) ([06fd8a4](https://github.com/Koenkk/zigbee2mqtt/commit/06fd8a4eb120f03dd9f3a1d59ab7b20a32fe15a9))
|
||||
* **ignore:** update zigbee2mqtt-frontend to 0.6.166 ([#22410](https://github.com/Koenkk/zigbee2mqtt/issues/22410)) ([5899436](https://github.com/Koenkk/zigbee2mqtt/commit/5899436d74cb0c67016758797c2e928f35715d9d))
|
||||
* **ignore:** update zigbee2mqtt-frontend to 0.6.167 ([#22419](https://github.com/Koenkk/zigbee2mqtt/issues/22419)) ([23e97d0](https://github.com/Koenkk/zigbee2mqtt/commit/23e97d0001048269662c6336a8aef6788615934c))
|
||||
|
||||
## [1.37.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.36.1...1.37.0) (2024-05-01)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## [1.37.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.37.0...1.37.1) (2024-05-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add Helm chart ([#21852](https://github.com/Koenkk/zigbee2mqtt/issues/21852)) ([b2e8b3e](https://github.com/Koenkk/zigbee2mqtt/commit/b2e8b3e00c152540109e7b9101784f3b03261b40))
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: v2
|
||||
appVersion: 1.37.1
|
||||
description: Bridges events and allows you to control your Zigbee devices via MQTT
|
||||
name: zigbee2mqtt
|
||||
version: 1.37.1
|
||||
kubeVersion: ">=1.26.0-0"
|
||||
keywords:
|
||||
- zigbee
|
||||
- mqtt
|
||||
- home-assistant
|
||||
home: https://github.com/Koenkk/zigbee2mqtt
|
||||
icon: https://www.zigbee2mqtt.io/logo.png
|
||||
sources:
|
||||
- https://github.com/Koenkk/zigbee2mqtt
|
||||
maintainers:
|
||||
- name: Koen Kanters
|
||||
email: XXXX
|
||||
@@ -0,0 +1,93 @@
|
||||
# zigbee2mqtt
|
||||
|
||||
 
|
||||
|
||||
Bridges events and allows you to control your Zigbee devices via MQTT
|
||||
|
||||
**Homepage:** <https://github.com/Koenkk/zigbee2mqtt>
|
||||
|
||||
## Maintainers
|
||||
|
||||
| Name | Email | Url |
|
||||
| ---- | ------ | --- |
|
||||
| Koen Kanters | <XXXX> | |
|
||||
|
||||
## Source Code
|
||||
|
||||
* <https://github.com/Koenkk/zigbee2mqtt>
|
||||
|
||||
## Requirements
|
||||
|
||||
Kubernetes: `>=1.26.0-0`
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| customLabels | object | `{}` | |
|
||||
| fullnameOverride | string | `nil` | override the name of the objects generated |
|
||||
| image.imagePullSecrets | object | `{}` | Container additional secrets to pull image |
|
||||
| image.pullPolicy | string | `"IfNotPresent"` | Container pull policy |
|
||||
| image.repository | string | `"koenkk/zigbee2mqtt"` | Image repository for the `zigbee2mqtt` container. |
|
||||
| image.tag | string | `"1.37.1"` | Version for the `zigbee2mqtt` container. |
|
||||
| ingress.annotations | object | `{}` | |
|
||||
| ingress.enabled | bool | `false` | When enabled a new Ingress will be created |
|
||||
| ingress.hosts[0] | string | `"yourdomain.com"` | |
|
||||
| ingress.ingressClassName | string | `"contour"` | |
|
||||
| ingress.labels | object | `{}` | |
|
||||
| ingress.path | string | `"/"` | |
|
||||
| ingress.pathType | string | `"Prefix"` | |
|
||||
| ingress.tls[0].hosts[0] | string | `"yourdomain.com"` | |
|
||||
| ingress.tls[0].secretName | string | `"some-tls-secret"` | |
|
||||
| nameOverride | string | `nil` | override the release name |
|
||||
| service.annotations | object | `{}` | annotations for the service created |
|
||||
| service.port | int | `8080` | port in which the service will be listening |
|
||||
| service.type | string | `"LoadBalancer"` | type of Service to be created |
|
||||
| statefulset.dnsPolicy | string | `"ClusterFirst"` | pod dns policy |
|
||||
| statefulset.nodeSelector | object | `{}` | Select specific kube node, this will allow enforcing zigbee2mqtt running only on the node with the USB adapter connected |
|
||||
| statefulset.resources | object | `{"limits":{"cpu":"200m","memory":"600Mi"},"requests":{"cpu":"200m","memory":"600Mi"}}` | CPU/Memory configuration for the pods |
|
||||
| statefulset.storage.enabled | bool | `false` | |
|
||||
| statefulset.storage.existingVolume | string | `""` | |
|
||||
| statefulset.storage.matchExpressions | object | `{}` | |
|
||||
| statefulset.storage.matchLabels | object | `{}` | |
|
||||
| statefulset.storage.size | string | `"1Gi"` | |
|
||||
| statefulset.storage.storageClassName | string | `"freenas-nfs-csi"` | the name for the storage class to be used in the persistent volume claim |
|
||||
| statefulset.tolerations | object | `{}` | Node taint tolerations for the pods |
|
||||
| zigbee2mqtt.advanced.adapter_concurrent | string | `nil` | Optional: configure adapter concurrency (e.g. 2 for CC2531 or 16 for CC26X2R1) (default: null, uses recommended value) |
|
||||
| zigbee2mqtt.advanced.adapter_delay | int | `0` | Optional: Set the adapter delay, only used for Conbee/Raspbee adapters (default 0). In case you are having issues try `200`. For more information see https://github.com/Koenkk/zigbee2mqtt/issues/4884 |
|
||||
| zigbee2mqtt.advanced.cache_state | bool | `true` | Has to be true when integrating via Home Assistant (default: true) |
|
||||
| zigbee2mqtt.advanced.cache_state_persistent | bool | `true` | Optional: persist cached state, only used when cache_state: true (default: true) |
|
||||
| zigbee2mqtt.advanced.cache_state_send_on_startup | bool | `true` | Optional: send cached state on startup, only used when cache_state_persistent: true (default: true) |
|
||||
| zigbee2mqtt.advanced.channel | int | `11` | Optional: ZigBee channel, changing requires re-pairing of all devices. (Note: use a ZLL channel: 11, 15, 20, or 25 to avoid Problems) (default: 11) |
|
||||
| zigbee2mqtt.advanced.elapsed | bool | `false` | Optional: Add an elapsed attribute to MQTT messages, contains milliseconds since the previous msg (default: false) |
|
||||
| zigbee2mqtt.advanced.last_seen | string | `"disable"` | Optional: Add a last_seen attribute to MQTT messages, contains date/time of last Zigbee message possible values are: disable (default), ISO_8601, ISO_8601_local, epoch (default: disable) |
|
||||
| zigbee2mqtt.advanced.legacy_api | bool | `false` | Optional: disables the legacy api (default: shown below) |
|
||||
| zigbee2mqtt.advanced.log_level | string | `"info"` | |
|
||||
| zigbee2mqtt.advanced.log_output | list | `["console"]` | Optional: network encryption key GENERATE will make Zigbee2MQTT generate a new network key on next startup Note: changing requires repairing of all devices (default: shown below) network_key: null |
|
||||
| zigbee2mqtt.advanced.report | bool | `true` | Optional: Enables report feature, this feature is DEPRECATED since reporting is now setup by default when binding devices. Docs can still be found here: https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/information/report.md |
|
||||
| zigbee2mqtt.advanced.timestamp_format | string | `"YYYY-MM-DD HH:mm:ss"` | |
|
||||
| zigbee2mqtt.advanced.transmit_power | int | `5` | Optional: Transmit power setting in dBm (default: 5). This will set the transmit power for devices that bring an inbuilt amplifier. It can't go over the maximum of the respective hardware and might be limited by firmware (for example to migrate heat, or by using an unsupported firmware). For the CC2652R(B) this is 5 dBm, CC2652P/CC1352P-2 20 dBm. |
|
||||
| zigbee2mqtt.availability.active.timeout | int | `10` | Time after which an active device will be marked as offline in minutes (default = 10 minutes) |
|
||||
| zigbee2mqtt.availability.passive.timeout | int | `1500` | Time after which a passive device will be marked as offline in minutes (default = 1500 minutes aka 25 hours) |
|
||||
| zigbee2mqtt.external_converters | list | `[]` | |
|
||||
| zigbee2mqtt.frontend.auth_token | string | `nil` | Optional, enables authentication, disabled by default, cleartext (no hashing required) |
|
||||
| zigbee2mqtt.frontend.host | string | `"0.0.0.0"` | Optional, empty by default to listen on both IPv4 and IPv6. Opens a unix socket when given a path instead of an address (e.g. '/run/zigbee2mqtt/zigbee2mqtt.sock') Don't set this if you use Docker or the Home Assistant add-on unless you're sure the chosen IP is available inside the container |
|
||||
| zigbee2mqtt.frontend.port | int | `8080` | Mandatory, default 8080 |
|
||||
| zigbee2mqtt.frontend.url | string | `nil` | Optional, url on which the frontend can be reached, currently only used for the Home Assistant device configuration page |
|
||||
| zigbee2mqtt.homeassistant.discovery_topic | string | `"homeassistant"` | |
|
||||
| zigbee2mqtt.homeassistant.enabled | bool | `true` | |
|
||||
| zigbee2mqtt.homeassistant.legacy_entity_attributes | bool | `true` | |
|
||||
| zigbee2mqtt.homeassistant.legacy_triggers | bool | `false` | |
|
||||
| zigbee2mqtt.homeassistant.status_topic | string | `"hass/status"` | |
|
||||
| zigbee2mqtt.mqtt.server | string | `"mqtt://localhost:1883"` | Required: MQTT server URL (use mqtts:// for SSL/TLS connection) |
|
||||
| zigbee2mqtt.ota | object | `{"disable_automatic_update_check":false,"ikea_ota_use_test_url":false,"update_check_interval":1440}` | Optional: OTA update settings See https://www.zigbee2mqtt.io/guide/usage/ota_updates.html for more info |
|
||||
| zigbee2mqtt.ota.disable_automatic_update_check | bool | `false` | Disable automatic update checks |
|
||||
| zigbee2mqtt.ota.ikea_ota_use_test_url | bool | `false` | Optional: use IKEA TRADFRI OTA test server, see OTA updates documentation (default: false) |
|
||||
| zigbee2mqtt.ota.update_check_interval | int | `1440` | Minimum time between OTA update checks |
|
||||
| zigbee2mqtt.permit_join | bool | `false` | Optional: allow new devices to join. |
|
||||
| zigbee2mqtt.serial.baudrate | int | `115200` | Optional: Baud rate speed for serial port, this can be anything firmware support but default is 115200 for Z-Stack and EZSP, 38400 for Deconz, however note that some EZSP firmware need 57600. |
|
||||
| zigbee2mqtt.serial.disable_led | bool | `false` | Optional: disable LED of the adapter if supported (default: false) |
|
||||
| zigbee2mqtt.serial.port | string | `"/dev/ttyACM0"` | Required: location of the adapter (e.g. CC2531). USB adapters - use format "port: /dev/ttyACM0" To autodetect the USB port, set 'port: null'. Ethernet adapters - use format "port: tcp://192.168.1.12:6638" |
|
||||
| zigbee2mqtt.serial.rtscts | bool | `false` | Optional: RTS / CTS Hardware Flow Control for serial port (default: false) |
|
||||
| zigbee2mqtt.timezone | string | `"UTC"` | |
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* Expand the name of the chart.*/}}
|
||||
{{- define "zigbee2mqtt.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "zigbee2mqtt.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/* labels for helm resources */}}
|
||||
{{- define "zigbee2mqtt.labels" -}}
|
||||
app.kubernetes.io/instance: "{{ .Release.Name }}"
|
||||
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
|
||||
app.kubernetes.io/name: "{{ template "zigbee2mqtt.name" . }}"
|
||||
app.kubernetes.io/version: "{{ .Chart.AppVersion }}"
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
{{- if .Values.customLabels }}
|
||||
{{ toYaml .Values.customLabels | indent 2 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,39 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
configuration.yaml: |
|
||||
# Define the files which contains the configs. As k8s config maps
|
||||
# Are read only by design, we need to extract dynamic config to external files
|
||||
devices: devices.yaml
|
||||
groups: groups.yaml
|
||||
{{- if .Values.zigbee2mqtt.homeassistant }}
|
||||
homeassistant:
|
||||
{{- .Values.zigbee2mqtt.homeassistant | toYaml | nindent 6}}
|
||||
{{- end }}
|
||||
ota:
|
||||
{{- .Values.zigbee2mqtt.ota | toYaml | nindent 6}}
|
||||
permit_join: {{ .Values.zigbee2mqtt.permit_join }}
|
||||
{{- if .Values.zigbee2mqtt.availability }}
|
||||
availability:
|
||||
{{- .Values.zigbee2mqtt.availability | toYaml | nindent 6}}
|
||||
{{- end }}
|
||||
{{- if gt (len .Values.zigbee2mqtt.external_converters) 0 }}
|
||||
external_converters: {{- .Values.zigbee2mqtt.external_converters }}
|
||||
{{- end }}
|
||||
mqtt:
|
||||
{{- .Values.zigbee2mqtt.mqtt | toYaml | nindent 6}}
|
||||
serial:
|
||||
{{- .Values.zigbee2mqtt.serial | toYaml | nindent 6}}
|
||||
frontend:
|
||||
{{- .Values.zigbee2mqtt.frontend | toYaml | nindent 6}}
|
||||
advanced:
|
||||
{{- .Values.zigbee2mqtt.advanced | toYaml | nindent 6}}
|
||||
@@ -0,0 +1,56 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $servicePort := .Values.service.port -}}
|
||||
{{- $ingressPath := .Values.ingress.path -}}
|
||||
{{- $ingressPathType := .Values.ingress.pathType -}}
|
||||
{{- $fullName := include "zigbee2mqtt.fullname" . }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ tpl $value $ | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.ingressClassName }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.ingress.hosts }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ tpl . $ | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
pathType: {{ $ingressPathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $servicePort }}
|
||||
{{- with $ingressPath }}
|
||||
path: {{ . }}
|
||||
{{- end }}
|
||||
pathType: {{ $ingressPathType }}
|
||||
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
|
||||
{{- with .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app: {{ include "zigbee2mqtt.fullname" . }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: web
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
kind: StatefulSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ include "zigbee2mqtt.fullname" . }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "zigbee2mqtt.labels" . | nindent 8 }}
|
||||
app: {{ include "zigbee2mqtt.fullname" . }}
|
||||
spec:
|
||||
{{- if .Values.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.image.imagePullSecrets | indent 8 }}
|
||||
{{- end }}
|
||||
dnsPolicy: {{ .Values.statefulset.dnsPolicy }}
|
||||
{{- with .Values.statefulset.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
nodeSelector:
|
||||
{{- with .Values.statefulset.nodeSelector }}
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
{{- with .Values.statefulset.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: zigbee2mqtt
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
securityContext:
|
||||
privileged: true
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: TZ
|
||||
value: {{ .Values.zigbee2mqtt.timezone }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.zigbee2mqtt.frontend.port }}
|
||||
name: web
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
failureThreshold: 5
|
||||
httpGet:
|
||||
path: /
|
||||
port: web
|
||||
initialDelaySeconds: 60
|
||||
timeoutSeconds: 10
|
||||
periodSeconds: 30
|
||||
volumeMounts:
|
||||
- mountPath: /app/data/configuration.yaml
|
||||
name: config-volume
|
||||
subPath: configuration.yaml
|
||||
- mountPath: /app/data/
|
||||
name: data-volume
|
||||
resources: {{- toYaml .Values.statefulset.resources | nindent 12 }}
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}
|
||||
{{- if not .Values.statefulset.storage.enabled }}
|
||||
- name: data-volume
|
||||
emptyDir: { }
|
||||
{{- end }}
|
||||
{{- if .Values.statefulset.storage.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data-volume
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
storageClassName: {{ .Values.statefulset.storage.storageClassName }}
|
||||
{{- if .Values.statefulset.storage.existingVolume }}
|
||||
volumeName: {{ .Values.statefulset.storage.existingVolume }}
|
||||
{{- end }}
|
||||
{{- if or .Values.statefulset.storage.matchLabels (.Values.statefulset.storage.matchExpressions) }}
|
||||
selector:
|
||||
{{- if .Values.statefulset.storage.matchLabels }}
|
||||
matchLabels:
|
||||
{{ toYaml .Values.statefulset.storage.matchLabels | indent 8 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.statefulset.storage.matchExpressions }}
|
||||
matchExpressions:
|
||||
{{ toYaml .Values.statefulset.storage.matchExpressions | indent 8 }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.statefulset.storage.size }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,201 @@
|
||||
# -- override the release name
|
||||
nameOverride: null
|
||||
# -- override the name of the objects generated
|
||||
fullnameOverride: null
|
||||
customLabels: {}
|
||||
image:
|
||||
# -- Image repository for the `zigbee2mqtt` container.
|
||||
repository: koenkk/zigbee2mqtt
|
||||
# -- Version for the `zigbee2mqtt` container.
|
||||
tag: "1.37.1"
|
||||
# -- Container pull policy
|
||||
pullPolicy: IfNotPresent
|
||||
# -- Container additional secrets to pull image
|
||||
imagePullSecrets: {}
|
||||
service:
|
||||
# -- annotations for the service created
|
||||
annotations: {}
|
||||
# -- type of Service to be created
|
||||
type: LoadBalancer
|
||||
# -- port in which the service will be listening
|
||||
port: 8080
|
||||
statefulset:
|
||||
storage:
|
||||
enabled: false
|
||||
size: 1Gi
|
||||
# -- the name for the storage class to be used in the persistent volume claim
|
||||
storageClassName: freenas-nfs-csi
|
||||
existingVolume: ""
|
||||
## Persistent Volume selectors
|
||||
## https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector
|
||||
matchLabels: {}
|
||||
matchExpressions: {}
|
||||
# -- pod dns policy
|
||||
dnsPolicy: ClusterFirst
|
||||
# -- CPU/Memory configuration for the pods
|
||||
resources:
|
||||
requests:
|
||||
memory: 600Mi
|
||||
cpu: 200m
|
||||
limits:
|
||||
memory: 600Mi
|
||||
cpu: 200m
|
||||
# -- Node taint tolerations for the pods
|
||||
tolerations: {}
|
||||
# -- Select specific kube node, this will allow enforcing zigbee2mqtt running
|
||||
# only on the node with the USB adapter connected
|
||||
nodeSelector: {}
|
||||
zigbee2mqtt:
|
||||
homeassistant:
|
||||
enabled: true
|
||||
discovery_topic: 'homeassistant'
|
||||
status_topic: 'hass/status'
|
||||
legacy_entity_attributes: true
|
||||
legacy_triggers: false
|
||||
# -- Optional: allow new devices to join.
|
||||
permit_join: false
|
||||
availability:
|
||||
active:
|
||||
# -- Time after which an active device will be marked as offline in
|
||||
# minutes (default = 10 minutes)
|
||||
timeout: 10
|
||||
passive:
|
||||
# -- Time after which a passive device will be marked as offline in
|
||||
# minutes (default = 1500 minutes aka 25 hours)
|
||||
timeout: 1500
|
||||
timezone: UTC
|
||||
external_converters: []
|
||||
mqtt:
|
||||
# -- Required: MQTT server URL (use mqtts:// for SSL/TLS connection)
|
||||
server: "mqtt://localhost:1883"
|
||||
# -- Optional: MQTT base topic for Zigbee2MQTT MQTT messages (default: zigbee2mqtt)
|
||||
# base_topic: zigbee2mqtt
|
||||
# -- Optional: absolute path to SSL/TLS certificate of CA used to sign server and client certificates (default: nothing)
|
||||
# ca: '/etc/ssl/mqtt-ca.crt'
|
||||
# -- Optional: absolute paths to SSL/TLS key and certificate for client-authentication (default: nothing)
|
||||
# key: '/etc/ssl/mqtt-client.key'
|
||||
# cert: '/etc/ssl/mqtt-client.crt'
|
||||
# -- Optional: MQTT server authentication user (default: nothing)
|
||||
# user: my_user
|
||||
# -- Optional: MQTT server authentication password (default: nothing)
|
||||
# password: my_password
|
||||
# -- Optional: MQTT client ID (default: nothing)
|
||||
# client_id: 'MY_CLIENT_ID'
|
||||
# -- Optional: disable self-signed SSL certificates (default: true)
|
||||
# reject_unauthorized: true
|
||||
# -- Optional: Include device information to mqtt messages (default: false)
|
||||
# include_device_information: true
|
||||
# -- Optional: MQTT keepalive in seconds (default: 60)
|
||||
# keepalive: 60
|
||||
# -- Optional: MQTT protocol version (default: 4), set this to 5 if you
|
||||
# use the 'retention' device specific configuration
|
||||
# version: 4
|
||||
# -- Optional: Disable retain for all send messages. ONLY enable if you MQTT broker doesn't
|
||||
# support retained message (e.g. AWS IoT core, Azure IoT Hub, Google Cloud IoT core, IBM Watson IoT Platform).
|
||||
# Enabling will break the Home Assistant integration. (default: false)
|
||||
# force_disable_retain: false
|
||||
serial:
|
||||
# -- Required: location of the adapter (e.g. CC2531).
|
||||
# USB adapters - use format "port: /dev/ttyACM0"
|
||||
# To autodetect the USB port, set 'port: null'.
|
||||
# Ethernet adapters - use format "port: tcp://192.168.1.12:6638"
|
||||
port: "/dev/ttyACM0"
|
||||
# -- Optional: disable LED of the adapter if supported (default: false)
|
||||
disable_led: false
|
||||
# -- Optional: adapter type, not needed unless you are experiencing problems (default: shown below, options: zstack, deconz, ezsp)
|
||||
# adapter: null
|
||||
# -- Optional: Baud rate speed for serial port, this can be anything firmware support but default is 115200 for Z-Stack and EZSP, 38400 for Deconz, however note that some EZSP firmware need 57600.
|
||||
baudrate: 115200
|
||||
# -- Optional: RTS / CTS Hardware Flow Control for serial port (default: false)
|
||||
rtscts: false
|
||||
# -- Optional: OTA update settings
|
||||
# See https://www.zigbee2mqtt.io/guide/usage/ota_updates.html for more info
|
||||
ota:
|
||||
# -- Optional: use IKEA TRADFRI OTA test server, see OTA updates documentation (default: false)
|
||||
ikea_ota_use_test_url: false
|
||||
# -- Minimum time between OTA update checks
|
||||
update_check_interval: 1440
|
||||
# -- Disable automatic update checks
|
||||
disable_automatic_update_check: false
|
||||
frontend:
|
||||
# -- Mandatory, default 8080
|
||||
port: 8080
|
||||
# -- Optional, empty by default to listen on both IPv4 and IPv6. Opens a unix socket when given a path instead of an address (e.g. '/run/zigbee2mqtt/zigbee2mqtt.sock')
|
||||
# Don't set this if you use Docker or the Home Assistant add-on unless you're sure the chosen IP is available inside the container
|
||||
host: 0.0.0.0
|
||||
# -- Optional, enables authentication, disabled by default, cleartext (no hashing required)
|
||||
auth_token: null
|
||||
# -- Optional, url on which the frontend can be reached, currently only used for the Home Assistant device configuration page
|
||||
url: null
|
||||
advanced:
|
||||
# -- Optional: ZigBee pan ID (default: shown below)
|
||||
# Setting pan_id: GENERATE will make Zigbee2MQTT generate a new panID on next startup
|
||||
# pan_id: null
|
||||
# Optional: Zigbee extended pan ID, GENERATE will make Zigbee2MQTT generate a new extended panID on next startup (default: shown below)
|
||||
# ext_pan_id: null
|
||||
# -- Optional: ZigBee channel, changing requires re-pairing of all devices. (Note: use a ZLL channel: 11, 15, 20, or 25 to avoid Problems)
|
||||
# (default: 11)
|
||||
channel: 11
|
||||
# -- Optional: network encryption key
|
||||
# GENERATE will make Zigbee2MQTT generate a new network key on next startup
|
||||
# Note: changing requires repairing of all devices (default: shown below)
|
||||
# network_key: null
|
||||
log_output:
|
||||
- console
|
||||
log_level: info
|
||||
timestamp_format: 'YYYY-MM-DD HH:mm:ss'
|
||||
# -- Optional: state caching, MQTT message payload will contain all attributes, not only changed ones.
|
||||
# -- Has to be true when integrating via Home Assistant (default: true)
|
||||
cache_state: true
|
||||
# -- Optional: persist cached state, only used when cache_state: true (default: true)
|
||||
cache_state_persistent: true
|
||||
# -- Optional: send cached state on startup, only used when cache_state_persistent: true (default: true)
|
||||
cache_state_send_on_startup: true
|
||||
# -- Optional: Add a last_seen attribute to MQTT messages, contains date/time of last Zigbee message
|
||||
# possible values are: disable (default), ISO_8601, ISO_8601_local, epoch (default: disable)
|
||||
last_seen: 'disable'
|
||||
# -- Optional: Add an elapsed attribute to MQTT messages, contains milliseconds since the previous msg (default: false)
|
||||
elapsed: false
|
||||
# -- Optional: Enables report feature, this feature is DEPRECATED since reporting is now setup by default
|
||||
# when binding devices. Docs can still be found here: https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/information/report.md
|
||||
report: true
|
||||
# -- Optional: disables the legacy api (default: shown below)
|
||||
legacy_api: false
|
||||
# -- Optional: MQTT output type: json, attribute or attribute_and_json (default: shown below)
|
||||
# Examples when 'state' of a device is published
|
||||
# json: topic: 'zigbee2mqtt/my_bulb' payload '{"state": "ON"}'
|
||||
# attribute: topic 'zigbee2mqtt/my_bulb/state' payload 'ON"
|
||||
# attribute_and_json:
|
||||
# -- Optional: configure adapter concurrency (e.g. 2 for CC2531 or 16 for CC26X2R1) (default: null, uses recommended value)
|
||||
adapter_concurrent: null
|
||||
# -- Optional: Transmit power setting in dBm (default: 5).
|
||||
# This will set the transmit power for devices that bring an inbuilt amplifier.
|
||||
# It can't go over the maximum of the respective hardware and might be limited
|
||||
# by firmware (for example to migrate heat, or by using an unsupported firmware).
|
||||
# For the CC2652R(B) this is 5 dBm, CC2652P/CC1352P-2 20 dBm.
|
||||
transmit_power: 5
|
||||
# -- Optional: Set the adapter delay, only used for Conbee/Raspbee adapters (default 0).
|
||||
# In case you are having issues try `200`.
|
||||
# For more information see https://github.com/Koenkk/zigbee2mqtt/issues/4884
|
||||
adapter_delay: 0
|
||||
ingress:
|
||||
# -- When enabled a new Ingress will be created
|
||||
enabled: false
|
||||
# The ingress class name for the ingress
|
||||
ingressClassName: contour
|
||||
# Additional labels for the ingres
|
||||
labels: {}
|
||||
# URL in which the ingress will be accepting requests for zigbee2mqtt
|
||||
path: /
|
||||
# Ingress implementation specific (potentially) for most use cases Prefix should be ok
|
||||
pathType: Prefix
|
||||
# Additional annotations for the ingress. ExternalDNS, and CertManager are tipically integrated here
|
||||
annotations: {}
|
||||
# configuration for tls service (ig any)
|
||||
tls:
|
||||
- secretName: some-tls-secret
|
||||
hosts:
|
||||
- yourdomain.com
|
||||
# list of hosts that should be allowed for the zigbee2mqtt service
|
||||
hosts:
|
||||
- yourdomain.com
|
||||
@@ -60,6 +60,7 @@ export class Controller {
|
||||
private extensionArgs: ExtensionArgs;
|
||||
|
||||
constructor(restartCallback: () => void, exitCallback: (code: number, restart: boolean) => void) {
|
||||
logger.init();
|
||||
zhSetLogger(logger);
|
||||
zhcSetLogger(logger);
|
||||
this.eventBus = new EventBus();
|
||||
|
||||
+18
-18
@@ -4,7 +4,7 @@ import utils from '../util/utils';
|
||||
import Extension from './extension';
|
||||
import stringify from 'json-stable-stringify-without-jsonify';
|
||||
import debounce from 'debounce';
|
||||
import * as zigbeeHerdsman from 'zigbee-herdsman/dist';
|
||||
import {Zcl} from 'zigbee-herdsman';
|
||||
import bind from 'bind-decorator';
|
||||
import Device from '../model/device';
|
||||
import Group from '../model/group';
|
||||
@@ -97,12 +97,12 @@ const pollOnMessage: PollOnMessage = [
|
||||
read: {cluster: 'genLevelCtrl', attributes: ['currentLevel']},
|
||||
// When the bound devices/members of group have the following manufacturerIDs
|
||||
manufacturerIDs: [
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
|
||||
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
Zcl.ManufacturerCode.ATMEL,
|
||||
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
|
||||
],
|
||||
manufacturerNames: [
|
||||
'GLEDOPTO',
|
||||
@@ -133,12 +133,12 @@ const pollOnMessage: PollOnMessage = [
|
||||
},
|
||||
read: {cluster: 'genOnOff', attributes: ['onOff']},
|
||||
manufacturerIDs: [
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
|
||||
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
Zcl.ManufacturerCode.ATMEL,
|
||||
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
Zcl.ManufacturerCode.BUSCH_JAEGER_ELEKTRO,
|
||||
],
|
||||
manufacturerNames: [
|
||||
'GLEDOPTO',
|
||||
@@ -165,11 +165,11 @@ const pollOnMessage: PollOnMessage = [
|
||||
},
|
||||
},
|
||||
manufacturerIDs: [
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
zigbeeHerdsman.Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
Zcl.ManufacturerCode.SIGNIFY_NETHERLANDS_B_V,
|
||||
Zcl.ManufacturerCode.ATMEL,
|
||||
Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
|
||||
Zcl.ManufacturerCode.MUELLER_LICHT_INTERNATIONAL_INC,
|
||||
Zcl.ManufacturerCode.TELINK_MICRO,
|
||||
// Note: ManufacturerCode.BUSCH_JAEGER is left out intentionally here as their devices don't support colors
|
||||
],
|
||||
manufacturerNames: [
|
||||
|
||||
+38
-17
@@ -61,23 +61,40 @@ export default class Bridge extends Extension {
|
||||
'config/log_level': this.configLogLevel,
|
||||
};
|
||||
|
||||
const mqtt = this.mqtt;
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const self = this;
|
||||
class EventTransport extends Transport {
|
||||
log(info: {message: string, level: string}, next: () => void): void {
|
||||
if (info.level !== 'debug') {
|
||||
const payload = stringify({message: info.message, level: info.level});
|
||||
if (payload !== self.lastBridgeLoggingPayload) {
|
||||
self.lastBridgeLoggingPayload = payload;
|
||||
mqtt.publish(`bridge/logging`, payload, {}, settings.get().mqtt.base_topic, true);
|
||||
}
|
||||
}
|
||||
next();
|
||||
const debugToMQTTFrontend = settings.get().advanced.log_debug_to_mqtt_frontend;
|
||||
const baseTopic = settings.get().mqtt.base_topic;
|
||||
|
||||
const bridgeLogging = (message: string, level: string, namespace: string): void => {
|
||||
const payload = stringify({message, level, namespace});
|
||||
|
||||
if (payload !== this.lastBridgeLoggingPayload) {
|
||||
this.lastBridgeLoggingPayload = payload;
|
||||
this.mqtt.publish(`bridge/logging`, payload, {}, baseTopic, true);
|
||||
}
|
||||
};
|
||||
|
||||
if (debugToMQTTFrontend) {
|
||||
class DebugEventTransport extends Transport {
|
||||
log(info: {message: string, level: string, namespace: string}, next: () => void): void {
|
||||
bridgeLogging(info.message, info.level, info.namespace);
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
this.logTransport = new DebugEventTransport();
|
||||
} else {
|
||||
class EventTransport extends Transport {
|
||||
log(info: {message: string, level: string, namespace: string}, next: () => void): void {
|
||||
if (info.level !== 'debug') {
|
||||
bridgeLogging(info.message, info.level, info.namespace);
|
||||
}
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
this.logTransport = new EventTransport();
|
||||
}
|
||||
|
||||
this.logTransport = new EventTransport();
|
||||
logger.addTransport(this.logTransport);
|
||||
|
||||
this.zigbee2mqttVersion = await utils.getZigbee2MQTTVersion();
|
||||
@@ -174,18 +191,22 @@ export default class Bridge extends Extension {
|
||||
if (restartRequired) this.restartRequired = true;
|
||||
|
||||
// Apply some settings on-the-fly.
|
||||
if (newSettings.hasOwnProperty('permit_join')) {
|
||||
if (newSettings.permit_join != undefined) {
|
||||
await this.zigbee.permitJoin(newSettings.permit_join);
|
||||
}
|
||||
|
||||
if (newSettings.hasOwnProperty('homeassistant')) {
|
||||
if (newSettings.homeassistant != undefined) {
|
||||
await this.enableDisableExtension(newSettings.homeassistant, 'HomeAssistant');
|
||||
}
|
||||
|
||||
if (newSettings.hasOwnProperty('advanced') && newSettings.advanced.hasOwnProperty('log_level')) {
|
||||
if (newSettings.advanced?.log_level != undefined) {
|
||||
logger.setLevel(newSettings.advanced.log_level);
|
||||
}
|
||||
|
||||
if (newSettings.advanced?.log_debug_namespace_ignore != undefined) {
|
||||
logger.setDebugNamespaceIgnore(newSettings.advanced.log_debug_namespace_ignore);
|
||||
}
|
||||
|
||||
logger.info('Successfully changed options');
|
||||
this.publishInfo();
|
||||
return utils.getResponse(message, {restart_required: this.restartRequired}, null);
|
||||
|
||||
Vendored
+2
@@ -196,6 +196,8 @@ declare global {
|
||||
log_file: string,
|
||||
log_level: 'debug' | 'info' | 'error' | 'warn',
|
||||
log_syslog: KeyValue,
|
||||
log_debug_to_mqtt_frontend: boolean,
|
||||
log_debug_namespace_ignore: string,
|
||||
pan_id: number | 'GENERATE',
|
||||
ext_pan_id: number[] | 'GENERATE',
|
||||
channel: number,
|
||||
|
||||
+19
-5
@@ -12,12 +12,13 @@ type LogLevel = typeof LOG_LEVELS[number];
|
||||
|
||||
class Logger {
|
||||
private level: LogLevel;
|
||||
private readonly output: string[];
|
||||
private readonly directory: string;
|
||||
private readonly logger: winston.Logger;
|
||||
private readonly fileTransport: winston.transports.FileTransportInstance;
|
||||
private output: string[];
|
||||
private directory: string;
|
||||
private logger: winston.Logger;
|
||||
private fileTransport: winston.transports.FileTransportInstance;
|
||||
private debugNamespaceIgnoreRegex?: RegExp;
|
||||
|
||||
constructor() {
|
||||
public init(): void {
|
||||
// What transports to enable
|
||||
this.output = settings.get().advanced.log_output;
|
||||
// Directory to log to
|
||||
@@ -120,6 +121,8 @@ class Logger {
|
||||
this.logger.add(new winston.transports.Syslog(options));
|
||||
}
|
||||
|
||||
this.setDebugNamespaceIgnore(settings.get().advanced.log_debug_namespace_ignore);
|
||||
|
||||
this.info(logging);
|
||||
}
|
||||
|
||||
@@ -136,6 +139,14 @@ class Logger {
|
||||
this.logger.remove(transport);
|
||||
}
|
||||
|
||||
public getDebugNamespaceIgnore(): string {
|
||||
return this.debugNamespaceIgnoreRegex?.toString().slice(1, -1)/* remove slashes */ ?? '';
|
||||
}
|
||||
|
||||
public setDebugNamespaceIgnore(value: string): void {
|
||||
this.debugNamespaceIgnoreRegex = value != '' ? new RegExp(value) : undefined;
|
||||
}
|
||||
|
||||
// TODO refactor Z2M level to 'warning' to simplify logic
|
||||
public getLevel(): LogLevel | 'warn' {
|
||||
return this.level === 'warning' ? 'warn' : this.level;
|
||||
@@ -162,6 +173,9 @@ class Logger {
|
||||
if (this.level !== 'debug') {
|
||||
return;
|
||||
}
|
||||
if (this.debugNamespaceIgnoreRegex?.test(namespace)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.debug(message, {namespace});
|
||||
}
|
||||
|
||||
@@ -497,6 +497,23 @@
|
||||
"description": "Logging level",
|
||||
"default": "info"
|
||||
},
|
||||
"log_debug_to_mqtt_frontend": {
|
||||
"type": "boolean",
|
||||
"title": "Log debug to MQTT and frontend",
|
||||
"description": "Log debug level to MQTT and frontend (may decrease overall performance)",
|
||||
"requiresRestart": true,
|
||||
"default": false
|
||||
},
|
||||
"log_debug_namespace_ignore": {
|
||||
"type": "string",
|
||||
"title": "Log debug namespace ignore",
|
||||
"description": "Do not log these namespaces (regex-based) for debug level",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"^zhc:legacy:fz:(tuya|moes)",
|
||||
"^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller"
|
||||
]
|
||||
},
|
||||
"log_syslog": {
|
||||
"type": "object",
|
||||
"title": "syslog",
|
||||
|
||||
@@ -83,6 +83,8 @@ const defaults: RecursivePartial<Settings> = {
|
||||
log_file: 'log.log',
|
||||
log_level: /* istanbul ignore next */ process.env.DEBUG ? 'debug' : 'info',
|
||||
log_syslog: {},
|
||||
log_debug_to_mqtt_frontend: false,
|
||||
log_debug_namespace_ignore: '',
|
||||
pan_id: 0x1a62,
|
||||
ext_pan_id: [0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD],
|
||||
channel: 11,
|
||||
|
||||
Generated
+256
-390
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "1.37.0",
|
||||
"version": "1.37.1",
|
||||
"description": "Zigbee to MQTT bridge using Zigbee-herdsman",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -24,9 +24,9 @@
|
||||
"build-watch": "tsc --watch",
|
||||
"eslint": "eslint lib/ --max-warnings=0",
|
||||
"start": "node index.js",
|
||||
"test-with-coverage": "jest test --coverage",
|
||||
"test": "jest test",
|
||||
"test-watch": "jest test --watch"
|
||||
"test-with-coverage": "jest test --silent --maxWorkers=50% --coverage",
|
||||
"test": "jest test --silent --maxWorkers=50%",
|
||||
"test-watch": "jest test --silent --maxWorkers=25% --watch"
|
||||
},
|
||||
"author": "Koen Kanters",
|
||||
"license": "GPL-3.0",
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"homepage": "https://koenkk.github.io/zigbee2mqtt",
|
||||
"dependencies": {
|
||||
"ajv": "^8.12.0",
|
||||
"ajv": "^8.13.0",
|
||||
"bind-decorator": "^1.0.11",
|
||||
"connect-gzip-static": "3.0.1",
|
||||
"debounce": "^2.0.0",
|
||||
@@ -49,7 +49,7 @@
|
||||
"jszip": "^3.10.1",
|
||||
"mkdir-recursive": "^0.4.0",
|
||||
"moment": "^2.30.1",
|
||||
"mqtt": "^5.5.4",
|
||||
"mqtt": "^5.5.0",
|
||||
"object-assign-deep": "^0.4.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"semver": "^7.6.0",
|
||||
@@ -59,30 +59,30 @@
|
||||
"winston-syslog": "^2.7.0",
|
||||
"winston-transport": "^4.7.0",
|
||||
"ws": "^8.17.0",
|
||||
"zigbee-herdsman": "0.45.0",
|
||||
"zigbee-herdsman-converters": "19.32.0",
|
||||
"zigbee2mqtt-frontend": "0.6.165"
|
||||
"zigbee-herdsman": "0.46.6",
|
||||
"zigbee-herdsman-converters": "19.37.2",
|
||||
"zigbee2mqtt-frontend": "0.6.167"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.4",
|
||||
"@babel/core": "^7.24.5",
|
||||
"@babel/plugin-proposal-decorators": "^7.24.1",
|
||||
"@babel/preset-env": "^7.24.4",
|
||||
"@babel/preset-env": "^7.24.5",
|
||||
"@babel/preset-typescript": "^7.24.1",
|
||||
"@types/debounce": "^1.2.4",
|
||||
"@types/finalhandler": "^1.2.3",
|
||||
"@types/humanize-duration": "^3.27.4",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/node": "^20.12.8",
|
||||
"@types/object-assign-deep": "^0.4.3",
|
||||
"@types/readable-stream": "4.0.11",
|
||||
"@types/readable-stream": "4.0.12",
|
||||
"@types/ws": "8.5.10",
|
||||
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
||||
"@typescript-eslint/parser": "^7.7.1",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"babel-jest": "^29.7.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-plugin-jest": "^28.3.0",
|
||||
"eslint-plugin-jest": "^28.5.0",
|
||||
"jest": "^29.7.0",
|
||||
"tmp": "^0.2.3",
|
||||
"typescript": "^5.4.5"
|
||||
|
||||
@@ -5,7 +5,21 @@
|
||||
"include-component-in-tag": false,
|
||||
"include-v-in-tag": false,
|
||||
"draft": true
|
||||
},
|
||||
"charts/zigbee2mqtt": {
|
||||
"release-type": "helm",
|
||||
"include-component-in-tag": false,
|
||||
"include-v-in-tag": false,
|
||||
"draft": true,
|
||||
"extra-files": [
|
||||
{
|
||||
"type": "yaml",
|
||||
"path": "charts/zigbee2mqtt",
|
||||
"jsonpath": "$.appVersion"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"pull-request-title-pattern": "chore${scope}: release ${version}",
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
}
|
||||
+42
-2
File diff suppressed because one or more lines are too long
+71
-14
@@ -9,6 +9,8 @@ const {rimrafSync} = require('rimraf');
|
||||
const Transport = require('winston-transport');
|
||||
|
||||
describe('Logger', () => {
|
||||
let logger;
|
||||
|
||||
beforeEach(async () => {
|
||||
data.writeDefaultConfiguration();
|
||||
jest.resetModules();
|
||||
@@ -17,6 +19,8 @@ describe('Logger', () => {
|
||||
settings.reRead();
|
||||
stdOutWriteOriginal = console._stdout.write;
|
||||
console._stdout.write = () => {};
|
||||
logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -24,14 +28,11 @@ describe('Logger', () => {
|
||||
});
|
||||
|
||||
it('Create log directory', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
const dirs = fs.readdirSync(dir.name);
|
||||
expect(dirs.length).toBe(1);
|
||||
});
|
||||
|
||||
it('Should cleanup', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
|
||||
for (const d of fs.readdirSync(dir.name)) {
|
||||
rimrafSync(path.join(dir.name, d));
|
||||
}
|
||||
@@ -46,7 +47,6 @@ describe('Logger', () => {
|
||||
})
|
||||
|
||||
it('Should not cleanup when there is no timestamp set', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
for (let i = 30; i < 40; i++) {
|
||||
fs.mkdirSync(path.join(dir.name, `log_${i}`));
|
||||
}
|
||||
@@ -58,7 +58,6 @@ describe('Logger', () => {
|
||||
})
|
||||
|
||||
it('Set and get log level', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.setLevel('debug');
|
||||
expect(logger.getLevel()).toBe('debug');
|
||||
logger.setLevel('info');
|
||||
@@ -74,7 +73,7 @@ describe('Logger', () => {
|
||||
it('Set warning when log level is warn', () => {
|
||||
settings.set(['advanced', 'log_level'], 'warn');
|
||||
settings.reRead();
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
expect(logger.level).toBe('warning');// getLevel() reports old Z2M level to match display/value
|
||||
settings.set(['advanced', 'log_level'], 'info');
|
||||
settings.reRead();
|
||||
@@ -86,7 +85,6 @@ describe('Logger', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const logger = require('../lib/util/logger').default;
|
||||
expect(logger.winston.transports.length).toBe(2);
|
||||
const transport = new DummyTransport();
|
||||
logger.addTransport(transport);
|
||||
@@ -96,7 +94,6 @@ describe('Logger', () => {
|
||||
});
|
||||
|
||||
it('Logger should be console and file by default', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
const pipes = logger.winston._readableState.pipes;
|
||||
expect(pipes.length).toBe(2);
|
||||
expect(pipes[0].constructor.name).toBe('Console');
|
||||
@@ -107,7 +104,7 @@ describe('Logger', () => {
|
||||
|
||||
it('Logger can be file only', () => {
|
||||
settings.set(['advanced', 'log_output'], ['file']);
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
const pipes = logger.winston._readableState.pipes;
|
||||
expect(pipes.length).toBe(2);
|
||||
expect(pipes[0].constructor.name).toBe('Console');
|
||||
@@ -118,7 +115,7 @@ describe('Logger', () => {
|
||||
|
||||
it('Logger can be console only', () => {
|
||||
settings.set(['advanced', 'log_output'], ['console']);
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
const pipes = logger.winston._readableState.pipes;
|
||||
expect(pipes.constructor.name).toBe('Console');
|
||||
expect(pipes.silent).toBe(false);
|
||||
@@ -126,7 +123,7 @@ describe('Logger', () => {
|
||||
|
||||
it('Logger can be nothing', () => {
|
||||
settings.set(['advanced', 'log_output'], []);
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
const pipes = logger.winston._readableState.pipes;
|
||||
expect(pipes.constructor.name).toBe('Console');
|
||||
expect(pipes.silent).toBe(true);
|
||||
@@ -134,7 +131,7 @@ describe('Logger', () => {
|
||||
|
||||
it('Should allow to disable log rotation', () => {
|
||||
settings.set(['advanced', 'log_rotation'], false);
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
const pipes = logger.winston._readableState.pipes;
|
||||
expect(pipes[1].constructor.name).toBe('File');
|
||||
expect(pipes[1].maxFiles).toBeNull();
|
||||
@@ -144,7 +141,7 @@ describe('Logger', () => {
|
||||
|
||||
it('Should allow to symlink logs to current directory', () => {
|
||||
settings.set(['advanced', 'log_symlink_current'], true);
|
||||
let logger = require('../lib/util/logger').default;
|
||||
logger.init();
|
||||
expect(fs.readdirSync(dir.name).includes('current')).toBeTruthy()
|
||||
|
||||
jest.resetModules();
|
||||
@@ -152,7 +149,6 @@ describe('Logger', () => {
|
||||
});
|
||||
|
||||
it('Log', () => {
|
||||
const logger = require('../lib/util/logger').default;
|
||||
logger.setLevel('debug');
|
||||
|
||||
const debug = jest.spyOn(logger.winston, 'debug');
|
||||
@@ -178,4 +174,65 @@ describe('Logger', () => {
|
||||
expect(error).toHaveBeenCalledWith('error', {namespace: 'z2m'});
|
||||
expect(error).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'^zhc:legacy:fz:(tuya|moes)',
|
||||
new RegExp(/^zhc:legacy:fz:(tuya|moes)/),
|
||||
[
|
||||
{ ns: 'zhc:legacy:fz:tuya_device12', match: true },
|
||||
{ ns: 'zhc:legacy:fz:moes_dimmer', match: true },
|
||||
{ ns: 'zhc:legacy:fz:not_moes', match: false },
|
||||
{ ns: 'zhc:legacy:fz', match: false },
|
||||
{ ns: 'zhc:legacy:fz:', match: false },
|
||||
{ ns: '1zhc:legacy:fz:tuya_device12', match: false },
|
||||
]
|
||||
],
|
||||
[
|
||||
'^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller',
|
||||
new RegExp(/^zhc:legacy:fz:(tuya|moes)|^zh:ember:uart:|^zh:controller/),
|
||||
[
|
||||
{ ns: 'zh:ember:uart:ash', match: true },
|
||||
{ ns: 'zh:ember:uart', match: false },
|
||||
{ ns: 'zh:controller', match: true },
|
||||
{ ns: 'zh:controller:', match: true },
|
||||
{ ns: 'azh:controller:', match: false },
|
||||
]
|
||||
],
|
||||
[
|
||||
'',
|
||||
undefined,
|
||||
[
|
||||
{ ns: 'zhc:legacy:fz:tuya_device12', match: false },
|
||||
{ ns: 'zhc:legacy:fz:moes_dimmer', match: false },
|
||||
{ ns: 'zhc:legacy:fz:not_moes', match: false },
|
||||
{ ns: 'zhc:legacy:fz', match: false },
|
||||
{ ns: 'zhc:legacy:fz:', match: false },
|
||||
{ ns: '1zhc:legacy:fz:tuya_device12', match: false },
|
||||
{ ns: 'zh:ember:uart:ash', match: false },
|
||||
{ ns: 'zh:ember:uart', match: false },
|
||||
{ ns: 'zh:controller', match: false },
|
||||
{ ns: 'zh:controller:', match: false },
|
||||
{ ns: 'azh:controller:', match: false },
|
||||
]
|
||||
],
|
||||
])('Sets namespace ignore for debug level %s', (ignore, expected, tests) => {
|
||||
logger.setLevel('debug');
|
||||
const debugSpy = jest.spyOn(logger.winston, 'debug');
|
||||
logger.setDebugNamespaceIgnore(ignore);
|
||||
expect(logger.debugNamespaceIgnoreRegex).toStrictEqual(expected);
|
||||
expect(logger.getDebugNamespaceIgnore()).toStrictEqual(ignore);
|
||||
|
||||
for (const test of tests) {
|
||||
logger.debug('Test message', test.ns);
|
||||
|
||||
if (test.match) {
|
||||
expect(debugSpy).not.toHaveBeenCalled();
|
||||
} else {
|
||||
expect(debugSpy).toHaveBeenCalled();
|
||||
}
|
||||
|
||||
debugSpy.mockClear();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
+7
-4
@@ -1,4 +1,5 @@
|
||||
let level = 'info';
|
||||
let debugNamespaceIgnore = '';
|
||||
|
||||
let transports = [];
|
||||
|
||||
@@ -13,10 +14,10 @@ const callTransports = (level, message, namespace) => {
|
||||
|
||||
const mock = {
|
||||
init: jest.fn(),
|
||||
info: jest.fn().mockImplementation((msg) => callTransports('info', msg)),
|
||||
warning: jest.fn().mockImplementation((msg) => callTransports('warning', msg)),
|
||||
error: jest.fn().mockImplementation((msg) => callTransports('error', msg)),
|
||||
debug: jest.fn().mockImplementation((msg) => callTransports('debug', msg)),
|
||||
info: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('info', msg, namespace)),
|
||||
warning: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('warning', msg, namespace)),
|
||||
error: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('error', msg, namespace)),
|
||||
debug: jest.fn().mockImplementation((msg, namespace = 'z2m') => callTransports('debug', msg, namespace)),
|
||||
cleanup: jest.fn(),
|
||||
logOutput: jest.fn(),
|
||||
add: (transport) => transports.push(transport),
|
||||
@@ -26,6 +27,8 @@ const mock = {
|
||||
},
|
||||
setLevel: (newLevel) => {level = newLevel},
|
||||
getLevel: () => level,
|
||||
setDebugNamespaceIgnore: (newIgnore) => {debugNamespaceIgnore = newIgnore},
|
||||
getDebugNamespaceIgnore: () => debugNamespaceIgnore,
|
||||
setTransportsEnabled: (value) => {transportsEnabled = value},
|
||||
end: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -118,6 +118,8 @@ class Device {
|
||||
this.ping = jest.fn();
|
||||
this.removeFromNetwork = jest.fn();
|
||||
this.removeFromDatabase = jest.fn();
|
||||
this.customClusters = {};
|
||||
this.addCustomCluster = jest.fn();
|
||||
this.save = jest.fn();
|
||||
this.manufacturerName = manufacturerName;
|
||||
this.lastSeen = 1000;
|
||||
|
||||
Reference in New Issue
Block a user