Zwavejs2mqtt: [bug] Do not start ZJS Server before the `driver ready` event

Created on 17 Feb 2021  路  4Comments  路  Source: zwave-js/zwavejs2mqtt

Version

Build/Run method

  • [x] Docker
  • [x] PKG
  • [x] Manually built (git clone - npm install - npm run build )

zwavejs2mqtt version: 1.1.1
zwavejs version: 6.4.0

Describe the bug

Z-Wave JS 2 MQTT will start the Z-Wave JS Server before the Driver object has emitted the driver ready event. This is causing bad information to be sent by Z-Wave JS Server. This is not supported.

Related bugs:

https://github.com/home-assistant/core/issues/46180#issuecomment-775125292

https://github.com/home-assistant/core/issues/46279

https://github.com/home-assistant-libs/zwave-js-server-python/issues/102

Bugs are closed because we now handle it from a Python side correctly if we receive bad data. Better would be if we didn't had the error to begin with.

CC @MartinHjelmare

To Reproduce

Steps to reproduce the behavior:

  1. Set up Home Assistant to connect to ZJS2MQTT via the ZJS Server
  2. Restart ZJS2MQTT

Expected behavior

The WS server should not come up until the driver is ready to serve data.

bug

All 4 comments

An alternative could be that we update Server.start to not start the server until the driver is ready. However that seems weird because start then doesn't automatically start.

I have a draft PR to update Server.start() to raise if the driver is not ready. That would help make it clear we're not ready to serve yet. Won't merge that until this issue has been resolved.

Let me fix this :)

Thanks!

@zwavejs/server 1.0.0-beta.7 will now raise if the driver is not ready when the server starts.

Was this page helpful?
0 / 5 - 0 ratings