Hi,
I want to extract certain information from an array
I get the connection data of my devices from
node-red-contrib-unifi / ClientDevices
This connection data is send in an array.
I use node-red-contrib-splitter to split the array, no I have about 26 array elements.
Here is an example of 2 array elements.
"_msgid": "6b6a97a1.12b788",
"payload": [
{
"site_id": "some_data",
"assoc_time": 1597038040,
"latest_assoc_time": 1597524359,
"oui": "Logitech",
"user_id": "some_data",
"_id": "some_data",
"mac": "some_data",
"is_guest": false,
"first_seen": some_data,
"last_seen": some_data,
"is_wired": false,
"hostname": "HarmonyHub",
"use_fixedip": true,
"network_id": "some_data",
"fixed_ip": "192.168.0.153",
"noted": false,
},
{
"is_guest": false,
"first_seen": 1562066511,
"last_seen": 1597569302,
"is_wired": true,
"use_fixedip": true,
"network_id": "some_data",
"fixed_ip": "192.168.0.8",
"noted": true,
"usergroup_id": "some_data",
"name": "Homeseer",
"fingerprint_override": true,
}
]
}
Now I want to check the array elemnt and see if "is_wired": true
If this is true then I want to get the value of "hostname": "HarmonyHub"
And copy this in a new array. I want to check this for al array elements.
So I get an array output of al hostnames connected with is_wired : false
Something like :
"payload": [
{"HarmonyHub" , “iphone” , “android phone” , “google home” }
If I have a list of al devices connected with the wifi. I want to send the to
node-red-node-ui-list
to create a list of all devices on the Node-red dashboard.
Now my question how do I extract the correct data from the array using the function node.