8. How to: Sensor templates - zxdavb/ramses_cc GitHub Wiki

Climate sensors

These template sensors are useful, but you need to construct them yourself in Home Assistant. Since HA 2023.9 you can do this either by editing configuration.yaml or in the UI using Configuration > Devices & Services > Helpers tab, + Add Helper > Template > Template a Sensor. When using the UI, simply copy the jinja expression including the curly brackets {{ }} from the examples below.

 climate-template-create

Note that climate.controller is the default name of the CH/DHW (or HVAC) controller.

Your system may have any combination of these, including all three, or none (i.e. for systems with an OTB, and no stored HW).

template:
- sensor:
    - name: "heating_valve (relay_demand)"
      unique_id: f9_relay_demand
      state: >
        {{ state_attr('climate.controller', 'relay_demands').F9 * 100 }}
- sensor:
    - name: "hotwater_valve (relay_demand)"
      unique_id: fa_relay_demand
      state: >
        {{ state_attr('climate.controller', 'relay_demands').FA * 100 }}
- sensor:
    - name: "heating_control (relay_demand)"
      unique_id: fc_relay_demand
      state: >
        {{ state_attr('climate.controller', 'relay_demands').FC * 100 }}

Two more climate sensors included here for your reference:

template:
- sensor:
    - name: "System Mode"
      unique_id: system_mode
      state: >
        {{ state_attr('climate.controller', 'system_mode') }}
        system_mode: "{{ state_attr('climate.controller', 'system_mode').system_mode }}"
        until: "{{ state_attr('climate.controller', 'system_mode').until }}"
- sensor:
    - name: "01:000000_FC (heat_demand)"
      unique_id: fc_heat_demand
      unit_of_measurement: "%"
      state: >
        {% if state_attr('climate.controller', 'heat_demands') != None %}
          {% if state_attr('climate.controller', 'heat_demands').get('FC') != None %}
            {{ state_attr('climate.controller', 'heat_demands').FC * 100 }}
          {%- endif %}
        {%- endif %}

Remeha Calenta sensor

By Jeroen Simonetti

I managed to decipher the oem_code for a Remehe Calenta HR unit and wanted to share it. It is in Dutch, but it should be easy to translate if you know the status codes. Unfortunately, binary arithmetic is hard in jinja, so I had to make do with some substitutions, but it works fine afaict.

You should substitute sensor.10_041226_oem_code with your correct oem_code sensor in a few places in the template for this to work on your system.

template:
- sensor:
    - name: "Remeha Status"
      unique_id: remeha_status
      state: >
        {{ state_attr("sensor.remeha_status", "status") }}
      oem_code: >-
          {% if states('sensor.10_041226_oem_code') == "unavailable" %}
            {{ state_attr("sensor.remeha_status", "oem_code")|default(0) }}
          {% else %}
            {{ states('sensor.10_041226_oem_code')|int }}
          {% endif %}
      status_code: >-
          {% set oemcode = state_attr("sensor.remeha_status", "oem_code") %}
          {% set hex = '%0x' % oemcode | int %}
          {{ hex[-3]|default(0) }}
      substatus_code: >-
          {% set oemcode = state_attr("sensor.remeha_status", "oem_code") %}
          {% set hex = '%0x' % oemcode | int %}
          {% set lowstr = "0x" + hex[-2] + hex[-1] %}
          {{ lowstr | int(base=16,default=0) }}
      status: >-
          {% set status = state_attr("sensor.remeha_status", "status_code") %}
          {% if status == 0 %}Rust
          {% elif status == 1 %}Ketel start
          {% elif status == 2 %}Brander start
          {% elif status == 3 %}Branden op CV-bedrijf
          {% elif status == 4 %}SWW-bedrijf actief
          {% elif status == 5 %}Branderstop
          {% elif status == 6 %}Ketelstop (einde warmtevraag)
          {% elif status == 8 %}Regelstop
          {% elif status == 9 %}Blokkering
          {% elif status == 7 %}Ontluchten
          {% elif status == 17 %}Ontluchten
          {% else %}Unknown
          {% endif %}
      substatus: >-
            {% set status = state_attr("sensor.remeha_status", "status_code") %}
            {% set substatus = state_attr("sensor.remeha_status", "substatus_code") %}
            {% if status == 0 %}Rust
            {% elif status == 1 %}
              {% if substatus == 1 %}Anti-pendel
              {% elif substatus == 2 %}Driewegklep aansturen
              {% elif substatus == 3 %}Start pomp
              {% elif substatus == 4 %}Wacht op juiste temperatuur voor branderstart
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 2 %}
              {% if substatus == 10 %}Open rookgasklep
              {% elif substatus == 11 %}Verhogen toerental ventilator
              {% elif substatus == 13 %}Voorventileren
              {% elif substatus == 14 %}Wacht op releasesignaal
              {% elif substatus == 15 %}Brander aan
              {% elif substatus == 17 %}Voorontsteking
              {% elif substatus == 18 %}Hoofdontsteking
              {% elif substatus == 19 %}Vlamdetectie
              {% elif substatus == 20 %}Tussenventileren
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 3 %}
              {% if substatus == 30 %}Temperatuurregeling
              {% elif substatus == 31 %}Begrende temperatuurregeling (ΔT bveveiliging)
              {% elif substatus == 32 %}Vermogensregeling
              {% elif substatus == 33 %}Bescherming temperatuurgradient niveau 1 (Terugmoduleren)
              {% elif substatus == 34 %}Bescherming temperatuurgradient niveau 2 (Laaglast)
              {% elif substatus == 35 %}Bescherming temperatuurgradient niveau 3 (Blokkering)
              {% elif substatus == 36 %}Opmodeleren voor vlambeveiliging
              {% elif substatus == 37 %}Temperatuurstabilisatietijd
              {% elif substatus == 38 %}Koude start
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 4 %}
              {% if substatus == 30 %}Temperatuurregeling
              {% elif substatus == 31 %}Begrensde temperatuurregeling (ΔT bveveiliging)
              {% elif substatus == 32 %}Vermogensregeling
              {% elif substatus == 33 %}Bescherming temperatuurgradient niveau 1 (Terugmoduleren)
              {% elif substatus == 34 %}Bescherming temperatuurgradient niveau 2 (Laaglast)
              {% elif substatus == 35 %}Bescherming temperatuurgradient niveau 3 (Blokkering)
              {% elif substatus == 36 %}Opmodeleren voor vlambeveiliging
              {% elif substatus == 37 %}Temperatuurstabilisatietijd
              {% elif substatus == 38 %}Koude start
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 5 %}
              {% if substatus == 40 %}Brander uit
              {% elif substatus == 41 %}Naventileren
              {% elif substatus == 42 %}Sluit rookgasklep
              {% elif substatus == 43 %}Recirculatiebeveiliging
              {% elif substatus == 44 %}Stop ventilator
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 6 %}
              {% if substatus == 60 %}Pomp nadraaien
              {% elif substatus == 61 %}Pomp uit
              {% elif substatus == 62 %}Driewegklep aansturen
              {% elif substatus == 63 %}Start anti-pendel
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 7 %}
              {% if substatus == 0 %}Rust
              {% elif substatus == 2 %}Driewegklep aansturen
              {% elif substatus == 3 %}Start pomp
              {% elif substatus == 61 %}Pomp uit
              {% elif substatus == 62 %}Driewegklep aansturen
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 8 %}
              {% if substatus == 0 %}Wacht op branderstart
              {% elif substatus == 1 %}Anti-pendel
              {% else %}{{ substatus }}
              {% endif %}
            {% elif status == 9 %}
              {% if substatus == 0 %}Parameter fout
              {% elif substatus == 1 %}Maximale aanvoertemperatuur overschreden
              {% elif substatus == 2 %}Maximale stijging van de aanvoertemperatuur overschreden
              {% elif substatus == 7 %}Maximaal verschil tussen aanvoer- en retourtemperatuur overschreden
              {% elif substatus == 10 %}Blokkerende ingang is actief
              {% elif substatus == 11 %}Blokkerende ingang of vorstbeveiliging is actief
              {% elif substatus == 12 %}Communicatiefout met de HMI-print
              {% elif substatus == 13 %}Communicatiefout met de SCU-print
              {% elif substatus == 14 %}Waterdruk te laag
              {% elif substatus == 15 %}Gasdruk te laag
              {% elif substatus == 16 %}Configuratiefout
              {% elif substatus == 17 %}Configuratiefout of default parametertabel niet in orde
              {% else %}{{ substatus }}
              {% endif %}
            {% else %}{{ substatus }}
            {% endif %}