How to handle no message?

Im using the node-red-contrib-xiaomi-ble node which is fantastic,

But there are circumstances where it fails to poll/capture any data.

Sometimes this is due to an error that i can catch and retry using a catch node and a function to determine the contents and rebuild the polling message if relevant.

However it also simply fails to capture data, when this happens the node in the design window flashes (no data with a red tag - similar to email send tags) sorry if im using the wrong nomenclature here. but the result is no message out from the node, the data flow stops there.

Can I catch the no-data event flagged by the xiaomi node that precedes the halt of the flow so i can retry the poll?

Cheers

Does this just cause a gap in your data or do you get a hard stop of the flow?

it just stops, no message is issued by the ble node when it fails to collect data without raising an exception.

ive tried a few combinations of logc nodes trying to construct an AND with a DELAY feeding so unless i get the delay msg AND a ble message retry the ble poll but i am burying myself

If it's updating status (the indicator under the node) then you can use the Status node to grab that.

Off to check that now, Cheers ..
seems like the Xiaomi node issues 3 status messages when a successful poll is conducted, not managed to stimulate a no data circumstance just yet but have a path to follow now Many many thanks,,

After a few(LOT) of injecting and debug deleting cycles, i have finally managed to capture the status messages captured by the status node for the 3 conditions i am currently aware of.

a successful poll and return of sensor data generates a set of 3 status messages,
A 'Searching' message, A Requesting message, and an ?Empty message object

14/09/2018, 18:56:36node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "searching"
source: object
_msgid: "d9215ae5.3ee988"
14/09/2018, 18:56:37node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "requesting"
source: object
_msgid: "9e8b4bb4.046908"
14/09/2018, 18:56:39node: 475d94e3.b38bbc
msg : Object
object
status: object
text: ""
source: object
_msgid: "fe4b5f36.e7b41"

The no-data condition returns the same two Seraching and requesting status messages follwed by a no data message

14/09/2018, 18:51:36node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "searching"
source: object
_msgid: "ef733ba0.2970d8"
14/09/2018, 18:51:36node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "requesting"
source: object
_msgid: "324eca40.62a086"
14/09/2018, 18:51:38node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "no data"
source: object
_msgid: "78d99f8d.6dc3a"

and finally the known error condition that arises already trapped by a catch node
Two status messages, a Searching and a Not found

14/09/2018, 18:53:44node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "searching"
source: object
_msgid: "3359f79.f784408"
14/09/2018, 18:54:44node: 475d94e3.b38bbc
msg : Object
object
status: object
text: "not found"
source: object
_msgid: "9f2ab15b.dd26a"
14/09/2018, 18:54:44node: Miflora
msg : string[439]
"Device C4:7C:8D:62:10:AD not found among [14:bb:6e:33:39:11,40:b8:9a:7c:b9:5c,10:fe:33:05:e9:7a,c4:7c:8d:64:43:f5,24:4b:03:f4:21:ad,13:06:63:41:dd:51,f8:77:b8:b2:de:4c,2c:41:a1:ac:b2:6b,c4:7c:8d:64:43:ae,2c:41:a1:ac:a1:19,c4:7c:8d:62:07:01,c4:7c:8d:61:ff:7f,c4:7c:8d:64:43:c8,c4:7c:8d:64:47:a7,c4:7c:8d:62:10:ad,c4:7c:8d:64:43:61,4c:65:a8:d0:40:7c,c4:7c:8d:64:43:6f,6e:3b:c0:a5:96:8b,32:33:05:9e:22:7d,c7:19:a7:8e:ec:1c,fe:94:df:2a:21:7f]"

The error is wrong however as the address not found is embedded in the list ?
Since i an polling only 7 different mac addresses that list seems a little long?

Anyway I have something to be getting on with now..

Ha, In order to perhaps avoid the error condition i changed all the injected mac addresses to use lowercase letters as displayed in the error message list.

The result of this is Xiaomi-ble node no longer issues a 'Searching' status and simply jumps straight to a 'Requesting' status,

now i had better confirm the no-data condition also conforms to the new 'correctly addressed?' requests..

I had a moment of inspiration and created the following subflow of 2 nodes hanging of a status node dedicated to the BLE node to retry if a poll of a sensor fails, all well and good..

[{"id":"ced8af2a.93103","type":"status","z":"6985a570.16355c","name":"Miflora Node Status","scope":["4a0c1ada.67cbc4"],"x":119,"y":89.00000953674316,"wires":[["702de5c3.28725c"]]},{"id":"702de5c3.28725c","type":"switch","z":"6985a570.16355c","name":"Failure test ","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"no data","vt":"str"},{"t":"eq","v":"not found","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":351.00008392333984,"y":173.00001335144043,"wires":[["510563fc.cd16ec","9dbd95b.0b23968"],["510563fc.cd16ec","9dbd95b.0b23968"]]},{"id":"510563fc.cd16ec","type":"change","z":"6985a570.16355c","name":"Prepare to Re-Poll","rules":[{"t":"set","p":"payload","pt":"msg","to":"mac","tot":"flow"},{"t":"set","p":"address","pt":"msg","to":"mac","tot":"flow"},{"t":"set","p":"trycount","pt":"flow","to":"$flowContext('trycount') +1","tot":"jsonata"},{"t":"set","p":"status","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":412.88677978515625,"y":255.26175117492676,"wires":[["9dbd95b.0b23968","7589b6eb.44a7e8","4a0c1ada.67cbc4"]]}]

However what if a sensor is out of range, faulty, or suffering from a very low battery?? a limit on the number of retry attempts would be wise..

so i tried to insert this node after the above nodes before the retry message is reinserted into the ble node to limit the retries, but instead it kills the flow dead??

[{"id":"7589b6eb.44a7e8","type":"switch","z":"6985a570.16355c","name":"Limit Retries","property":"trycount","propertyType":"flow","rules":[{"t":"gte","v":"3","vt":"num"}],"checkall":"true","repair":true,"outputs":1,"x":574.8906478881836,"y":304.79297065734863,"wires":[["4a0c1ada.67cbc4","9dbd95b.0b23968"]]}]

3 hours past bedtime on a school night.. please help .. what have i missed???

spotted the '<' '>' error DOH!!