I would like to have a sensor that stores a list of information that can be displayed in the UI.
My idea right now is to store the information as a JSON object containing a list of items.
But all information I can find about that has to do with initially calling a REST API and fetching the data from there. That’s not what I want. I want an object that initially is empty and then just let HA add more items and remove items during runtime. Not calling any POST or PUT, just store it internally in HA (as a ?sensor?)
It doesn’t need to be a JSON object where the list is stored but it looks like HA has a very nice support for handling such data and rendering it in the UI.
Any ideas how I should declare this storage of list data?
The general principle is demonstrated by the following example:
It’s a Trigger-based Template Sensor that employ custom events to add/delete items from a dictionary stored in one of its attributes. If you don’t want a dictionary, you can change it to a list. Either way, the data can be retrieved, using the state_attr() function, for use or display elsewhere.
Thank you so much!
I got more than I asked for because a custom notification handler was the purpose of my list
Now I just have to add some extra properties such as buttons, severity-level, etc to fulfill my needs.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.