What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Problem with parsing "Custom REST Sensor" Json

Votes:

0

Your Vote:

Up

Down

Dear all, i have the problem that i get always this error if i try to parse a Template for my Sensor:

"unexpected Float while scanning object end expected "," or "}"."

TEMPLATE:

{
	"prtg": {
		"result": [
			{
				"channel": "WiFi RSSI",
				"CustomUnit": "dB",
				"Mode": "Absolute",
				"Value": $.wifi_sta.rssi
			},
			{
				"channel": "Aktueller Stromverbrauch Relay 0",
				"CustomUnit": "Watt",
				"Mode": "Absolute",
				"Value": $.meters.0.power
			},
			{
				"channel": "Aktueller Stromverbrauch Relay 1",
				"CustomUnit": "Watt",
				"Mode": "Absolute",
				"Value": $.meters.1.power
			},
			{
				"channel": "Shelly Temperatur",
				"CustomUnit": "°C",
				"Mode": "Absolute",
				"Value": $.tmp.tC
			}
		]
	}
}

INPUT DATA:

{
	"wifi_sta": {
		"connected": true,
		"ssid": "Fritzbox",
		"ip": "192.168.1.x",
		"rssi": -80
	},
	"cloud": {
		"enabled": true,
		"connected": true
	},
	"mqtt": {
		"connected": false
	},
	"time": "12:51",
	"unixtime": 1610365873,
	"serial": 20100,
	"has_update": false,
	"mac": "C82B9610F7CA",
	"cfg_changed_cnt": 2,
	"actions_stats": {
		"skipped": 0
	},
	"rollers": [
		{
			"state": "stop",
			"source": "input",
			"power": 0.0,
			"is_valid": true,
			"safety_switch": false,
			"overtemperature": false,
			"stop_reason": "normal",
			"last_direction": "open",
			"current_pos": 101,
			"calibrating": false,
			"positioning": true
		}
	],
	"meters": [
		{
			"power": 0.0,
			"overpower": 0.0,
			"is_valid": true,
			"timestamp": 1610369473,
			"counters": [
				0.0,
				0.0,
				0.0
			],
			"total": 1023
		},
		{
			"power": 0.0,
			"overpower": 0.0,
			"is_valid": true,
			"timestamp": 1610369473,
			"counters": [
				0.0,
				0.0,
				0.0
			],
			"total": 891
		}
	],
	"inputs": [
		{
			"input": 0,
			"event": "",
			"event_cnt": 0
		},
		{
			"input": 1,
			"event": "",
			"event_cnt": 0
		}
	],
	"temperature": 21.99,
	"overtemperature": false,
	"tmp": {
		"tC": 21.99,
		"tF": 71.58,
		"is_valid": true
	},
	"temperature_status": "Normal",
	"update": {
		"status": "idle",
		"has_update": false,
		"new_version": "20201228-092242/[email protected]",
		"old_version": "20201228-092242/[email protected]"
	},
	"ram_total": 49360,
	"ram_free": 34088,
	"fs_size": 233681,
	"fs_free": 121986,
	"voltage": 231.74,
	"uptime": 1194720
}

Can somebody give me some Hint, what iam doing wrong?

Thank you very much!

json rest sensor

Created on Jan 13, 2021 12:31:20 PM by  StefanM (0) 1

Last change on Jan 13, 2021 3:02:30 PM by  Florian Lesage [Paessler Support]



1 Reply

Votes:

0

Your Vote:

Up

Down

I found it at the moment... Correct Syntax of child elements is "power[0]" not "power.0."

Thank you! ;-)

Created on Jan 13, 2021 1:04:16 PM by  StefanM (0) 1



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.