My sensor value is not updating, but API data is

I am working on a integration for the Smart #1/#3 EVs its available on HACS. GitHub - DasBasti/SmartHashtag: Homeassistant component for Smart #1/#3 API

I have the issue, that some sensor values do not update in the system. I have a logger line in the sensor “native_value” line that shows me that the value is actually updated from the API. But the sensor in the front-end and in the recorder is not updated and stays the same value. If I restart the integration the sensor value is updated to the current value provided by the API but no updates after that.

What might cause something like this? I have no idea where to look for this issue.

Looking at some of your sensor classes it could be that you are only referencing the sensor value at initialisation.

Ie in sensors that inherit SmartHashtagSensor, you set data from the coordinator at init but then use that data var on each update, instead of getting it from the coordinator again.

When you set self.data to a value from the coordinator at init, unless you update self.data on entity update, your value will always be the same.

Let me know if that makes sense or needs a better explanaition for you.