Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception when payload is null #3980

Closed
dvv opened this issue Jul 26, 2020 · 1 comment
Closed

Unhandled exception when payload is null #3980

dvv opened this issue Jul 26, 2020 · 1 comment

Comments

@dvv
Copy link

dvv commented Jul 26, 2020

Bug Report

What happened

On zigbee2mqtt startup my "ZNCZ02LM - Xiaomi Mi power plug ZigBee" caused:

Jul 26 15:50:48 orange node[8109]: (node:8109) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
Jul 26 15:50:48 orange node[8109]:     at Function.entries (<anonymous>)
Jul 26 15:50:48 orange node[8109]:     at Controller.iteratePayloadAttributeOutput (/myhome/service/zigbee2mqtt/node_modules/zigbee2mqtt/lib/controller.js:335:43)
Jul 26 15:50:48 orange node[8109]:     at Controller.iteratePayloadAttributeOutput (/myhome/service/zigbee2mqtt/node_modules/zigbee2mqtt/lib/controller.js:348:29)
Jul 26 15:50:48 orange node[8109]:     at processTicksAndRejections (internal/process/task_queues.js:93:5)
Jul 26 15:50:48 orange node[8109]:     at async Controller.publishEntityState (/myhome/service/zigbee2mqtt/node_modules/zigbee2mqtt/lib/controller.js:325:21)
Jul 26 15:50:48 orange node[8109]: (Use `node --trace-warnings ...` to show where the warning was created)
Jul 26 15:50:48 orange node[8109]: (node:8109) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Jul 26 15:50:48 orange node[8109]: (node:8109) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If it does matter the device voltage attribute is null.

What did you expect to happen

Skip such payload plus (optional?) warning.

How to reproduce it (minimal and precise)

The bug is here -- null still is an object.

typeof(null) === "object"

Debug Info

Zigbee2mqtt version:
Adapter hardware: CC2531, CC2530, CC26X2R1 or CC1352P-2
Adapter firmware version:

Koenkk added a commit that referenced this issue Jul 27, 2020
@Koenkk
Copy link
Owner

Koenkk commented Jul 27, 2020

Fixed!

Changes will be available in the latest dev branch in a few hours (https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html)

@Koenkk Koenkk closed this as completed Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants