I do have a couple of BLE beacon readers that sends a complicated string, like:
"{"v":1,"mid":1503,"time":2918,"ip":"10.0.0.45","mac":"E0E2E69D1984","rssi":-72,"devices":[[3,"30AD2A354CDE",-80,"02011A0BFF4C00090603050A000001"],[0,"79C0DC8ADF03",-69,"02011A020A0C0BFF4C0010061B1A570873AA"],[0,"4BB27F2178A4",-67,"02011A020A060AFF4C0010051818030BCE"],[3,"30AD2A354CDE",-70,"02011A0BFF4C00090603050A000001"],[0,"702B4665F0FD",-87,"0201020303A0FE1016A0FE03FA8FCA60AB536B2020209EFF"],[0,"6DF156655F3E",-71,"02011A020A0C0AFF4C0010050D1C5688E3"],[0,"79C0DC8ADF03",-69,"02011A020A0C0BFF4C0010061B1A570873AA"],[0,"4BB27F2178A4",-79,"02011A020A060AFF4C0010051818030BCE"],[3,"30AD2A354CDE",-67,"02011A0BFF4C00090603050A000001"],[0,"F89D695A8C1A",-73,"0201060303EDFE0D16EDFE0200684E3A8470933545"],[3,"FEBE6BCFCCD3",-67,"07FF4C0012020002"],[0,"702B4665F0FD",-87,"0201020303A0FE1016A0FE03FA8FCA60AB536B2020209EFF"],[0,"6DF156655F3E",-71,"02011A020A0C0AFF4C0010050D1C5688E3"],[3,"30AD2A354CDE",-79,"02011A0BFF4C00090603050A000001"],[0,"79C0DC8ADF03",-70,"02011A020A0C0BFF4C0010061B1A570873AA"],[0..."
The first par tof the string is not difficult. I can get that with the template-trigger to an entity.
The last part is harder. I can do
state: "{{ (trigger.payload | from_json).devices[1] }}"
But: it are a lot of items and the number of items changes every time there come new data.
I do want to know if a specific beacon is seen (so if the mac adress is in the mqtt file, that is the second item) and from two items I want to get more information (rssi value, what is the third item)
Is there a way to put the complete json file to an entity (from what I can extract the needed information) or is there another way to deal with this?