Hi everybody,
I would like to fetch some information from my NAS and put this information into pimatic.
I plan to push those information from the NAS via cronjob and curl -X PATCH …
What’s the best way to do this?
- First I thought I just add 4 devices (2x HDD temp, 1x CPU usage, 1x volume usage) and them update this information via curl.
–> Here I don’t know how to do this - The probably better (?) solution might be (if possible) to add one device, and add variables to this device (hdd1,hdd2,cpu,volume) and update those variables. Here I should only have one device, which is might be clearer.
–> Again, here I don’t know if this is possible and a good way. AND I don’t know how to update them via curl
I tried to build 2, bit don’t get this working:
{
"variables": [
{
"name": "temp",
"expression": "$value",
"type": "number",
"unit": "C"
}
],
"xAttributeOptions": [],
"id": "ds211j-flur-hdd1",
"name": "DS211j_Flur_HDD1",
"class": "VariablesDevice"
},
curl -X GET --user "user:pass!" http://pimatic/api/devices/ds211j-flur-hdd1 | python -m json.tool
{
"device": {
"actions": [],
"attributes": [
{
"description": "temp",
"discrete": false,
"history": [],
"label": "$temp",
"name": "temp",
"type": "number",
"unit": "C",
"value": null
}
],
"config": {
"class": "VariablesDevice",
"id": "ds211j-flur-hdd1",
"name": "DS211j_Flur_HDD1",
"variables": [
{
"expression": "$value",
"name": "temp",
"type": "number",
"unit": "C"
}
],
"xAttributeOptions": []
},
"configDefaults": {
"variables": []
},
"id": "ds211j-flur-hdd1",
"name": "DS211j_Flur_HDD1",
"template": "device"
},
"success": true
}
If this config is already correct, how to patch this value with curl and why I don’t see something like $DS211j_Flur_HDD1.temp within the variables site?
I really appreciate your help.
Thanks in advance!