Hello!
I’m attempting to improve upon an already existing integration, and I’m wondering if what I’m experiencing is expected functionality, or whether it would constitute an issue being opened.
Reproduction Steps (based on what I’m doing):
- A sensor that can watch for changes within different attributes of a platform, for example, How many listings are available, the lowest/highest current price, or a Quality Indicator is created.
To give a brief overview of what that looks like in config:
sensor:
- platform: discogs
token: !secret discog_token
marketplace:
- id: 5187464
sort_by: {"price" | "price_asc" | "quality" | "newest"}
limit: 15
- When the
sort_by
isprice
orprice_asc
, thenative_unit_of_measurement
should be thecurrency
, which is stored within theextra_state_attributes
, otherwise, it is a different string.
However, if I change that value within the configuration.yaml
, it doesn’t update the native_unit_of_measurement
to the new value on the entity’s graph. The state, however, works as expected, and matches the correct value scheme. It shows on the same graph, with the incorrect measurement on the side.
The problem seems to be the fact that it doesn’t seem to use the correct row in the states
table of the home-assistant.db
for the most recent value. When the DB is purged of the other values, it does update to the correct value on the UI.
Is there somewhere that I should update this value for when it’s changed with configuration.yaml
other than setup_platform
, or a way to purge that entity’s history on restart if the type were to change?