Hi all,
New to Home Assistant so I might be asking the wrong question here but I’m wondering if there’s a way to create custom attributes from within my custom integration?
Context
I am building a custom integration to fetch some gas/electricity data from an external API and import it into HASS to be displayed within the Energy Dashboard. As part of my initialization of the sensors, I first fetch historic data and use the statistics API to import it (this seems to work fine) but the issue is that I need to keep track of a ‘sum’ value as my data comes in 30 minute chunks with the value of energy used in that 30 minutes (rather than the total used).
Therefore I need a way to persist the sum value as well as a Boolean value to ensure that the fetching of historic data doesn’t happen each time hass is restarted.
I tried using the RESTful api to add custom attributes to my entity but it doesn’t seem to work (the requests gets posted, but the custom attributes never show up?)
Any help would be appreciated,
Thanks in advance