Using RESTful sensor with json arrays

I figured how to use the RESTful sensor integration to fill one sensor with data including attributes under it. However, there’s an API i’m using which could be quite interesting in the amount of sensors and attributes.

Is it possible to use the below JSON template to make separate sensors out of “player1”, “player2” and “player3” and make “status” their value, while the rank and title is an attribute?

I can imagine a sensor being “sensor.gameinfo.player1”, but I don’t know how to achieve that, since the ‘name’ is hardcoded in the configuration at this moment.

{
	"sensors": {
		"player1": {
			"status": "online",
			"rank": 46,
			"title": "Gold"
		},
		"player2": {
			"status": "offline",
			"rank": 22,
			"title": "Bronze"
		},
		"player3": {
			"status": "online",
			"rank": 21,
			"title": "Bronze"
		}
	}
}

You can set multiple sensor values from a single REST call with

You can extract the attributes by using a json_attributes_path like $.sensors.player1, or the values with a value_template like value_json.sensors.player1.rank

It always is easier than we think… :slight_smile:

I’ll take a look at this when I’m able, but based on what you say I think this should work.

As an addition: I couldn’t find an option to hand over a custom “icon” through the rest sensor for the dashboard, is that not supported?