Hi everyone,
I’d like to share my experience integrating my Meltem WRG II units (M-WRG-II E-T-FC) into HA utilizing the Meltem Gateway.
This guide deals specifically with the integration of WRG II devices which are connected to the Meltem Gateway (M-WRG-GW) into Home Assistant. Not any other versions they offer!
Setup
After talking to the Meltem support they told me that their gateway exposes a Modbus COM RTU interface via the Micro-USB interface. There is no need to enable anything. You can also still use their app in parallel in combination with HA if you want or switch completely to HA.
First pair all your WRG devices to the gateway using the official app.If that worked you can continue with the HA integration. Then connect a MicroUSB cable to the gateway and plug it into your computer, RPi or whatever you are running HA on. The gateway is then powered via USB and your HA computer should recognize a new COM interface you can connect to. On my Pi4 with Hass.io it is /dev/ttyACM0. You can also check dmesg output via terminal what got recognized by the kernel.
If that works you must setup the modbus RTU integration according to Modbus - Home Assistant.
My config now looks like this:
- name: modbus_hub
type: serial
port: /dev/ttyACM0
baudrate: 19200
bytesize: 8
method: rtu
parity: E
stopbits: 1
sensors:
# Lüftung SZ
- name: "Lüftung SZ Modus"
slave: 3
address: 41100
data_type: int16
scan_interval: 3
- name: "Lüftung SZ Modus Zuluft"
slave: 3
address: 41101
data_type: int16
scan_interval: 3
- name: "Lüftung SZ Ablufttemperatur"
slave: 3
address: 41000
data_type: float32
device_class: temperature
unit_of_measurement: "°C"
scan_interval: 60
precision: 1
swap: word
- name: "Lüftung SZ Außenlufttemperatur"
slave: 3
address: 41002
data_type: float32
device_class: temperature
unit_of_measurement: "°C"
precision: 1
scan_interval: 60
swap: word
- name: "Lüftung SZ Fortlufttemperatur"
slave: 3
address: 41004
data_type: float32
device_class: temperature
unit_of_measurement: "°C"
scan_interval: 60
precision: 1
swap: word
- name: "Lüftung SZ Feuchte Abluft"
slave: 3
address: 41006
data_type: int16
device_class: humidity
unit_of_measurement: "%"
scan_interval: 60
- name: "Lüftung SZ CO² Abluft"
slave: 3
address: 41007
data_type: int16
device_class: carbon_dioxide
unit_of_measurement: "ppm"
scan_interval: 60
- name: "Lüftung SZ Zulufttemperatur"
slave: 3
address: 41009
data_type: float32
device_class: temperature
unit_of_measurement: "°C"
scan_interval: 60
precision: 1
swap: word
- name: "Lüftung SZ Feuchte Zuluft"
slave: 3
address: 41011
data_type: int16
device_class: humidity
unit_of_measurement: "%"
scan_interval: 60
- name: "Lüftung SZ Lüfterstufe Abluft"
slave: 3
address: 41020
data_type: int16
device_class: volume_flow_rate
unit_of_measurement: "m³/h"
scan_interval: 3
- name: "Lüftung SZ Lüfterstufe Zuluft"
slave: 3
address: 41021
data_type: int16
device_class: volume_flow_rate
unit_of_measurement: "m³/h"
scan_interval: 3
- name: "Lüftung SZ Zeit bis Filterwechsel"
slave: 3
address: 41027
data_type: int16
device_class: duration
unit_of_measurement: "d"
scan_interval: 60
- name: "Modus SZ"
slave: 3
address: 41120
data_type: int16
#device_class: duration
#unit_of_measurement: "d"
scan_interval: 3600
- name: "Lüftung SZ Rel. Feuchte Startpunkt"
slave: 3
address: 42000
data_type: int16
device_class: humidity
unit_of_measurement: "%"
scan_interval: 3
Writing register ^= changing modes, fan speeds etc
To change fan speeds, modes etc. you must basically write 3 register after another. E.g. this script sets the mode to “Auto”
alias: Ventilation - SZ - Auto
sequence:
- service: modbus.write_register
metadata: {}
data:
hub: modbus_hub
slave: 3
address: 41120
value: 2
- service: modbus.write_register
metadata: {}
data:
hub: modbus_hub
slave: 3
address: 41121
value: 16
- service: modbus.write_register
metadata: {}
data:
hub: modbus_hub
slave: 3
address: 41132
value: 0
mode: single
To get the values for the current state and calculate the absolute humidity I’ve created those sensor templates:
# Schlafzimmer
luftung_sz_feuchte_zuluft_absolut:
unit_of_measurement: 'g/m³'
value_template: >
{% set h, t = states('sensor.luftung_sz_feuchte_zuluft') | float, states('sensor.luftung_sz_zulufttemperatur') %}
{% if not h or t == 'unknown' -%}
'unknown'
{%- else %}
{% set t = t | float %}
{{ (h*6.112*2.1674*e**((t*17.67)/(t+243.5))/(t+273.15))|round(2) }}
{% endif %}
luftung_sz_feuchte_abluft_absolut:
unit_of_measurement: 'g/m³'
value_template: >
{% set h, t = states('sensor.luftung_sz_feuchte_abluft') | float, states('sensor.luftung_sz_ablufttemperatur') %}
{% if not h or t == 'unknown' -%}
'unknown'
{%- else %}
{% set t = t | float %}
{{ (h*6.112*2.1674*e**((t*17.67)/(t+243.5))/(t+273.15))|round(2) }}
{% endif %}
luftung_sz_modus_string:
value_template: >
{% if is_state('sensor.luftung_sz_modus', '1') %}
Standby
{% elif is_state('sensor.luftung_sz_modus', '2') and is_state('sensor.luftung_sz_modus_zuluft', '112') %}
Feuchte-Regelung
{% elif is_state('sensor.luftung_sz_modus', '2') and is_state('sensor.luftung_sz_modus_zuluft', '176') %}
CO²-Regelung
{% elif is_state('sensor.luftung_sz_modus', '2') and is_state('sensor.luftung_sz_modus_zuluft', '48') %}
Auto
{% elif is_state('sensor.luftung_sz_modus', '3') and is_state('sensor.luftung_sz_modus_zuluft', '228') %}
Stufe 1
{% elif is_state('sensor.luftung_sz_modus', '3') and is_state('sensor.luftung_sz_modus_zuluft', '229') %}
Stufe 2
{% elif is_state('sensor.luftung_sz_modus', '3') and is_state('sensor.luftung_sz_modus_zuluft', '230') %}
Stufe 3
{% elif is_state('sensor.luftung_sz_modus', '3') %}
Manuell
{% elif is_state('sensor.luftung_sz_modus', '4') %}
Manuell - unbalanciert
{% endif %}
For all other options please have a look into the documentation of their Modbus versions. See chapter 16 in https://www.meltem.com/fileadmin/user_upload/Downloads_WRG_2/Oeffentliche_Downloads/DE/Betriebsanleitungen/Geraete/Meltem-M-WRG-II-P-E-M-(-F%2C-FC)-Installations-und-Betriebsanleitung.pdf
REMARKS
- On the Gateway the Modbus register 41000 and 41004 are reversed. That’s why those differ in my config to the documentation. Meltem confirmed this when talking to them that the registers are different here.
- The first slave ID being used is 2 and then increment in the sequence you’ve added your devices via the app to the gateway.
- thanks to yoziru for providing this great example for Zehnder systems and some nice graphics I borrowed GitHub - yoziru/esphome-zehnder-comfoair: Interact with Zehnder Comfoair Q using ESPHome and Home Assistant