mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-29 23:28:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9eaaa0f9d1 | ||
|
|
0807049b6c | ||
|
|
759c235923 | ||
|
|
14ac9a8f68 | ||
|
|
d942db9a92 | ||
|
|
212c70913c | ||
|
|
b17c22bb50 | ||
|
|
c8c5ea2de3 | ||
|
|
00230baedf | ||
|
|
540969be21 | ||
|
|
804182e30c | ||
|
|
99a57bfd08 | ||
|
|
b8edf273c6 | ||
|
|
e9aee4c6dc | ||
|
|
e6bcf91e17 | ||
|
|
7e37365a5f | ||
|
|
32b1d5b073 | ||
|
|
cb7b773e0d | ||
|
|
84387b27a4 | ||
|
|
3d8f0fc3a8 | ||
|
|
02a587f745 |
@@ -41,7 +41,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: latest
|
||||
- name: Docker build dev
|
||||
- name: "dev: Docker build"
|
||||
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
|
||||
run: |
|
||||
docker buildx build \
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
--push \
|
||||
-t koenkk/zigbee2mqtt:latest-dev -t ghcr.io/koenkk/zigbee2mqtt:latest-dev \
|
||||
.
|
||||
- name: Docker build release
|
||||
- name: "release: Docker build"
|
||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
|
||||
run: |
|
||||
TAG="$(git describe --tags)"
|
||||
@@ -64,12 +64,12 @@ jobs:
|
||||
--push \
|
||||
-t koenkk/zigbee2mqtt:latest -t "koenkk/zigbee2mqtt:$TAG" -t ghcr.io/koenkk/zigbee2mqtt:latest -t "ghcr.io/koenkk/zigbee2mqtt:$TAG" \
|
||||
.
|
||||
- name: Publish to npm
|
||||
- name: "release: Publish to npm"
|
||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }}
|
||||
- name: Trigger zigbee2mqtt/hassio-zigbee2mqtt build
|
||||
- name: "dev: Trigger zigbee2mqtt/hassio-zigbee2mqtt build"
|
||||
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
|
||||
run: |
|
||||
curl \
|
||||
@@ -78,6 +78,35 @@ jobs:
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/actions/workflows/ci.yml/dispatches \
|
||||
-d '{"ref":"master","inputs":{}}'
|
||||
- name: "release: Trigger zigbee2mqtt/hassio-zigbee2mqtt build"
|
||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
|
||||
run: |
|
||||
TAG=${GITHUB_REF#refs/*/}
|
||||
echo "Triggering with tag '$TAG'"
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.everest-preview+json" \
|
||||
-H "Content-Type: application/json" \
|
||||
https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/dispatches \
|
||||
--data "{\"event_type\": \"release\", \"client_payload\": { \"version\": \"$TAG-1\"}}"
|
||||
- name: "release: merge dev -> master and promote dev"
|
||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git fetch origin
|
||||
git checkout master
|
||||
git merge -m 'chore: merge dev to master' dev
|
||||
git push origin master
|
||||
git checkout dev
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package.json > package.json.tmp
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package-lock.json > package-lock.json.tmp
|
||||
mv package.json.tmp package.json
|
||||
mv package-lock.json.tmp package-lock.json
|
||||
git add -A
|
||||
git commit -m "chore: promote to dev"
|
||||
git push origin dev
|
||||
|
||||
tests:
|
||||
strategy:
|
||||
|
||||
@@ -23,7 +23,6 @@ jobs:
|
||||
- uses: google-github-actions/release-please-action@v4
|
||||
id: release
|
||||
with:
|
||||
release-type: node
|
||||
target-branch: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
|
||||
@@ -51,67 +50,20 @@ 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--release-please-action/CHANGELOG.md > z2m/CHANGELOG.md || true
|
||||
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev--components--zigbee2mqtt/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
|
||||
env:
|
||||
GH_TOKEN: ${{secrets.GH_TOKEN}}
|
||||
- name: Update changelog in release PR
|
||||
- name: Update changelog gist
|
||||
run: |
|
||||
gh gist edit bfd4c3d1725a2cccacc11d6ba51008ba -a changelog.md
|
||||
env:
|
||||
GH_TOKEN: ${{secrets.GH_TOKEN}}
|
||||
- name: Upload changelog
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: changelog
|
||||
path: changelog.md
|
||||
- name: Save cache commit-user-lookup.json
|
||||
uses: actions/cache/save@v3
|
||||
if: always()
|
||||
with:
|
||||
path: z2m/scripts/commit-user-lookup.json
|
||||
key: commit-user-lookup-${{ hashFiles('z2m/scripts/commit-user-lookup.json') }}
|
||||
|
||||
create_release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-please]
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
- name: Merge dev -> master
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git checkout master
|
||||
git merge -m 'chore: merge dev to master'
|
||||
git push origin master
|
||||
- name: Promote to dev
|
||||
run: |
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package.json > package.json.tmp
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package-lock.json > package-lock.json.tmp
|
||||
mv package.json.tmp package.json
|
||||
mv package-lock.json.tmp package-lock.json
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "chore: promote to dev"
|
||||
- name: Download changelog
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changelog
|
||||
path: ../changelog
|
||||
- name: update release
|
||||
id: update_release
|
||||
uses: tubone24/update_release@v1.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
TAG_NAME: ${{ needs.release-please.outputs.version }}
|
||||
with:
|
||||
body_path: ../changelog/changelog.md
|
||||
- name: Trigger HA addon update
|
||||
run: |
|
||||
curl -XPOST -H "Authorization: token ${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/dispatches --data "{\"event_type\": \"release\", \"client_payload\": { \"version\": \"${{ needs.release-please.outputs.version }}-1\"}}"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{
|
||||
".": "1.35.0",
|
||||
"bootstrap-sha": "7ee207fc0e05f32c9636c0298b48eea1b91ed9e1",
|
||||
"include-v-in-tag": false
|
||||
".": "1.35.1"
|
||||
}
|
||||
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## [1.35.1](https://github.com/Koenkk/zigbee2mqtt/compare/1.35.0...1.35.1) (2024-01-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix configure on startup crashing coordinator https://github.com/Koenkk/zigbee2mqtt/issues/20526 ([e9aee4c](https://github.com/Koenkk/zigbee2mqtt/commit/e9aee4c6dc1b7dcfedfa821723b029e1a0423d15))
|
||||
* Fix crash due to unhandled Promise exception https://github.com/Koenkk/zigbee2mqtt/issues/20473 ([e6bcf91](https://github.com/Koenkk/zigbee2mqtt/commit/e6bcf91e17747eff38ce7774107d697aeff4be15))
|
||||
* Fix Home Assistant `program` not truncated when too large https://github.com/Koenkk/zigbee2mqtt/issues/19788 ([32b1d5b](https://github.com/Koenkk/zigbee2mqtt/commit/32b1d5b0732544a2026f8582f8bb12a3e5691b2b))
|
||||
* **ignore:** update zigbee-herdsman-converters to 18.4.0 ([#20523](https://github.com/Koenkk/zigbee2mqtt/issues/20523)) ([7e37365](https://github.com/Koenkk/zigbee2mqtt/commit/7e37365a5faec6d8d33db406ed18d5492fa2fc19))
|
||||
* **ignore:** update zigbee-herdsman-converters to 18.6.0 ([#20585](https://github.com/Koenkk/zigbee2mqtt/issues/20585)) ([b17c22b](https://github.com/Koenkk/zigbee2mqtt/commit/b17c22bb501599fcc68685ff0fc65642d1dea9ca))
|
||||
* **ignore:** update zigbee-herdsman-converters to 18.8.0 ([#20613](https://github.com/Koenkk/zigbee2mqtt/issues/20613)) ([14ac9a8](https://github.com/Koenkk/zigbee2mqtt/commit/14ac9a8f68480c433450cb1f33f8feda00359268))
|
||||
* **ignore:** update zigbee-herdsman-converters to 18.9.0 ([#20635](https://github.com/Koenkk/zigbee2mqtt/issues/20635)) ([759c235](https://github.com/Koenkk/zigbee2mqtt/commit/759c2359234a5f83b9a7f2a5b97e75aef9d0d567))
|
||||
* **ignore:** update zigbee2mqtt-frontend to 0.6.151 ([#20509](https://github.com/Koenkk/zigbee2mqtt/issues/20509)) ([cb7b773](https://github.com/Koenkk/zigbee2mqtt/commit/cb7b773e0defb1e28dc17af42e3807e7628338df))
|
||||
* Prevent extension errors from crashing Zigbee2MQTT https://github.com/Koenkk/zigbee2mqtt/issues/20477 ([212c709](https://github.com/Koenkk/zigbee2mqtt/commit/212c70913c06a97dea8dac7d532a7d601c69a3d1))
|
||||
* Prevent warnings for bridge entities with legacy_entity_attributes enabled ([#20548](https://github.com/Koenkk/zigbee2mqtt/issues/20548)) ([99a57bf](https://github.com/Koenkk/zigbee2mqtt/commit/99a57bfd080fcf311f7cc45e7d0d04cdc0a6138a))
|
||||
* Support legacy_availability_payload for Home Assistant connection_state ([#20547](https://github.com/Koenkk/zigbee2mqtt/issues/20547)) ([b8edf27](https://github.com/Koenkk/zigbee2mqtt/commit/b8edf273c6de799e30c95c607f315f02b0dcacdd))
|
||||
|
||||
## [1.35.0](https://github.com/Koenkk/zigbee2mqtt/compare/1.34.0...v1.35.0) (2024-01-01)
|
||||
|
||||
|
||||
|
||||
+1
-4
@@ -51,10 +51,7 @@ export class Controller {
|
||||
|
||||
constructor(restartCallback: () => void, exitCallback: (code: number, restart: boolean) => void) {
|
||||
logger.init();
|
||||
this.eventBus = new EventBus( /* istanbul ignore next */ (error) => {
|
||||
logger.error(`Error: ${error.message}`);
|
||||
logger.debug(error.stack);
|
||||
});
|
||||
this.eventBus = new EventBus();
|
||||
this.zigbee = new Zigbee(this.eventBus);
|
||||
this.mqtt = new MQTT(this.eventBus);
|
||||
this.state = new State(this.eventBus, this.zigbee);
|
||||
|
||||
+13
-6
@@ -1,5 +1,5 @@
|
||||
import events from 'events';
|
||||
events.captureRejections = true;
|
||||
import logger from './util/logger';
|
||||
|
||||
// eslint-disable-next-line
|
||||
type ListenerKey = object;
|
||||
@@ -8,9 +8,8 @@ export default class EventBus {
|
||||
private callbacksByExtension: { [s: string]: { event: string, callback: (...args: unknown[]) => void }[] } = {};
|
||||
private emitter = new events.EventEmitter();
|
||||
|
||||
constructor(onError: (error: Error) => void) {
|
||||
constructor() {
|
||||
this.emitter.setMaxListeners(100);
|
||||
this.emitter.on('error', onError);
|
||||
}
|
||||
|
||||
public emitAdapterDisconnected(): void {
|
||||
@@ -161,10 +160,18 @@ export default class EventBus {
|
||||
this.on('stateChange', callback, key);
|
||||
}
|
||||
|
||||
private on(event: string, callback: (...args: unknown[]) => void, key: ListenerKey): void {
|
||||
private on(event: string, callback: (...args: unknown[]) => (Promise<void> | void), key: ListenerKey): void {
|
||||
if (!this.callbacksByExtension[key.constructor.name]) this.callbacksByExtension[key.constructor.name] = [];
|
||||
this.callbacksByExtension[key.constructor.name].push({event, callback});
|
||||
this.emitter.on(event, callback);
|
||||
const wrappedCallback = async (...args: unknown[]): Promise<void> => {
|
||||
try {
|
||||
await callback(...args);
|
||||
} catch (error) {
|
||||
logger.error(`EventBus error '${key.constructor.name}/${event}': ${error.message}`);
|
||||
logger.debug(error.stack);
|
||||
}
|
||||
};
|
||||
this.callbacksByExtension[key.constructor.name].push({event, callback: wrappedCallback});
|
||||
this.emitter.on(event, wrappedCallback);
|
||||
}
|
||||
|
||||
public removeListeners(key: ListenerKey): void {
|
||||
|
||||
@@ -66,6 +66,9 @@ export default class Configure extends Extension {
|
||||
override async start(): Promise<void> {
|
||||
setImmediate(async () => {
|
||||
for (const device of this.zigbee.devices(false)) {
|
||||
// Sleep 10 seconds between configuring on startup to not DDoS the coordinator
|
||||
// when many devices have to be configured.
|
||||
await utils.sleep(10);
|
||||
await this.configure(device, 'started');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1002,7 +1002,7 @@ export default class HomeAssistant extends Extension {
|
||||
action: {icon: 'mdi:gesture-double-tap'},
|
||||
level_config: {entity_category: 'diagnostic'},
|
||||
programming_mode: {icon: 'mdi:calendar-clock'},
|
||||
program: {value_template: `{{ value_json.${firstExpose.property}|default('',true) ` +
|
||||
program: {value_template: `{{ value_json.${firstExpose.property}|default('',True) ` +
|
||||
`| truncate(254, True, '', 0) }}`},
|
||||
};
|
||||
if (firstExpose.access & ACCESS_STATE) {
|
||||
@@ -1378,7 +1378,7 @@ export default class HomeAssistant extends Extension {
|
||||
payload.tilt_status_topic = stateTopic;
|
||||
}
|
||||
|
||||
if (this.entityAttributes) {
|
||||
if (this.entityAttributes && (isDevice || isGroup) ) {
|
||||
payload.json_attributes_topic = stateTopic;
|
||||
}
|
||||
|
||||
@@ -1796,6 +1796,7 @@ export default class HomeAssistant extends Extension {
|
||||
const discovery: DiscoveryEntry[] = [];
|
||||
const bridge = new Bridge(coordinatorIeeeAddress, coordinatorVersion, discovery);
|
||||
const baseTopic = `${settings.get().mqtt.base_topic}/${bridge.name}`;
|
||||
const legacyAvailability = settings.get().advanced.legacy_availability_payload;
|
||||
|
||||
discovery.push(
|
||||
// Binary sensors.
|
||||
@@ -1809,7 +1810,7 @@ export default class HomeAssistant extends Extension {
|
||||
entity_category: 'diagnostic',
|
||||
state_topic: true,
|
||||
state_topic_postfix: 'state',
|
||||
value_template: '{{ value_json.state }}',
|
||||
value_template: !legacyAvailability ? '{{ value_json.state }}' : '{{ value }}',
|
||||
payload_on: 'online',
|
||||
payload_off: 'offline',
|
||||
availability: false,
|
||||
|
||||
@@ -118,7 +118,7 @@ export default class Receive extends Extension {
|
||||
// for e.g. click switches where we need to count number of clicks and detect long presses.
|
||||
const publish = (payload: KeyValue): void => {
|
||||
const options: KeyValue = data.device.options;
|
||||
zhc.postProcessConvertedFromZigbeeMessage(data.device.definition, payload, options);
|
||||
zhc.postProcessConvertedFromZigbeeMessage(data.device.definition, payload, options, logger);
|
||||
|
||||
if (settings.get().advanced.elapsed) {
|
||||
const now = Date.now();
|
||||
|
||||
Generated
+16
-15
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "1.35.0",
|
||||
"version": "1.35.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "1.35.0",
|
||||
"version": "1.35.1",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"ajv": "^8.12.0",
|
||||
@@ -34,8 +34,8 @@
|
||||
"winston-transport": "^4.6.0",
|
||||
"ws": "^8.16.0",
|
||||
"zigbee-herdsman": "0.30.0",
|
||||
"zigbee-herdsman-converters": "18.3.0",
|
||||
"zigbee2mqtt-frontend": "0.6.150"
|
||||
"zigbee-herdsman-converters": "18.9.0",
|
||||
"zigbee2mqtt-frontend": "0.6.151"
|
||||
},
|
||||
"bin": {
|
||||
"zigbee2mqtt": "cli.js"
|
||||
@@ -3622,11 +3622,11 @@
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz",
|
||||
"integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==",
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz",
|
||||
"integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"follow-redirects": "^1.15.4",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
@@ -9799,21 +9799,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/zigbee-herdsman-converters": {
|
||||
"version": "18.3.0",
|
||||
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-18.3.0.tgz",
|
||||
"integrity": "sha512-JYyHtU3iB9KYHdmSEG1sF+Xf3RqAGEXol8udK9e0aNiP8TObUwQmqfRS8SPhBVW/A3IgOUyS0opT/lE+/51M5A==",
|
||||
"version": "18.9.0",
|
||||
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-18.9.0.tgz",
|
||||
"integrity": "sha512-Px44olMni2F2/c9DbjDprcKLD37XZlWagY/5Tt+NXR0QLZZQXDl73C8jqUBBt2i8LF2oVoWlzgh880chu9yteA==",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.3",
|
||||
"axios": "^1.6.5",
|
||||
"buffer-crc32": "^0.2.13",
|
||||
"https-proxy-agent": "^7.0.2",
|
||||
"semver": "^7.5.4",
|
||||
"tar-stream": "^3.1.6",
|
||||
"zigbee-herdsman": "^0.30.0"
|
||||
}
|
||||
},
|
||||
"node_modules/zigbee2mqtt-frontend": {
|
||||
"version": "0.6.150",
|
||||
"resolved": "https://registry.npmjs.org/zigbee2mqtt-frontend/-/zigbee2mqtt-frontend-0.6.150.tgz",
|
||||
"integrity": "sha512-+BGvDQcKC0XUtVLChwFc2kBJwQkC+SA/VAsAH8tzMwx5riVrflKOH0ewnUYamT/vAqQM0cxZB9Jfnip8mXds3Q==",
|
||||
"version": "0.6.151",
|
||||
"resolved": "https://registry.npmjs.org/zigbee2mqtt-frontend/-/zigbee2mqtt-frontend-0.6.151.tgz",
|
||||
"integrity": "sha512-l1EP7r+tz/k0tY+xPum7l5yd2khhHr5YrdJan8L00/BoktjSZ5jbHYdlh5RDqP711g44gkSTM2EPIaE2+I3GcQ==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zigbee2mqtt",
|
||||
"version": "1.35.0",
|
||||
"version": "1.35.1",
|
||||
"description": "Zigbee to MQTT bridge using Zigbee-herdsman",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -62,8 +62,8 @@
|
||||
"winston-transport": "^4.6.0",
|
||||
"ws": "^8.16.0",
|
||||
"zigbee-herdsman": "0.30.0",
|
||||
"zigbee-herdsman-converters": "18.3.0",
|
||||
"zigbee2mqtt-frontend": "0.6.150"
|
||||
"zigbee-herdsman-converters": "18.9.0",
|
||||
"zigbee2mqtt-frontend": "0.6.151"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.7",
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
{
|
||||
"packages": {
|
||||
".": {
|
||||
"changelog-path": "CHANGELOG.md",
|
||||
"release-type": "node",
|
||||
"bump-minor-pre-major": false,
|
||||
"bump-patch-for-minor-pre-major": false,
|
||||
"draft": false,
|
||||
"include-component-in-tag": false,
|
||||
"include-v-in-tag": false,
|
||||
"prerelease": true,
|
||||
"skip-github-release": false
|
||||
"draft": true
|
||||
}
|
||||
},
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -730,4 +730,14 @@ describe('Controller', () => {
|
||||
await controller.stop();
|
||||
expect(controller.state.state[device.ieeeAddr]).toStrictEqual(undefined);
|
||||
});
|
||||
|
||||
it('EventBus should handle errors', async () => {
|
||||
const eventbus = controller.eventBus;
|
||||
const callback = jest.fn().mockImplementation(async () => {throw new Error('Whoops!')});
|
||||
eventbus.onStateChange('test', callback);
|
||||
eventbus.emitStateChange({});
|
||||
await flushPromises();
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
expect(logger.error).toHaveBeenCalledWith(`EventBus error 'String/stateChange': Whoops!`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,6 +67,7 @@ jest.mock('https', () => ({
|
||||
mockHTTPS.variables.onRequest = onRequest;
|
||||
return mockHTTPS.implementation;
|
||||
}),
|
||||
Agent: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("connect-gzip-static", () =>
|
||||
@@ -87,7 +88,7 @@ jest.mock('ws', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('Frontend', () => {
|
||||
describe('onlythis Frontend', () => {
|
||||
let controller;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -5,6 +5,7 @@ const logger = require('./stub/logger');
|
||||
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
|
||||
const flushPromises = require('./lib/flushPromises');
|
||||
const MQTT = require('./stub/mqtt');
|
||||
const sleep = require('./stub/sleep');
|
||||
const Controller = require('../lib/controller');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -42,12 +43,14 @@ describe('HomeAssistant extension', () => {
|
||||
settings.reRead();
|
||||
data.writeEmptyState();
|
||||
MQTT.publish.mockClear();
|
||||
sleep.mock();
|
||||
controller = new Controller(false);
|
||||
await controller.start();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
jest.useRealTimers();
|
||||
sleep.restore();
|
||||
});
|
||||
|
||||
it('Should not have duplicate type/object_ids in a mapping', () => {
|
||||
@@ -2287,7 +2290,7 @@ describe('HomeAssistant extension', () => {
|
||||
'device_class': 'connectivity',
|
||||
'unique_id': 'bridge_0x00124b00120144ae_connection_state_zigbee2mqtt',
|
||||
'state_topic': 'zigbee2mqtt/bridge/state',
|
||||
'value_template': '{{ value_json.state }}',
|
||||
'value_template': '{{ value }}',
|
||||
'payload_on': 'online',
|
||||
'payload_off': 'offline',
|
||||
'origin': origin,
|
||||
|
||||
@@ -2,6 +2,7 @@ const path = require('path');
|
||||
|
||||
const data = require('./stub/data');
|
||||
const logger = require('./stub/logger');
|
||||
const sleep = require('./stub/sleep');
|
||||
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
|
||||
const MQTT = require('./stub/mqtt');
|
||||
const settings = require('../lib/util/settings');
|
||||
@@ -35,6 +36,7 @@ describe('OTA update', () => {
|
||||
settings.reRead();
|
||||
jest.useFakeTimers();
|
||||
controller = new Controller(jest.fn(), jest.fn());
|
||||
sleep.mock();
|
||||
await controller.start();
|
||||
await jest.runOnlyPendingTimers();
|
||||
await flushPromises();
|
||||
@@ -47,6 +49,7 @@ describe('OTA update', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
jest.useRealTimers();
|
||||
sleep.restore();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -57,7 +60,7 @@ describe('OTA update', () => {
|
||||
MQTT.publish.mockClear();
|
||||
});
|
||||
|
||||
it('Should OTA update a device', async () => {
|
||||
it('onlythis Should OTA update a device', async () => {
|
||||
const device = zigbeeHerdsman.devices.bulb;
|
||||
const endpoint = device.endpoints[0];
|
||||
let count = 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const data = require('./stub/data');
|
||||
const sleep = require('./stub/sleep');
|
||||
const logger = require('./stub/logger');
|
||||
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
|
||||
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
||||
@@ -30,6 +31,7 @@ describe('Publish', () => {
|
||||
jest.useFakeTimers();
|
||||
data.writeEmptyState();
|
||||
controller = new Controller(jest.fn(), jest.fn());
|
||||
sleep.mock();
|
||||
await controller.start();
|
||||
await flushPromises();
|
||||
});
|
||||
@@ -56,6 +58,7 @@ describe('Publish', () => {
|
||||
afterAll(async () => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.useRealTimers();
|
||||
sleep.restore();
|
||||
});
|
||||
|
||||
it('Should publish messages to zigbee devices', async () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const data = require('./stub/data');
|
||||
const sleep = require('./stub/sleep');
|
||||
const logger = require('./stub/logger');
|
||||
const stringify = require('json-stable-stringify-without-jsonify');
|
||||
const zigbeeHerdsman = require('./stub/zigbeeHerdsman');
|
||||
@@ -15,6 +16,7 @@ describe('Receive', () => {
|
||||
beforeAll(async () => {
|
||||
jest.useFakeTimers();
|
||||
controller = new Controller(jest.fn(), jest.fn());
|
||||
sleep.mock();
|
||||
await controller.start();
|
||||
await jest.runOnlyPendingTimers();
|
||||
await flushPromises();
|
||||
@@ -30,6 +32,7 @@ describe('Receive', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
jest.useRealTimers();
|
||||
sleep.restore();
|
||||
});
|
||||
|
||||
it('Should handle a zigbee message', async () => {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
const utils = require('../../lib/util/utils');
|
||||
const spy = jest.spyOn(utils.default, 'sleep');
|
||||
|
||||
export function mock() {
|
||||
spy.mockImplementation(() => {});
|
||||
}
|
||||
|
||||
export function restore() {
|
||||
spy.mockRestore();
|
||||
}
|
||||
Reference in New Issue
Block a user