Canister level

Hello,
I have the following scenario.

I have a canister where the level is measured.
This happens with 2 binary sensors.

Sensor 1 (off) + Sensor 2 (off) = full
Sensor 1 (on) + Sensor 2 (off) = half full
Sensor 1 (on) + Sensor 2 (on) = empty

I already have the two sensors.
However, I would now like to display this as described above (3 different states) in a Glance.

Can someone help me with this?

Just make a sensor template with:

{% if (states('binary_sensor.sensor1') == 'off') and (states('binary_sensor.sensor2') == 'off') %}
Full
{% elif (states('binary_sensor.sensor1') == 'on') and (states('binary_sensor.sensor2') == 'off') %}
Half full
{% elif (states('binary_sensor.sensor1') == 'on') and (states('binary_sensor.sensor2') == 'on') %}
Empty
{% else %}
Error
{% endif %}

Thank you for your help, but I can´t make it work:

My Code:

template:
  - sensor:
      - name: "Clor FĂĽllstand"
        state: >
        {% if (states('binary_sensor.pool_clor_5l') == 'off') and (states('binary_sensor.pool_clor_0_5l') == 'off') %}
        Full
        {% elif (states('binary_sensor.pool_clor_5l') == 'on') and (states('binary_sensor.pool_clor_0_5l') == 'off') %}
        Half full
        {% elif (states('binary_sensor.pool_clor_5l') == 'on') and (states('binary_sensor.pool_clor_0_5l') == 'on') %}
        Empty
        {% else %}
        Error
        {% endif %}"

Error Code:

missed comma between flow collection entries at line 92, column 10:
{% if (states('binary_sensor.pool …
^

You have a spare double quote at the end. Try

template:
  - sensor:
      - name: "Clor FĂĽllstand"
        state: >-
          {% if (states('binary_sensor.pool_clor_5l') == 'off') and (states('binary_sensor.pool_clor_0_5l') == 'off') %}
          Full
          {% elif (states('binary_sensor.pool_clor_5l') == 'on') and (states('binary_sensor.pool_clor_0_5l') == 'off') %}
          Half full
          {% elif (states('binary_sensor.pool_clor_5l') == 'on') and (states('binary_sensor.pool_clor_0_5l') == 'on') %}
          Empty
          {% else %}
          Error
          {% endif %}
1 Like