Sorry for bothering you again, but for some reason it says that the sensor is unavailable.
Gives this error in the log
2023-05-25 12:42:22.108 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% set cv, ci, ev, ei, pv, pi, hv = bool(states("schedule.cheias_verao")),
bool(states("schedule.cheias_inverno")),
bool(states("schedule.eda_vazio_verao")),
bool(states("schedule.eda_vazio_inverno")),
bool(states("schedule.ponta_verao")),
bool(states("schedule.ponta_inverno")),
(5 < now().month < 11) %}
{% if (cv and hv) or (ci and not hv) %}
{{ 0.1711 * 1.16 }}
{% elif (ev and hv) or (ei and not hv) %}
{{ 0.1056 * 1.16 }}
{% elif (pv and hv) or (pi and not hv) %}
{{ 0.2380 * 1.16 }}
{% endif %}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1136, in forgiving_boolean
return cv.boolean(value)
File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 187, in boolean
raise vol.Invalid(f"invalid boolean value {value}")
voluptuous.error.Invalid: invalid boolean value unknown
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 544, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2164, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1139, in forgiving_boolean
raise_no_default("bool", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1594, in raise_no_default
raise ValueError(
ValueError: Template error: bool got invalid input 'unknown' when rendering template '{% set cv, ci, ev, ei, pv, pi, hv = bool(states("schedule.cheias_verao")),
bool(states("schedule.cheias_inverno")),
bool(states("schedule.eda_vazio_verao")),
bool(states("schedule.eda_vazio_inverno")),
bool(states("schedule.ponta_verao")),
bool(states("schedule.ponta_inverno")),
(5 < now().month < 11) %}
{% if (cv and hv) or (ci and not hv) %}
{{ 0.1711 * 1.16 }}
{% elif (ev and hv) or (ei and not hv) %}
{{ 0.1056 * 1.16 }}
{% elif (pv and hv) or (pi and not hv) %}
{{ 0.2380 * 1.16 }}
{% endif %}' 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/template.py", line 665, in async_render_to_info
render_info._result = self.async_render(variables, strict=strict, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 546, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: bool got invalid input 'unknown' when rendering template '{% set cv, ci, ev, ei, pv, pi, hv = bool(states("schedule.cheias_verao")),
bool(states("schedule.cheias_inverno")),
bool(states("schedule.eda_vazio_verao")),
bool(states("schedule.eda_vazio_inverno")),
bool(states("schedule.ponta_verao")),
bool(states("schedule.ponta_inverno")),
(5 < now().month < 11) %}
{% if (cv and hv) or (ci and not hv) %}
{{ 0.1711 * 1.16 }}
{% elif (ev and hv) or (ei and not hv) %}
{{ 0.1056 * 1.16 }}
{% elif (pv and hv) or (pi and not hv) %}
{{ 0.2380 * 1.16 }}
{% endif %}' but no default was specified
2023-05-25 12:42:22.111 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: bool got invalid input 'unknown' when rendering template '{% set cv, ci, ev, ei, pv, pi, hv = bool(states("schedule.cheias_verao")),
bool(states("schedule.cheias_inverno")),
bool(states("schedule.eda_vazio_verao")),
bool(states("schedule.eda_vazio_inverno")),
bool(states("schedule.ponta_verao")),
bool(states("schedule.ponta_inverno")),
(5 < now().month < 11) %}
{% if (cv and hv) or (ci and not hv) %}
{{ 0.1711 * 1.16 }}
{% elif (ev and hv) or (ei and not hv) %}
{{ 0.1056 * 1.16 }}
{% elif (pv and hv) or (pi and not hv) %}
{{ 0.2380 * 1.16 }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% set cv, ci, ev, ei, pv, pi, hv = bool(states("schedule.cheias_verao")),
bool(states("schedule.cheias_inverno")),
bool(states("schedule.eda_vazio_verao")),
bool(states("schedule.eda_vazio_inverno")),
bool(states("schedule.ponta_verao")),
bool(states("schedule.ponta_inverno")),
(5 < now().month < 11) %}
{% if (cv and hv) or (ci and not hv) %}
{{ 0.1711 * 1.16 }}
{% elif (ev and hv) or (ei and not hv) %}
{{ 0.1056 * 1.16 }}
{% elif (pv and hv) or (pi and not hv) %}
{{ 0.2380 * 1.16 }}
{% endif %}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.preco_electricidade'