eschava / node-red-contrib-xiaomi-ble

Xiaomi Bluetooth4 (BLE) sensors
MIT License
19 stars 15 forks source link

Type error if node.peripheral is null #8

Closed borpin closed 5 years ago

borpin commented 5 years ago

I am getting a type error msg if trying to inject a msg.address value into the node.

It is because node.peripheral can be null at this point (I think).

https://github.com/eschava/node-red-contrib-xiaomi-ble/blob/e433c6c0dd99bb7cf7b5cfe018eac5f57d784e1c/xiaomi-ble.js#L143

Are the foundDevices persisted across calls to the node (not familiar enough with javascript / node-red)? If so should the scanning only be done if the device is not in the foundDevices array?

eschava commented 5 years ago

Right, the bug was added with the latest update Will fix at the nearest time

eschava commented 5 years ago

Fixed and new release published

Are the foundDevices persisted across calls to the node (not familiar enough with javascript / node-red)? If so should the scanning only be done if the device is not in the foundDevices array?

If device is found then reference to it is stored across calls. foundDevices is not stored and is used just for error message like Device 00:11:22:33:44:55 not found amoung [a, b, c]