Hi everyone,
Ill admit I’m pretty amateur with coding and such, and am having a hard time figuring something out. Most of what I’ve got so far is thanks to chatGpt (lol) and trial and error.
Basically I want to use the API from a site which returns a JSON response that is essentially 2 main items, a status value showing successful request, and the second item is an array of contact list entries. The response looks like this:
{“status”:“success”,“phonebooks”:[{“phonebook”:“1237455”,“speed_dial”:“”,“name”:“John Doe”,“number”:“5551234567”,“callerid”:“”,“note”:“Test entry”,“group”:“0”,“group_name”:“”},{“phonebook”:“1237456”,“speed_dial”:“”,“name”:“John Doe2”,“number”:“5551234567”,“callerid”:“”,“note”:“Test entry”,“group”:“0”,“group_name”:“”},{“phonebook”:“1237640”,“speed_dial”:“”,“name”:“Jonnyscript”,“number”:“555123456”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”},{“phonebook”:“1237659”,“speed_dial”:“”,“name”:“Jonnyscripttes2”,“number”:“555123457”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”},{“phonebook”:“1236206”,“speed_dial”:“*7501”,“name”:“Test addtl contact entry”,“number”:“6476015230”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”},{“phonebook”:“1237631”,“speed_dial”:“*7562”,“name”:“Joey4”,“number”:“5551234567”,“callerid”:“”,“note”:“Test entry”,“group”:“0”,“group_name”:“”},{“phonebook”:“1237632”,“speed_dial”:“*7563”,“name”:“Joey5”,“number”:“5551234567”,“callerid”:“”,“note”:“Test entry”,“group”:“0”,“group_name”:“”},{“phonebook”:“1235981”,“speed_dial”:“*7597”,“name”:“Test Auto Entry Reocrding”,“number”:“6476015230”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”},{“phonebook”:“1234298”,“speed_dial”:“*7598”,“name”:“test8”,“number”:“5555555”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”},{“phonebook”:“1233925”,“speed_dial”:“*7599”,“name”:“Me”,“number”:“555555”,“callerid”:“”,“note”:“”,“group”:“0”,“group_name”:“”}]}
Which I pretty much understand, each item in the array is an entry, with its own sub entries of Id, name number etc.
At this point I have a rest sensor set up in my config that works by doing value_template(value_JSON: status)
Which makes the sensor value ‘Success’
And then has json_attributes: -phonebooks
Which seems to return the contact list entries in a more readable format like this:
So far so good I think. The thing I can’t figure out now is how to take those entries and values, and basically work with them in HA. I want to make a sort of display on a dashboard that will list each entry and its associated data.
Is there an efficient way I could do this, sorry I’ve had no luck so far.
Should I have pulled the data a different way?