JensenNick / huawei_solar_pees

Power, Energy and Economy Sensors in Home Assistant
MIT License
35 stars 5 forks source link

Fix missing defaults #7

Closed woopstar closed 8 months ago

woopstar commented 8 months ago

Fixes this error

2024-01-22 09:02:59.054 ERROR (MainThread) [homeassistant.helpers.sensor] Error rendering state template for sensor.battery_charge_yield_sale: ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if last is defined %}
  {% set lastlast = states('sensor.energy_yield_total', 'last') | float(0) %}
{% else %}
  {% set lastlast = 0 %}
{% endif %} {% set last = states('sensor.energy_yield_total') | float %} {% if last > 0 %}
  {{ states('sensor.energy_yield_total', 'last') | float }}
{% endif %}' but no default was specified
JensenNick commented 8 months ago

Thanks woopstar! Fixed with similar missing default values in e5b5d11435fb0f420506532979287dfa3a9e1c0b and 9a3647f9cd5cc227c840ca27329b37807ede0904