Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working anymore after upgrade to Home Assistant 2023.12 #133

Open
chheiss opened this issue Dec 8, 2023 · 6 comments
Open

Not working anymore after upgrade to Home Assistant 2023.12 #133

chheiss opened this issue Dec 8, 2023 · 6 comments

Comments

@chheiss
Copy link

chheiss commented Dec 8, 2023

Not working anymore after upgrade to Home Assistant 2023.12

@ThorAlex87
Copy link

ThorAlex87 commented Dec 11, 2023

I too am having issues after upgrading to 23.12. I have three instances running (price with grid tariffs, pure electricity price and electricity minus tax which is the sales price for my solar), only the first one works now. The other two broke after i updated on Saturday, started working again on Sunday and are now broken again. Luckily the one that works is the only one I use for automations...

Edit: Suddenly it's working again...

I found this in the logs, no idea what to make of it...

Denne feilen stammer fra en tilpasset integrasjon.

Logger: custom_components.entsoe.coordinator
Source: helpers/update_coordinator.py:300
Integration: ENTSO-e Transparency Platform (documentation, issues)
First occurred: 9. desember 2023 kl. 23:07:33 (1089 occurrences)
Last logged: 11:08:33

Unexpected error fetching ENTSO-e coordinator data: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% set s = {"cert": 0.01,"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur + s.cert) | float}}' but no default was specified
Unexpected error fetching ENTSO-e coordinator data: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% set s = {"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur) | float}}' but no default was specified
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1916, in forgiving_float
return float(value)
^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2247, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 1, in top-level template code
File "/usr/local/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1919, in forgiving_float
raise_no_default("float", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1627, in raise_no_default
raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{% set s = {"cert": 0.01,"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur + s.cert) | float}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 102, in _async_update_data
parsed_data = self.parse_hourprices(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 87, in parse_hourprices
hourprices[hour] = self.calc_price(value=price, fake_dt=hour)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 77, in calc_price
template_value = self.modifyer.async_render(now=faker(), current_price=price)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 571, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% set s = {"cert": 0.01,"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur + s.cert) | float}}' but no default was specified

@ThorAlex87
Copy link

ThorAlex87 commented Dec 12, 2023

I completely removed and reinstalled the integration yesterday, still the same issue with some of the sensors periodically not working. But it's always the same ones not working, the only difference is the template adding the grid tariff. I also added two more instances, identical to the working one and one of the non-working ones but with some extra for the temporary cost compensation we have. (I have little idea how the templates work, just copying other peoples work btw.) Of those two the one based on the working sensor also work, and the one based on the broken one is also broken... So it seems related to something in the templates?

These are the templates, maybe someone with a better understanding of how this works can figuere something out...

Price with grid tariff (working): (this one has vat set in the integration directly)
{% set s = {"day": 0.4855,"night": 0.3480,"cert": 0.0125,"eur": float(states('sensor.kurs_eur'), 10) } %} {% if now().hour >= 6 and now().hour < 22 %}{{(current_price * s.eur + s.day + s.cert) | float}} {% else %}{{(current_price * s.eur + s.night + s.cert) | float}} {% endif %}

Price without grid tariff (broken):
{% set s = {"cert": 0.01,"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur + s.cert) | float}}

Sale price (broken):
{% set s = {"eur": float(states('sensor.kurs_eur')) } %} {{(current_price * s.eur) | float}}

Price with grid tariff and compensation (working):
{% set s = {"vat": 1.25,"day": 0.4855,"night": 0.3480,"cert": 0.01,"eur": float(states('sensor.kurs_eur'), 10) } %} {% set pb = max(((current_price * s.eur * s.vat) - 0.875) * 0.9, 0.0) %} {% if now().hour >= 6 and now().hour < 22 %}{{(current_price * s.eur * s.vat + s.day + s.cert - pb) | float}} {% else %}{{(current_price * s.eur * s.vat + s.night + s.cert - pb) | float}} {% endif %}

Price with compensation (broken):
{% set s = {"vat": 1.25,"cert": 0.01,"eur": float(states('sensor.kurs_eur')) } %} {% set pb = max(((current_price * s.eur * s.vat) - 0.875) * 0.9, 0.0) %} {{(current_price * s.eur * s.vat + s.cert - pb) | float}}

One more thing: If I try to change the settings for one of the broken ones, even without changing anything i get an template error when trying to submit the change. When they are working they accept the same template with no complaint...

@JaccoR I hope you can find the time to look into this, let me know if there is anything I can more do to help out!

Edit: Just had an idea after just after posting this: Seems the sensor to get the euro exchange rate is going unavailable at the same time, no idea why.

Then i noticed the difference: Working sensors have
"eur": float(states('sensor.kurs_eur'), 10)
and broken sensors have
"eur": float(states('sensor.kurs_eur'))

No idea what that 10 does, but changing the broken ones to have it fixes the issue... Is this in any way related to your issue @chheiss ?

@icefluffy
Copy link

OK, so I'm not alone...
For once I update immediatly...

@PdRuiter
Copy link

Give the update you a solution ??? and yes how did you do the update. A complete remove an fresh install ???

@PdRuiter
Copy link

Solve the issue, by moving entsoe from the dir /config/custom_components/hacs/entsoe to /config/custom_components/entsoe

@Giolovin
Copy link

Giolovin commented Dec 23, 2023

I've had problems too involving a refresh of the dates in the sensor sensor.entso_e_average_electricity_price_today. The dates got all mixed up after midnight: yesterday prices were tomorrow prices in the attributes. I deleted first the entry in integration and removed it from HACS WITH a restart of HA and then reinstalled it. This didn't resolve the issue I was having involving the dates. I then again removed it as mentioned earlier WITHOUT a restart of HA and downloaded the integration again from HACS. This seems to resolve the issue and pull in the correct dates. Now I still have to perform a restart from HA. Fingers crossed everything is kept in place this time.

Update: everything seems to be running fine after restart of HA.

Update 2: It seems giving the integration a (new) name in the configuration did the trick and not the steps I mentioned earlier, but now I have to adjust my automations because the sensors were given another name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants