Magnum Floor Heating MW-C control via Modbus

Hi all,

I was looking for a way to control and monitor my Magnum Floor Heating.
Since it has a Modbus connection, i started searching for a way to use that.
This post from @avdwilk helped me a lot: https://community.home-assistant.io/t/modbus-climate-not-showing-target-temperature/307081/6

So i bought an Elvin EW11A and connected it to the MW-C controller port X15.
14-X15 = RS485 A
15-X15 = RS485 B
16-X15 = GND

RS485 settings:
Speed: 38400bps
8 data bits
Parity: None
1 stop bit

So far the serial connection.

I use separate modbus.yaml and sensors.yaml configuration files so in my configuration.yaml i have:

modbus: !include modbus.yaml
sensor: !include sensors.yaml

Here’s my modbus.yaml:


- name: magnum_heating
  type: tcp
  host: 192.168.0.32 #IP address of the Elvin EW11A
  port: 502
  sensors:
# Date and time:
    - name: magnum_year
      slave: 1
      address: 0000
      data_type: int16
      input_type: holding
    - name: magnum_month
      slave: 1
      address: 0001
      data_type: int16
      input_type: holding
    - name: magnum_day
      slave: 1
      address: 0002
      data_type: int16
      input_type: holding
    - name: magnum_hour
      slave: 1
      address: 0003
      data_type: int16
      input_type: holding
    - name: magnum_minute
      slave: 1
      address: 0004
      data_type: int16
      input_type: holding
    - name: magnum_second
      slave: 1
      address: 0005
      data_type: int16
      input_type: holding
# Temperatures:
    - name: kamer_jef_temperature
      slave: 1
      address: 1001
      data_type: int16
      scale: 0.01
      offset: 0
      precision: 1
      input_type: input
    - name: huiskamer_temperature
      slave: 1
      address: 1101
      data_type: int16
      scale: 0.01
      offset: 0
      precision: 1
      input_type: input
# Heating status:
    - name: kamer_jef_heat_status
      slave: 1
      address: 1012
      data_type: int16
      input_type: input
    - name: huiskamer_heat_status
      slave: 1
      address: 1112
      data_type: int16
      input_type: input
# Setpoints:
  climates:
    - name: kamer_jef_setpoint
      slave: 1
      data_type: int16
      scale: 0.01
      offset: 0
      max_temp: 25
      min_temp: 15
      temp_step: 0.5
      target_temp_register: 1001
      address: 1001
    - name: huiskamer_setpoint
      slave: 1
      data_type: int16
      scale: 0.01
      offset: 0
      max_temp: 25
      min_temp: 15
      temp_step: 0.5
      target_temp_register: 1101
      address: 1101

sensors.yaml:

  - platform: template
    sensors:
      datetime_magnum_heating:
        value_template: "{{ states('sensor.magnum_day') }}-{{ states('sensor.magnum_month') }}-{{ states('sensor.magnum_year')}} / {{ '%0.2d' % states('sensor.magnum_hour')|int }}:{{ '%0.2d' % states('sensor.magnum_minute')|int }}:{{ '%0.2d' % states('sensor.magnum_second')|int }}"
        friendly_name: "MW-C date/time"

Automations:

Set date and time:

alias: Set Magnum MW-C date and time
description: "Sets the date and time of the MW-C daily"
triggers:
  - trigger: time
    at: "19:00:00"
conditions: []
actions:
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 0
      value: "{{ now().strftime('%Y') }}"
    enabled: true
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 1
      value: "{{ now().strftime('%m') }}"
    enabled: true
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 2
      value: "{{ now().strftime('%d') }}"
    enabled: true
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 3
      value: "{{ now().strftime('%Y') }}"
    enabled: true
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating

Setpoint for kamer Jef:

alias: Setpoint temperatuur kamer Jef
description: "Setpoint for kamer Jef"
triggers:
  - trigger: state
    entity_id:
      - input_number.setpoint_temperatuur_kamer_jef
conditions: []
actions:
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 1001
      value: >-
        {{ states('input_number.setpoint_temperatuur_kamer_jef') | multiply(100)
        | round(0) }}
    enabled: true
mode: single

Setpoint for Huiskamer:

alias: Setpoint temperatuur Huiskamer
description: "Setpoint Huiskamer"
triggers:
  - trigger: state
    entity_id:
      - input_number.setpoint_temperatuur_huiskamer
conditions: []
actions:
  - action: modbus.write_register
    metadata: {}
    data_template:
      hub: magnum_heating
      slave: 1
      address: 1101
      value: >-
        {{ states('input_number.setpoint_temperatuur_huiskamer') | multiply(100)
        | round(0) }}
    enabled: true
mode: single

I use the Versatile Thermostat Integration:

Huiskamer:
Main attributes:
Room temperature: huiskamer_temperature
Underlyings:
Entity: huiskamer_setpoint

Kamer Jef:
Main attributes:
Room temperature: kamer_jef_temperature
Underlyings:
Entity: kamer_jef_setpoint

Panel:

  - type: masonry
    title: Magnum Heating
    path: magnum-heating
    icon: mdi:heating-coil
    cards:
      - square: false
        type: grid
        cards:
          - type: thermostat
            entity: climate.huiskamer_3
          - type: entities
            entities:
              - entity: sensor.huiskamer_heat_status
                name: Huiskamer heat status
        columns: 1
      - square: false
        type: grid
        cards:
          - type: thermostat
            entity: climate.kamer_jef_2
          - type: entities
            entities:
              - entity: sensor.kamer_jef_heat_status
                name: Kamer Jef heat status
        columns: 1
    badges:
      - type: entity
        show_name: true
        show_state: true
        show_icon: false
        entity: sensor.datetime_magnum_heating
        color: ''
        icon: mdi:clock-digital
        name: WM-C date / time