You configured the sensor to store the entire payload in its state property. In other words, your sensor is not configured to create entity attributes containing any part of the payload. That’s why your template returns nothing because there’s no attribute named ConnectionCounter.
For more information about an entity’s properties, refer to State Objects.
An entity’s state property is limited to storing 255 characters. If your payload were to ever exceed that limit it will be truncated (thereby causing loss of data and corruption of its JSON structure).
An entity’s state property always stores its value as a string. It doesn’t matter if it’s actually numeric, a list, dict, etc because it will always be handled as a string.
All this to say that you will need to use the REST Sensor integration’s json_attributes option to convert the received payload into actual attributes. In addition, I recommend you use the value_template option to pick the value of one of the received keys for the state property. For example, {{ value_json.Since }} will store the time in state and then you can use json_attributes to store all others in separate attributes.
After doing all of that, your test with the state_attr() function will work.
Let me know if you need more help with json_attributes.
Many thanks for your reply, json_attributes was the missing piece of the puzzle, specifying them in the config pulled them through to be exposed via state_attr.
No, there’s only one value_template option and it applies exclusively for getting the value for the state property. If you use the suggested template, the entity’s state will simply contain the value of the Since key (2022-07-05T09:02:28.195329012Z) which is less than the 255 character limit.