I’m using a sensor to determine at what speed my ventilation would run (and this sends it to my KNX-system). This is working great, except one thing: when it counts to a number of +100 (percent) it won’t change it anymore and it stays at the previous state.
So what I’m looking for is a way to add to the value_template: if +99, set to 100.
- platform: template
sensors:
ventilatiesnelheid:
friendly_name: ventilatiesnelheid
unit_of_measurement: 'procent'
value_template: >
{% set total = 15 %}
{% if is_state('input_boolean.wcboven', 'on') %}
{% set total = total + 20 %}
{% endif %}
{% if is_state('input_boolean.wcbeneden', 'on') %}
{% set total = total + 20 %}
{% endif %}
{% if is_state('input_boolean.douche', 'on') %}
{% set total = total + 15 %}
{% endif %}
{% if is_state('person.a, 'home') %}
{% set total = total + 5 %}
{% endif %}
{% if is_state('person.b, 'home') %}
{% set total = total + 5 %}
{% endif %}
{% if is_state('input_boolean.gast', 'on') %}
{% set total = total + 30 %}
{% endif %}
{% if is_state('input_boolean.kuisvrouwaanwezig', 'on') %}
{% set total = total + 25 %}
{% endif %}
{% if is_state('input_boolean.oppasaanwezig', 'on') %}
{% set total = total + 20 %}
{% endif %}
{% if is_state('sensor.buitentempverschil', 'on') %}
{% set total = total - 5 %}
{% endif %}
{% if is_state('input_boolean.luchtkwaliteit', 'on') %}
{% set total = total + 10 %}
{% endif %}
{% if is_state('input_boolean.badkamervochtig', 'on') %}
{% set total = total + 35 %}
{% endif %}
{{total}}