martinarva / dynamic_energy_cost

35 stars 9 forks source link

After update to 0.4.2 (from 0.4.1) new sensors are created (Old values are gone) #28

Closed MrRamsus closed 5 days ago

MrRamsus commented 1 month ago

Describe the bug I had a working 0.4.1 version with my sensors filled with data. After upgrading to 0.4.2 (via HACS), there are new sensors created and all data are gone (unavailable).

Old sensors:

New sensors:

In the entity (Car Charger) has nothing changed after the update.

Expected behavior A clear and concise description of what you expected to happen. After the update, that the filled in data will be there.

Screenshots If applicable, add screenshots to help explain your problem. Integration: image

Sensor states: (The unavailable ones are the old ones) image

dunxd commented 1 month ago

I have something similar, except the new entities have _2 appended to the name.

martinarva commented 1 month ago

@JannikL87, coud this be because of your pull request https://github.com/martinarva/dynamic_energy_cost/pull/25?

martinarva commented 1 month ago

Looks like this commit https://github.com/martinarva/dynamic_energy_cost/commit/59a2b2fee037a22e1e63214783874f09e0ad1c59

Changed the logic so you can use same sensor for multiple prices. Unfortunately this means it will make new uniqe ID-s for all sensors.

it's a breaking change and you lose the history

JannikL87 commented 1 month ago

Hmm unfortunately yes. That's true. However you can fix this by removing the old entities and renaming the new ones (_2) to the value of the old ones. This way history remains.

martinarva commented 1 month ago

Hmm unfortunately yes. That's true. However you can fix this by removing the old entities and renaming the new ones (_2) to the value of the old ones. This way history remains.

But will the integration make new sensors again after restart?

JannikL87 commented 1 month ago

No, it's a one time manual thing (which I forgot about, apologies). So either we revert the commit, find a way to do the migration automatically, or have the users do it manually:

old: entity_some_sensor_id -> remove new: entity_some_sensor_id_2 -> rename to entity_some_sensor_id done

On Tue, 28 May 2024 at 11:31, martinarva @.***> wrote:

Hmm unfortunately yes. That's true. However you can fix this by removing the old entities and renaming the new ones (_2) to the value of the old ones. This way history remains.

But will the integration make new sensors again after restart?

— Reply to this email directly, view it on GitHub https://github.com/martinarva/dynamic_energy_cost/issues/28#issuecomment-2134760173, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIXDPB3LORXLKATOWNYCRZDZERFHLAVCNFSM6AAAAABIMNBHE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUG43DAMJXGM . You are receiving this because you were mentioned.Message ID: @.***>

MrRamsus commented 1 month ago

@JannikL87,

The solution works for me. I've removed the following entities:

Renamed the following from --> To:

The old data is back. Thanks for the support. For me its solved, but I don't know if this bugreport needs to be opened, because you will automate this step by yourself?

JannikL87 commented 1 month ago

Unfortunately I am not a Python developer, I understood the minimum to make this change, however doing any more logic like this I would like to leave to someone (more) experienced :-)

martinarva commented 5 days ago

Closing this issue