PuckJS and Espruino Hub and MQTT bridge #1069
Replies: 16 comments
-
Posted at 2021-05-13 by @MaBecker Used a second Puck to verify that JSON is valid
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-13 by @MaBecker Got the solution, the config.json has After setting |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @gfwilliams Great! Yeah, I think we were trying to cut down on the 'noise' from MQTT, but that one is a bit frustrating. I've just updated the docs... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @MaBecker
Thanks |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @gfwilliams Also worth noting that you were asking about JSON5 in another post. You can do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @MaBecker Yep, I am on my way to change this whole communication by manufacturer data to JSON5. For this approach I didn't wanted to have to many changes at the same time ...... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @MaBecker During tests I realized that it can happen that
So it look's like the filters work as logic |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-14 by @allObjects Did not look at the code yet, but could imagine - from a design point of view - that putting multiple attributes in a filter object, these attributes work (hopefully?) as AND.
If this is not the case or would break backward compatibility, a simple solution for interpretation is to use nested array: arrays of ('OR') filters as array elements are AND of OR-filters: Ex: 'OR' of 'AND' filters look then like this: Ex: This evaluator has to 'look ahead' (way too far, all the way thru) to determine wether the next element is an OR or AND element (odd or even [] enclosed, and that is bad. Therefore, I hope that multiple properties in a filter work as AND (as stated in the very beginning): [ and ] 'Operators' demarcate an OR expression, { and } demarcate an AND expression, with the AND expression element has a refining, 'deep-peeling' AND ({} - nesting). Comparing this to logical expressions, notation of precedence seems inverse: in a mixed and and or logical expression, ANDs have precedence and parenthesis allow to inject ORs as AND elements. As long as nesting stays within 2 levels, the filter evaluator needs only one extra 'accumulator' / variable to hold the temporary result while calculating an inner expression. Going full nested of any depth, requires a stack... and all things become way more complicated |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-17 by @gfwilliams
That's right, yes! :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-17 by @MaBecker Thanks @allObjects and @gordon for the confirmation. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-30 by @MaBecker Did some test with two pucks, d9:c7:0b:0a:48:20 - Puck.js 4820 (RSSI -59)
Then run this simple code
Try different filter possibility
Hmm, not sure about filters any more..... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-01 by @MaBecker look's like there is no AND filter https://github.com/espruino/Espruino/blob/master/libs/bluetooth/jswrap_bluetooth.c |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-07 by @gfwilliams Hmm - there should be AND... https://github.com/espruino/Espruino/blob/master/libs/bluetooth/jswrap_bluetooth.c#L1462 So unless there's a bug, jswrap_ble_filter_device should set
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-07 by @MaBecker Hmm, let me try again, was confused about this text:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-07 by @allObjects ...is:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-10 by @MaBecker The AND filter is not working on my side. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-13 by @MaBecker
Use a Puck to advertise data and try to read them via MQTT client, but data is not visible via mqtt client.
Configuration and snipped to advertise taken from the the Espruino Hub repo page
Device: d9:c7:0b:0a:48:20 - Puck.js 4820 (RSSI -59)
snippet on for Puck.js 4820
Advertising is visible on Espruino Hub and BluefruitConnect.
Connect to the mqtt server and subscribe to
/ble/advertise/d9:c7:0b:0a:48:20/espruino
and/ble/advertise/d9:c7:0b:0a:48:20/#
. Get many payloads for the second sub but none for the first.Any hints what's missing?
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions