Hello, all I am trying to integrate my Minecraft server into home assistant using a plugin called “ServerTap” which hosts a rest API alongside the server. So far I have been able to successfully pull data using restful sensors for example, online players player names and server health info but I have gotten stuck for awhile on trying to pull more data. The API allows me to set a get request to “SERVER_ADDRESS/v1/players/all” and it sends back a json array of players that have ever joined the server in the format shown below.
[
{
"uuid": "string",
"whitelisted": true,
"banned": true,
"op": true,
"balance": 0,
"displayName": "string"
},
{
"uuid": "string",
"whitelisted": true,
"banned": true,
"op": true,
"balance": 0,
"displayName": "string"
}
]
I am using the template below to concatenate the values from a similar get request for the players online to form the state which I can use later.
{% for players in value_json -%}
{{ players['displayName'] }}
{%- if not loop.last %}, {% endif -%}
{%- endfor %}
The issue I am facing is that I have about 10ish players that have ever joined and when I concatenate all the names it passes the 255 character limit on the state. I figured I could put the values into the attributes but there doesn’t appear to be a way to accomplish this as the top level of the json response is an array.
looking at some other posts I have seen a few people with similar issues from a few years back that never ended up being solved or the solution won’t work for me like here: https://www.reddit.com/r/homeassistant/comments/k5chlv/handling_an_array_of_json_objects_in_a_rest_sensor/ and https://community.home-assistant.io/t/restful-sensor-parse-nested-json-to-sensor-attributes/96270.
The responses to those posts seem to infer that this is not possible. Is there any way I am missing to solve this like a way to extract attributes using templates or something similar?