Support future sensor state values natively

I’m trying to display dynamic electricity prices for to current and next day. Raher mainstream thing I would assume.

Data comes from a SQl database, but it could as well be a REST API.

I searched the net extensively for solutions. These all tends to centre around using the state attributes to store the data. However, In my case these are 48 values of 3-5 (eg 0.8 or -11.5) characters plus a comma separator don’t fit into the size limitation of the state attribute. (i get “unknown” instead of the values)

I don’t like the attributes solution. It seems to be misusing something that wasn’t made for the purpose (I know, it works for some but it obviously doesn’t scale).

Please implement a native solution to push future values into sensor states using the REST API.

For the record, once pushed, the electricity prices don’t change anymore. This could be different for other things like forecasts, I propose in that case to store only the last pushed values.

Worst case that is not going to fit into the 255 characters the state value supports, hence the need to use attributes.

1 Like

I have the exact same issue and have taken to pushing the values into a calendar as I get the future values. Then as each calendar period starts I have an automation that updates the price for now.
This seemed like a horrible hack at the time, but it has the side effect of keeping a history of the prices for as long as I want them.
It works fine, but seems a bit heavy handed.

Attributes are also limited to 255 characters and no, it doesn’t fit

So you agree, can you upvote the request ?

Attributes are NOT limited to 255 characters. They are limited to 16Kb and why they are the current solution of choice for storing text. My AI solution uses them extensively. It’s also how REST sensors work.

Look up trigger text sensor.

1 Like