hkayann / node-red-contrib-ble-sense

Node-RED module for Bluetooth Low Energy (BLE) devices.
MIT License
6 stars 4 forks source link

output as msg.payload #1

Closed bakman2 closed 3 years ago

bakman2 commented 3 years ago

Nice node, thanks.

Why is the message output send as msg from the scanner ? There is no way to handle this output without first changing it to msg.payload first.

hkayann commented 3 years ago

Can you elaborate "There is no way to handle this output" a little bit? msg.payload is just a property of msg object. What are you not able to do without it?

bakman2 commented 3 years ago

Node-red assumes msg.payload with all nodes, ie debug, switch, change. If you try to feed the scanner through a switch node, you cannot filter, because there is no payload, only msg

hkayann commented 3 years ago

Now, after having a deeper look, I also think that, it will be more convenient to output as payload. I will update it in a way that you requested. Expect a new release in 10 days.

bakman2 commented 3 years ago

Thanks, thats ok, I can submit a pull request with the changes.

hkayann commented 3 years ago

Yes please. Thanks.

hkayann commented 3 years ago

Accepted the pull request, hence closing this issue.

dingausmwald commented 2 years ago

Maybe its me, but i still can't use the switch node on this. It works when i put the output of the scanner node in an inject node though (setting the msg.payload in front and removing the payload from the scanner output. The only difference i can see is that the _msgid is behind the payload, not in front of it. Tested the whole day. From my little experience it should be as easy as copying the path of the value, insert it in the switch node property and copy the value, set it to number and set it to ==. I've set the scanner to local name "Flower Care"...

[{"id":"32e01b5f817554e9","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"d640ec7cbdad246f","type":"inject","z":"32e01b5f817554e9","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start","x":110,"y":140,"wires":[["76287e9840f8eca3"]]},{"id":"76287e9840f8eca3","type":"BLE Scanner","z":"32e01b5f817554e9","name":"BLE Scanner","searchFor":"Flower Care","searchForType":"Name","output":"Peripheral","outputType":"Output","x":290,"y":180,"wires":[["2451858b5e8c7efc","4b10c2d0d2cd6b4b"]]},{"id":"2451858b5e8c7efc","type":"debug","z":"32e01b5f817554e9","name":"test1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":160,"wires":[]},{"id":"4b10c2d0d2cd6b4b","type":"switch","z":"32e01b5f817554e9","name":"","property":"payload.advertisement.serviceData[0].data[12]","propertyType":"msg","rules":[{"t":"eq","v":"8","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":240,"wires":[["1fa8485c3345b54e"]]},{"id":"1fa8485c3345b54e","type":"debug","z":"32e01b5f817554e9","name":"test2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":240,"wires":[]},{"id":"fa973eb206d82b71","type":"inject","z":"32e01b5f817554e9","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stop","x":110,"y":220,"wires":[["76287e9840f8eca3"]]}]

hkayann commented 2 years ago

Hi @dingausmwald, can you very simply explain what you are trying to achieve in another issue please?

dingausmwald commented 2 years ago

sry im just stupid. The buffer value was the problem

hkayann commented 2 years ago

We all do mistakes, I am glad you figured it out.