eschava / node-red-contrib-xiaomi-ble

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

Node Not accepting address property Pi3b Raspbian Buster #22

Closed hunnimonstr closed 4 years ago

hunnimonstr commented 4 years ago

Thank you for a useful node. Unfortunately im having problems.

I am hosting Node red on a Raspberry Pi 3B on a sandisk A1 64gb sd card Using an injection node with a payload generated with the Json editor to contain the address property. the Xiaomi-Ble-node simply reports "address not specified [{"id":"ed350590.9b2ca8","type":"inject","z":"a4bfa3cc.61328","name":"Query Prompt","topic":"AnyTopic","payload":"{\"address\":\"4c:65:a8:d0:40:7c\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["b0b9c9aa.f01ef8"]]},{"id":"b0b9c9aa.f01ef8","type":"Xiaomi BLE","z":"a4bfa3cc.61328","name":"","address":"","scanningTimeout":60,"x":390,"y":120,"wires":[["f8a2ac1f.f784d"]]},{"id":"f8a2ac1f.f784d","type":"debug","z":"a4bfa3cc.61328","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":120,"wires":[]}]

If i include a Json node to change the payload to a js object type, same result..

[{"id":"ed350590.9b2ca8","type":"inject","z":"a4bfa3cc.61328","name":"Query Prompt","topic":"AnyTopic","payload":"{\"address\":\"4c:65:a8:d0:40:7c\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["9ea47804.4a60a8"]]},{"id":"b0b9c9aa.f01ef8","type":"Xiaomi BLE","z":"a4bfa3cc.61328","name":"","address":"","scanningTimeout":60,"x":470,"y":120,"wires":[["f8a2ac1f.f784d"]]},{"id":"f8a2ac1f.f784d","type":"debug","z":"a4bfa3cc.61328","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":120,"wires":[]},{"id":"9ea47804.4a60a8","type":"json","z":"a4bfa3cc.61328","name":"","property":"payload","action":"obj","pretty":false,"x":260,"y":120,"wires":[["b0b9c9aa.f01ef8"]]}]

I have had to resort to dedicating a Xiaomi-Ble node to each sensor i wish to query ok wit 1-2x but i currently query 11x with plans to include more..

I installed node red with the curl script found on the node-red Pi instructions page onto a fresh Buster install after updating and upgrading. Mariadb, sqlite, influxDb . Mosquitto, and Grafana were also installed and set to run as servers/services along with node red.

The xiaomi-ble node was installed via the node red palette

I also installed ?reinstalled? Nobel when first experiencing the unexpected behaviour, this had no effect.

Thank you for you attention.

eschava commented 4 years ago

"address" should be a property of the message, not payload I've modified the first flow :

[{"id":"b21228c4.3ceca8","type":"inject","z":"9665c43f.7e5e38","name":"Query Prompt","topic":"AnyTopic","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":730,"wires":[["1250c0ef.77fc5f"]]},{"id":"3303c3bf.59bdec","type":"Xiaomi BLE","z":"9665c43f.7e5e38","name":"","address":"","scanningTimeout":60,"x":560,"y":730,"wires":[["b07fb263.2bb38"]]},{"id":"b07fb263.2bb38","type":"debug","z":"9665c43f.7e5e38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":730,"wires":[]},{"id":"1250c0ef.77fc5f","type":"change","z":"9665c43f.7e5e38","name":"","rules":[{"t":"set","p":"address","pt":"msg","to":"4c:65:a8:d0:40:7c","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":730,"wires":[["3303c3bf.59bdec"]]}]

hunnimonstr commented 4 years ago

Many thanks for clarifying where i went wrong.. still learning.. i was under the impression message and payload were synonymous while the payload is an aspect of the message..

Again many thanks.