home-assistant-bosch-custom-component icon indicating copy to clipboard operation
home-assistant-bosch-custom-component copied to clipboard

Failed to call the bosch.move_old_statistic_data service

Open radunCZ opened this issue 2 years ago • 6 comments

Describe the bug Since I have almost year of data from my heatpump in the energy dashboard which I would like not to loose, I've tried to migrate the old statistics data as described in the release notes/docs. However, HA refuse to call the service (initiaded from the UI) and shortly shows message "Failed to call service bosch.move_old_statistic_data service. Unknown error"

I have checked the HA log and the only thing relevant to the component is message "RuntimeError: Blocking calls must be done in the executor or a separate thread;"

Expected behavior No errors, migrating the data :)

Version

  • HA version 2022.7.5 / docker
  • HA Bosch component version 0.18.1 (via HACS)

radunCZ avatar Jul 15 '22 13:07 radunCZ

Something changed in HA 2022.7 I think, I will check that

pszafer avatar Jul 15 '22 16:07 pszafer

I can't reproduce. It's working every time for me. You need to find some logs.

pszafer avatar Jul 18 '22 21:07 pszafer

I have created separate instance of HA where I have left only the BOSH integration and it's own entities to mitigate any impact of other stuff that is present in my installation. And of course the whole database with all the history I'd like to keep. [home-assistant.log]

Full HA log since it's start to my attempt to run the conversion service. (https://github.com/bosch-thermostat/home-assistant-bosch-custom-component/files/9275749/home-assistant.log)

What else I can provide? Or is there a way to keep the data using a direct DB modification?

radunCZ avatar Aug 06 '22 20:08 radunCZ

Try to use v0.18.3.

pszafer avatar Aug 06 '22 21:08 pszafer

In the meanwhile, HA was updated to 2022.8.1 and addon to 0.18.3. The result is same...

Maybe... my DB is quite big (>2.5GB), is this an issue? I'm thinking about migrating it to Postgre/MySQL, but no time yet... Can I do the BOSCH data migration manually on a DB level? With HA offline for a while.

radunCZ avatar Aug 07 '22 20:08 radunCZ

Yes, you can. It is simple update https://github.com/bosch-thermostat/home-assistant-bosch-custom-component/blob/583d79a6c65617df0cce95c3cf9df8bb354efa8f/custom_components/bosch/sensor/statistic_helper.py#L28-L45

If old entity id is sensor.recording_ractualchpower then you need to update it.

UPDATE statistics_meta 
SET
  statistic_id = 'recording:recording_ractualchpowerexternal', 
  source = 'recording', 
  name='Recording ractualCHPower'
WHERE statistic_id = 'sensor.recording_ractualchpower';

pszafer avatar Aug 07 '22 20:08 pszafer