Danielhiversen / home_assistant_tibber_custom

Display Tibber prices and energy consumption as a graph. Tibber is available in Germany, Norway and Sweden Tibber has helped tens of thousands of new customers each month in Sweden, Norway & Germany to lower their energy bill and consumption. Tibber is using digital technology to make electricity consumption smarter. If you use this link to signup for Tibber, you get 50 euro to buy smart home products in the Tibber store: https://invite.tibber.com/6fd7a447
Apache License 2.0
80 stars 17 forks source link

Newest Core Update - No Image anymore #60

Closed Suschibomber closed 2 weeks ago

Suschibomber commented 2 weeks ago

I did the latest core update this morning and since then no chart has been shown to me.

yahoogreg commented 2 weeks ago

Same for me, Camera.ADRESS no longer exists in Home Assistant since core update to 2024.11.0

mimainka commented 2 weeks ago
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/tibber_custom/camera.py", line 26, in async_setup_platform
    dev.append(TibberCam(home, hass))
               ^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tibber_custom/camera.py", line 45, in __init__
    super().__init__(self._name, self._path)
TypeError: LocalFile.__init__() missing 1 required positional argument: 'unique_id'

from my logs

jove01 commented 2 weeks ago

same here

Suschibomber commented 2 weeks ago

@Danielhiversen Have you already found a solution?

Danielhiversen commented 2 weeks ago

Seems that it is a breaking change in last version of Home Assistant. I have not looked into it, and not sure when I will find time for that

Suschibomber commented 2 weeks ago

Seems that it is a breaking change in last version of Home Assistant. I have not looked into it, and not sure when I will find time for that

Ok too bad. Have used your widget daily :( If I can do something, please let me know.

mimainka commented 2 weeks ago

I manipulated parts of the camera.py file of the custom component a bit to get a „unique id“ and it’s working for me. but id say it’s rather dirty and probably not good coding (hardcoding) :-(

class TibberCam(LocalFile):
    def __init__(self, home, hass):
        matplotlib.use("Agg")

        self._name = home.info["viewer"]["home"]["appNickname"]
        if self._name is None:
            self._name = home.info["viewer"]["home"]["address"].get("address1", "")
        self._path = hass.config.path(f"www/prices_{self._name}.png")
        self._home = home
        self.hass = hass
        self._cons_data = []
        self._last_update = dt_util.now() - datetime.timedelta(hours=1)
        self.realtime_state = None
        self.unique_id = f"tibberprice_unique_id"
        # hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, self._generate_fig)
#        super().__init__(self._name, self._path)

        super().__init__(self._name, self._path, self.unique_id)
TWitzenrath commented 2 weeks ago

@Danielhiversen made @mimainka's change into a PR, slightly extended to not hardcode the uid. Not that much of a contribution, just wanted to make it easy for you as you mentioned time constraints.

mimainka commented 2 weeks ago

@TWitzenrath works like a charm for me. No errors in log as well.

Suschibomber commented 2 weeks ago

@Danielhiversen made @mimainka's change into a PR, slightly extended to not hardcode the uid. Not that much of a contribution, just wanted to make it easy for you as you mentioned time constraints.

Sorry for the stupid question, but how can I find your solution with me so that it works again? Do I just have to paste your code into the file and it should run again?

TWitzenrath commented 2 weeks ago

@Suschibomber Just wait for the update. Or go to Settings->System->Updates and hit the refresh button, then the update should show up instantly

Suschibomber commented 2 weeks ago

I installed the 0.52 but it still doesn't show me a graph. It's as if the image is not found, so such a symbol.

TWitzenrath commented 2 weeks ago

@Suschibomber did you restart homeassistant after updating? Is there anything in the logs?

yahoogreg commented 2 weeks ago

@Suschibomber: the upgrate 0.52 created a new entity with the name camera.ADRESS_2. I used this new entity and at first this resulted in a strange picture but after the HA restart everything was fine.

Thanks to @Danielhiversen and @TWitzenrath for your support

mimainka commented 2 weeks ago

@Suschibomber As an alternative: Check in your www/ folder for a file named „prices_youradress.png And then use the image card with /local/imagename.png

Suschibomber commented 1 week ago

@Suschibomber: the upgrate 0.52 created a new entity with the name camera.ADRESS_2. I used this new entity and at first this resulted in a strange picture but after the HA restart everything was fine.

Thanks to @Danielhiversen and @TWitzenrath for your support

No new entity has been added to me. Just the old camera.leo 😕

Suschibomber commented 1 week ago

I have now tested everything possible. Cleared the cache and downloaded the HACS extension again. It just doesn't show a picture anymore :( Any tips on what I'm doing wrong? tibber_custom_missing_image

jove01 commented 1 week ago

Deleted the Integration and the picture. Restart ha and Install again.

Suschibomber commented 1 week ago

Deleted the Integration and the picture. Restart ha and Install again.

Thanks. That solve the problem.