Novice struggling,,

Please help when using the node-red-contrib-xiaomi-ble node i am failing to pass it an address property correctly.

I am not a programmer only a user and a tinkerer..

I have been up all night with this, and cannot see trees for the wood in front of me. The project github page has no issues raised like this and the node is in use.. what am i missing?

I started trying using it like earlier versions i use and pass the address as the only payload. - NO
I then moved on to other things which led to the flow below, I could use a node dedicated to each sensor i have a flow tab that works that way but that approach is clunky and less suitable to avoiding scheduling conflicts with a queue.

Below is a list of the messages passed to the node which it ignores? OR that i have improperly formatted ?


10/03/2020, 10:17:18node: 374e1741.d34388
Readings/Mija/1 : msg.payload : Object
object
address: "4c:65:a8:d9:9e:64"
scan: 55
10/03/2020, 10:18:18node: 374e1741.d34388
Readings/Mija/2 : msg.payload : Object
{ address: "4c:65:a8:d0:40:7c", scan: 55 }
10/03/2020, 10:19:18node: 374e1741.d34388
Readings/Miflora/1 : msg.payload : Object
{ address: "C4:7C:8D:64:43:f5", scan: 55 }

here is the flow from which it was generated. Please overlook the excessive redundant fix nodes..

[{"id":"a743539a.94026","type":"inject","z":"b146f0c4.c13a9","name":"trigger","topic":"control","payload":"trigger","payloadType":"str","repeat":"60","crontab":"","once":true,"onceDelay":"5","x":160,"y":40,"wires":[["9cc265c1.95b718"]]},{"id":"f5d0c092.3b895","type":"inject","z":"b146f0c4.c13a9","name":"Mija1 Inject","topic":"Readings/Mija/1","payload":"{\"address\":\"4c:65:a8:d9:9e:64\",\"scan\":55}","payloadType":"json","repeat":"300","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":100,"wires":[["9cc265c1.95b718"]]},{"id":"217e9b0.9813c66","type":"inject","z":"b146f0c4.c13a9","name":"Mija2 Inject","topic":"Readings/Mija/2","payload":"{\"address\":\"4c:65:a8:d0:40:7c\",\"scan\":55}","payloadType":"json","repeat":"300","crontab":"","once":true,"onceDelay":"60","x":150,"y":140,"wires":[["9cc265c1.95b718"]]},{"id":"bbcaa098.6019e","type":"inject","z":"b146f0c4.c13a9","name":"Miflora1 Inject","topic":"Readings/Miflora/1","payload":"{\"address\":\"C4:7C:8D:64:43:f5\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"120","x":140,"y":200,"wires":[["9cc265c1.95b718"]]},{"id":"7a861b87.3b96c4","type":"inject","z":"b146f0c4.c13a9","name":"Miflora2 Inject","topic":"Readings/Miflora/2","payload":"{\"address\":\"C4:7C:8D:61:FF:7F\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"180","x":140,"y":240,"wires":[["9cc265c1.95b718"]]},{"id":"7dcb0d79.91e2a4","type":"inject","z":"b146f0c4.c13a9","name":"Miflora3 Inject","topic":"Readings/Miflora/3","payload":"{\"address\":\"C4:7C:8D:64:43:C8\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"240","x":140,"y":280,"wires":[["9cc265c1.95b718"]]},{"id":"ecd7fdd7.48f92","type":"inject","z":"b146f0c4.c13a9","name":"Miflora4 Inject","topic":"Readings/Miflora/4","payload":"{\"address\":\"C4:7C:8D:64:47:a7\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"300","x":140,"y":320,"wires":[["9cc265c1.95b718"]]},{"id":"cbaff3c.3fd341","type":"inject","z":"b146f0c4.c13a9","name":"Miflora5 Inject","topic":"Readings/Miflora/5","payload":"{\"address\":\"C4:7C:8D:64:43:AE\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"360","x":140,"y":360,"wires":[["9cc265c1.95b718"]]},{"id":"9a4af4f4.b4c158","type":"inject","z":"b146f0c4.c13a9","name":"Miflora6 Inject","topic":"Readings/Miflora/6","payload":"{\"address\":\"C4:7C:8D:64:43:61\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"420","x":140,"y":400,"wires":[["9cc265c1.95b718"]]},{"id":"219dbb6f.ba5a34","type":"inject","z":"b146f0c4.c13a9","name":"Miflora7 Inject","topic":"Readings/Miflora/7","payload":"{\"address\":\"C4:7C:8D:62:10:AD\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"480","x":140,"y":440,"wires":[["9cc265c1.95b718"]]},{"id":"f7b74698.c8f278","type":"inject","z":"b146f0c4.c13a9","name":"Miflora8 Inject","topic":"Readings/Miflora/8","payload":"{\"address\":\"C4:7C:8D:62:07:01\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"540","x":140,"y":480,"wires":[["9cc265c1.95b718"]]},{"id":"882c26bc.853498","type":"inject","z":"b146f0c4.c13a9","name":"Miflora9 Inject","topic":"Readings/Miflora/9","payload":"{\"address\":\"C4:7C:8D:64:43:6F\",\"scan\":55}","payloadType":"json","repeat":"900","crontab":"","once":true,"onceDelay":"600","x":140,"y":520,"wires":[["9cc265c1.95b718"]]},{"id":"9cc265c1.95b718","type":"q-gate","z":"b146f0c4.c13a9","name":"BLE Sensor Query Queue","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","maxQueueLength":"100","keepNewest":true,"qToggle":false,"persist":false,"x":390,"y":520,"wires":[["85caa1b8.c4463"]]},{"id":"85caa1b8.c4463","type":"change","z":"b146f0c4.c13a9","name":"","rules":[{"t":"set","p":"SendTopic","pt":"flow","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":620,"wires":[["3593708f.327f4","374e1741.d34388"]]},{"id":"3593708f.327f4","type":"Xiaomi BLE","z":"b146f0c4.c13a9","name":"BLE Query","address":"","scanningTimeout":"11","x":450,"y":600,"wires":[["bb26e9f3.525d68"]]},{"id":"bb26e9f3.525d68","type":"function","z":"b146f0c4.c13a9","name":"AddBack Topic","func":"msg.topic = flow.get('SendTopic')||'Readings/Miflora/X';\nreturn msg;","outputs":1,"noerr":0,"x":580,"y":620,"wires":[["7571b1f8.136e","c1c9378a.793968"]]},{"id":"7571b1f8.136e","type":"mqtt out","z":"b146f0c4.c13a9","name":"BLE Publish","topic":"","qos":"","retain":"","broker":"46c274c7.0d85dc","x":710,"y":480,"wires":[]},{"id":"374e1741.d34388","type":"debug","z":"b146f0c4.c13a9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":380,"wires":[]},{"id":"46c274c7.0d85dc","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Thanks in advance for any and all help

I tried installing that node but ran into a whole bunch of errors, might be because I'm on MacOs. :frowning: Anyways, in your flow there is also a 'q-gate' node that does/might do something with your payload before you hand it off to the xiaomi-ble node, what is that??

Also, I think you either specify an address or you tell it to scan. And by looking at the code it seems that last one is a boolean. So a payload of ("address" : "something:somthing") or {"scan" : true} seems valid, have you tried that ?

Thanks for taking the time to look.

the Q-gate is just a damn to avoid conflicting query requests, and makes no change to the topic/payload structure of the message..

Yes I have tried passing only an address property, and whoops i did mistake the meaning of the scan parameter as in the gui its a number representing the scan timeout. but isnt any positive number going to evaluate to true with false being 0 ?? but my javascript is limited to what i can google
but give me 2...

{ address: "C4:7C:8D:64:43:AE", iscan: true }

Naw. nothing.. worth a shot tho..

for now i have gone steam punk and node overload with at least 20x additional nodes to take the dedicated node for each ble sensor approach, its working and logging data to mariadb and sqlite

whoops just noticed the typo 'iscan'.. just reran the test flow with the edit and exactly the same result - a red node 'flag' with the message "address not specified"
i have a good excuse for typo's - cataracts..

fwiw {"scan":true} and false both resulted in the usual no impact/failure..
I had not tried them so...

Also are you sure the node is working properly? No error messages in the logs?

Yes, a value of above 0 would be 'truthy' but depending on the implementation it may or may not be regarded as true :face_with_raised_eyebrow: Anyway,. It's a shortcoming in this nodes docs (unless something is mentioned online but I could not find anything) Have you checked the issues on the nodes GitHub pages? Maybe there's more info there.

Thanks again for the input But Yes I checked github for issues first of all. I fully expected to be the weakest link in this particular chain.
but not finding anything in open or closed issues i assumed it was me..

Using 11x ble nodes dedicated to individual sensor devices i have got a regular logging schedule set up with 2 x sensors polling every 5 minutes and the remaining 9x every 15 with a q-gate handling any queues that form and providing a steady regular supply of messages to stimulate sensor queries.

I have clicked up a queue of 15x messages which cleared over 1/2 an hour..

and have debugged most of my diy gotcha's

Not as elegant as a single 'programmable' ble node, and the flow fills a full screen but is now working and logging at least..

adding a sensor will involve adding 3 nodes and editing 2x function nodes.. against adding a single injection node in my original concept. ho-hum..

Cool. Well the important thing is that it works. Optimizing it if needed is the next step. :+1:

The address SHOULD be a property of the MESSAGE not the payload.

My mistake was to consider the payload The message! while the message is the total communication DOH!!

I will be clear on that distinction from now on at least :wink: And i have managed to use the fnode as intended too ..

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.