enkama / hass-variables

Home Assistant variables component
89 stars 12 forks source link

Registering subattributes #94

Closed sigalou closed 9 months ago

sigalou commented 10 months ago

Hello everyone and congratulations for this integration.

I would like to use it to record the loads of my Wallbox in a sensor. I have already done this via a Python script but it would be much simpler to do it with this integration. Here is what I would like to get as a data result:

image

So I use an attribute which is "sessionscharge:" (charging sessions in English)

And each record contains 7 fields : image

I understood very well how the integration works when you want to add a record as an attribute and the "Merge" option is super practical, well done! But if I want to add a subattribute (a load session in my example), it doesn't work.

image

Thus, if the attribute does not exist, it should be added with its subattributes (this works). And if the attribute exists, when we execute this Update Sensor Variable command, the sub-attribute (new charge) is added to the "sessionscharge:" attribute in my example.

Does this exist and work but I haven't been able to implement it? Or is this a feature that can be added? It would be particularly useful for many applications.

Thank you so much

Snuffy2 commented 9 months ago

Try this...

Starting point:

2023-10-26_21-45-05 694

Service call:

2023-10-26_21-47-54 752

After Service call:

2023-10-26_21-46-40 810