Hi,
I’m having trouble creating my rest sensors.
This what I have so far and it seems to work:
rest:
- resource: http://192.168.1.200:8266/api/v2/get-nodes
scan_interval: 60
sensor:
- name: "Tdarr_Node_1"
value_template: "OK"
json_attributes_path: "$.NfpRMAU27"
json_attributes:
- "_id"
- "nodeName"
- name: "Tdarr_Node_2"
value_template: "OK"
json_attributes_path: "$.Y21O0p9bK"
json_attributes:
- "_id"
- "nodeName"
And this is how the JSON looks like:
{
"NfpRMAU27": {
"_id": "NfpRMAU27",
"nodeName": "CTNTower",
"remoteAddress": "::ffff:172.17.0.1",
"config": {
"nodeID": "NfpRMAU27",
"nodeName": "CTNTower",
"serverIP": "192.168.1.200",
"serverPort": "8266",
"handbrakePath": "",
"ffmpegPath": "",
"mkvpropeditPath": "",
"pathTranslators": [
{
"server": "",
"node": ""
}
],
},
},
"Y21O0p9bK": {
"_id": "Y21O0p9bK",
"nodeName": "VM_Tower",
"remoteAddress": "::ffff:192.168.1.210",
"config": {
"nodeID": "Y21O0p9bK",
"nodeName": "VM_Tower",
"serverIP": "192.168.1.200",
"serverPort": "8266",
"handbrakePath": "",
"ffmpegPath": "",
"mkvpropeditPath": "",
"pathTranslators": [
{
"server": "",
"node": ""
}
],
},
}
}
My problem is that NfpRMAU27
& Y21O0p9bK
are not constant. Every time that the resource gets restarted, those keys will change. The nodeName will remain constant, but I need the key/_id in order to perform further actions with them. As you can see I have hard coded them in for now, but that’s not the proper long term solution.
So how can I make this work?