Ondanks veel hulp van een medetweaker loopt dit vast.
dit geeft in sjablonen een output van mijn COP:
YAML:
1
2
3
4
5
| {{ ((states('sensor.flow')| float * 0.06 * 1.16 * (states('sensor.WaterUIT') | float - states('sensor.WaterIN')|float) )
/
(states('sensor.kwh_meter_3c39e72df1c2_active_power') | float ))
* 1000
|round(2) }} |
maak ik de sensor aan in configuration
YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| - name: "Flow"
state: >-
{% if states('switch.100144896d_1') == 'on' and states('switch.100144896d_2') == 'off' -%}
11.3
{% elif states('switch.100144896d_1') == 'off' and states('switch.100144896d_2') == 'on' %}
10.5
{% elif states('switch.100144896d_1') == 'on' and states('switch.100144896d_2') == 'on' %}
15.5
{%- endif -%}
- name: "COP"
unit_of_measurement: "COP"
state_class: measurement
state: >-
{% if states('sensor.kwh_meter_3c39e72df1c2_active_power' > '100') and states('switch.100144896d_1') == 'on' or states('switch.100144896d_2') == 'on' %}
{{
((states('sensor.flow')| float * 0.06 * 1.16 * (states('sensor.WaterUIT') | float - states('sensor.WaterIN')|float) )
/
(states('sensor.kwh_meter_3c39e72df1c2_active_power') | float ))
* 1000
|round(2) }}
}}
{% else %} 0 {%endif%} |
Dan error:
2022-11-08 21:30:46.738 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{% if states('sensor.kwh_meter_3c39e72df1c2_active_power' > '100') and states('switch.100144896d_1') == 'on' or states('switch.100144896d_2') == 'on' %}
{{
((states('sensor.flow')| float * 0.06 * 1.16 * (states('sensor.WaterUIT') | float - states('sensor.WaterIN')|float) )
/
(states('sensor.kwh_meter_3c39e72df1c2_active_power') | float ))
* 1000
|round(2) }}
}}
{% else %} 0 {%endif%}")
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 420, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1933, 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 698, in __call__
state = _get_state(self._hass, entity_id)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 920, in _get_state
return _get_template_state_from_state(hass, entity_id, hass.states.get(entity_id))
File "/usr/src/homeassistant/homeassistant/core.py", line 1339, in get
return self._states.get(entity_id.lower())
AttributeError: 'bool' object has no attribute 'lower'
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 536, in async_render_to_info
render_info._result = self.async_render(variables, strict=strict, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 422, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: AttributeError: 'bool' object has no attribute 'lower'
2022-11-08 21:30:46.984 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('AttributeError: 'bool' object has no attribute 'lower'') while processing template 'Template("{% if states('sensor.kwh_meter_3c39e72df1c2_active_power' > '100') and states('switch.100144896d_1') == 'on' or states('switch.100144896d_2') == 'on' %}
{{
((states('sensor.flow')| float * 0.06 * 1.16 * (states('sensor.WaterUIT') | float - states('sensor.WaterIN')|float) )
/
(states('sensor.kwh_meter_3c39e72df1c2_active_power') | float ))
* 1000
|round(2) }}
}}
{% else %} 0 {%endif%}")' for attribute '_attr_native_value' in entity 'sensor.cop'
iemand enig idee
edit:
ow
[
Voor 0% gewijzigd door
Septillion op 09-11-2022 12:54
. Reden: Denk aan de ' yaml' bij code tags aub ]
Ik doe niet aan bijgeloof. Dat brengt ongeluk.