Hi!
I’m trying to get the sensors from my alarm system to show up in home assistant, but as I just recently started using HA, I’m quite overwhelmed with the configuration options.
I found out that HA can be setup to read sensor data via a REST api that my alarm system provides. The REST JSON looks like this:
[
{
"id": "201",
"name": "ET",
"state": "closed",
"inner": false,
"omittable": false,
"omitted": false
},
{
"id": "202",
"name": "SZ1",
"state": "open",
"inner": false,
"omittable": false,
"omitted": false
},
{
"id": "203",
"name": "SZ2",
"state": "closed",
"inner": false,
"omittable": false,
"omitted": false
}
]
So it’s reporting one block for each zone (=door). for each there is a value “state” that tells me if the door is opened or closed. I would need to parse this json and get a sensor/entity (?) for each of the doors, ideally named with whatever is set in the name attribute of the json.
I managed to get HA to connect, authenticate and parse the json. but i could only make it work with json_path settings (e.g. $.[1].state) to read one state and afaik this would mean I would have to set it up in a way where it sends a rest call for each door. I thought that this might be possible using HA’s templates, but this is where I get stuck as I don’t grasp the concept of how to generate multiple sensors from the json file.
i worked through the docs and examples but did not find an example that worked in my case, so any help there would be highly appreciated.
thanks!
andreas