Giter Site home page Giter Site logo

Comments (10)

bramstroker avatar bramstroker commented on July 16, 2024 1

I have released 1.12.2 btw which includes some improvements to prevent the error reported in this issue.
Hope this solves all your issues.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on July 16, 2024

That's strange. Was there any error before this? I guess there was a problem downloading the profile, there should be an error in the logs in this case. But you say you were running 1.12 already without issues, so the profile should already be there.
Could you double check mentioned directory if there is really no file there?

Also try rebooting one time.

from homeassistant-powercalc.

lancer73 avatar lancer73 commented on July 16, 2024

Still doesn't download all profiles. One was missing which I can find in the GitHub repository (Sonoff ZBMINI)

Doenloaded it by hand and rebooted and got this:

2024-05-04 20:53:00.043 ERROR (MainThread) [homeassistant.setup] Error during setup of component powercalc
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/powercalc/__init__.py", line 238, in async_setup
await discovery_manager.start_discovery()
File "/config/custom_components/powercalc/discovery.py", line 123, in start_discovery
power_profile = await self.get_power_profile(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/discovery.py", line 144, in get_power_profile
self.power_profiles[entity_id] = await get_power_profile(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/power_profile/factory.py", line 40, in get_power_profile
profile = await library.get_profile(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/power_profile/library.py", line 104, in get_profile
profile = await self.create_power_profile(model_info, custom_directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/power_profile/library.py", line 137, in create_power_profile
result = await loader.load_model(manufacturer, resolved_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/power_profile/loader/composite.py", line 32, in load_model
result = await loader.load_model(manufacturer, model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/power_profile/loader/remote.py", line 108, in load_model
json_data = json.load(f)
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 7 column 1 (char 6)

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on July 16, 2024

@lancer73 JSON is invalid so you probably made a mistake trying to fix manually.

Which error did you got regarding the ZBMini? Same as @GH2user or another error message?
Did problems start occuring for you since v1.12.1 or also with v1.12.0

from homeassistant-powercalc.

lancer73 avatar lancer73 commented on July 16, 2024

@lancer73 JSON is invalid so you probably made a mistake trying to fix manually.

Which error did you got regarding the ZBMini? Same as @GH2user or another error message?

Did problems start occuring for you since v1.12.1 or also with v1.12.0

Yes, you are correct. The wget did not get the intended result. Before was the same as @GH2user. I have a lot of different equipment monitored. Those model files were present.

Retried the download manually and now it is working.

from homeassistant-powercalc.

GH2user avatar GH2user commented on July 16, 2024

I have checked the folder and there was no json file in there. The folder structure was in place.

In that case Powercalc thinks the profile was already downloaded and does not try again.
I will see if I can make that more robust and put in some validation.
To force powercalc to redownload the profile you can remove the model folder manually.

Powercalc optimistically create the model folder and after that downloads file from github to it.
Whenever this fails the model folder will not be removed, and this causes the download mechanism to never retry again.

Actually only two brand-folders where there out of the seven showing now after a good reboot. Seems they all got deleted when upgrading.

I see there was an issues with library generation code, where each profile was indicated it updated yesterday.
Also see https://powercalc.lauwbier.nl. Every profile had updated at to: 2024-05-03T09:11:32+02:00
Because of this Powercalc would redownload all profiles which you already had locally.
It shouldn't remove any folders, so I'm not sure why you previously had seven, and now only 2.

I'm working on better error handling, validation and also a retry mechanism to make it more robust and prevent any issues in the future.

from homeassistant-powercalc.

bramstroker avatar bramstroker commented on July 16, 2024

Oops I see I did edited your comment with my remarks @GH2user.
Meant to quote reply, no idea what I have been sniffing this morning ;-)

Anyway, I have worked on some improvements for the download mechanism. See #2234
Will release this soon.

  • Retry 3 times if Github download fails, with 3 seconds intervals
  • Check if model.json is present, when it is not always do a download
  • Better errors in the logs.

from homeassistant-powercalc.

GH2user avatar GH2user commented on July 16, 2024

Oops I see I did edited your comment with my remarks @GH2user. Meant to quote reply, no idea what I have been sniffing this morning ;-)

Anyway, I have worked on some improvements for the download mechanism. See #2234 Will release this soon.

  • Retry 3 times if Github download fails, with 3 seconds intervals
  • Check if model.json is present, when it is not always do a download
  • Better errors in the logs.

No worries Bram, happy you created Powercalc and are improving it. Thanks a lot.

I had two folders when the fail happened, so 1.12.1 deleted the folders from 1.12.0. After a fail-free run I had seven of them again.

from homeassistant-powercalc.

BernieV1977 avatar BernieV1977 commented on July 16, 2024

I'm facing the same issues with the Google Nest mini profile from version 12. 0 and higher. I stay at this moment at version 11.8. This one is working without issues.

from homeassistant-powercalc.

BernieV1977 avatar BernieV1977 commented on July 16, 2024

I have released 1.12.2 btw which includes some improvements to prevent the error reported in this issue. Hope this solves all your issues.

Thx, the error with the Google Nest mini profile is gone.

from homeassistant-powercalc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.