Hello, i need to create a sensor that make a get command on a PLC that answer is in Json format, i've tried the REST Custom sensor with a custom template based on the data i need to "read" from the Json, and it's like this:
{ "prtg": { "result": [ { "channel": "allarme_fumo" , "value": 0 }, { "channel": "porta_aperta" , "value": 0 }, { "channel": "allarme_temperatura_prima_soglia", "value": 0 }, { "channel": "allarme_temperatura_seconda_soglia", "value": 0
The Json response is be like this:
{"allarme_fumo":0,"porta_aperta":1,"allarme_temperatura_prima_soglia":0,"allarme_temperatura_seconda_soglia":0,
My problem is PRTG sensor not read the Json result but read the template result, so if the Json have 1 in the response PRTG sensor remain at 0.
how can i write on the template that prtg must go to read the value from the Json?
Article Comments
Hello,
please use the Rest Custom v2 sensor for this. You can create a JSON path with online tools like this one.
Feb, 2023 - Permalink
i tried the Rest custom V2 but, from what I understood, with this sensor i have to configure manually all channel and the limit is 10 channels. In my json i have 50 channels to monitoring. So i tried to create a sensor with V2 but i receive this message "Unparseable value in channel 1. The queried field "x.allarme_temperatura_prima_soglia" is empty." the JSON path is x.allarme_temperatura_prima_soglia
Feb, 2023 - Permalink
Thank you it's working, i tested also with the template and it's working Thnaks
Feb, 2023 - Permalink
Hello,
do you read that JSON with a custom script, or with the Rest Custom sensor?
Feb, 2023 - Permalink