Guide: moving from DSMR to rooted Toon

This small guide will help you quickly set up your newly rooted (and integrated via HACS) Toon.

My previous configuration consisted of the DSMR integration in sensors.yaml. I got this through a Wemos with ESP Easy (source).

- platform: dsmr
  host: !secret P1_gateway_ip
  port: 8088
  dsmr_version: 4

and the data collection in configuration.yaml

utility_meter:
  hourly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: hourly
  hourly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: hourly
  daily_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: daily
  daily_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: daily
  monthly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: monthly
  monthly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: monthly
  daily_gas:
    source: sensor.gas_consumption
    cycle: daily
  monthly_gas:
    source: sensor.gas_consumption
    cycle: monthly

Since these sensors were already widely used throughout my Lovelace, I wanted to write a wrapper for the given Toon sensors to be compatible with my previous DSMR configuration. So in sensors I first added the rooted Toon with integrations from HACS (one of which: toon_climate)

- platform: template
  sensors:
    toon_driewegklep:
      friendly_name: 'Driewegklep'
      value_template: >-
        {% if is_state_attr('climate.toon','burner_info', 0) %}
            Neutraal
        {% elif is_state_attr('climate.toon','burner_info', 1) %}
            CV
        {% elif is_state_attr('climate.toon','burner_info', 2) %}
            Warm Water
        {% endif %}

- platform: toon_smartmeter
  host: !secret toon_ip
  port: 80
  scan_interval: 10
  resources:
    - gasused
    - gasusedcnt
    - elecusageflowpulse
    - elecusagecntpulse
    - elecusageflowlow
    - elecusagecntlow
    - elecusageflowhigh
    - elecusagecnthigh
    - elecprodflowlow
    - elecprodcntlow
    - elecprodflowhigh
    - elecprodcnthigh
    - elecsolar
    - elecsolarcnt
    - heat

- platform: toon_boilerstatus
  host: !secret toon_ip
  port: 80
  scan_interval: 10
  resources:
    - boilersetpoint
    - boilerintemp
    - boilerouttemp
    - boilerpressure
    - boilermodulationlevel
    - roomtemp
    - roomtempsetpoint

And now finally the conversion of the new sensors to the previously used sensors:

# Convert Toon to DSMR values
- platform: template
  sensors:
    # Electricity
    power_consumption:
      friendly_name: Power consumption
      unit_of_measurement: kW
      device_class: power
      value_template: "{{ (states('sensor.toon_p1_power_use_low')|float + states('sensor.toon_p1_power_use_high')|float) / 1000 }}"
    energy_consumption_tarif_1:
      friendly_name: Energy Consumption 1
      unit_of_measurement: kWh
      device_class: energy
      value_template: "{{ states('sensor.toon_p1_power_use_cnt_low') |float }}"
    energy_consumption_tarif_2:
      friendly_name: Energy Consumption 2
      unit_of_measurement: kWh
      device_class: energy
      value_template: "{{ states('sensor.toon_p1_power_use_cnt_high') |float }}"
    energy_production_tarif_1:
      friendly_name: Energy Production 1
      unit_of_measurement: kWh
      device_class: energy
      value_template: "{{ states('sensor.toon_p1_power_prod_cnt_low') |float }}"
    energy_production_tarif_2:
      friendly_name: Energy Production 2
      unit_of_measurement: kWh
      device_class: energy
      value_template: "{{ states('sensor.toon_p1_power_prod_cnt_high') |float }}"

    # Gas
    gas_consumption:
      friendly_name: Gas consumption
      unit_of_measurement: m3
      value_template: "{{ states('sensor.toon_gas_used_cnt') |float }}"
    hourly_gas_consumption:
      friendly_name: Gas hourly consumption
      unit_of_measurement: m3
      value_template: "{{ states('sensor.toon_gas_used_last_hour') |float }}"

This was written for ha 0.117.5. I guess the template could be changed for 0.118, which now also accepts values instead of strings.

1 Like