Configuring Modbus to read a register of type 'ENUM8'

I’m trying to read several values from my Remeha Elga Ace heatpump over modbus. I’ve got the basics working well, but there are a few parameters that are a bit more tricky. These parameters describe state by setting different bits in a single register. These parameters are described as having the type ‘ENUM8’ and UNSIGNED16 (not that this is not referred to as an unsigned 16-bit int).

Here are the relevant bits from the manual:


I’m struggling how to get this working in Home Assistant as both ENUM8 and UNSIGNED16 are not listed amongst the supported data types. I have seen from other posts on the forum that the way to handle these registers containing multiple states is to essentially fetch the raw value to a sensor and then create a binary sensors for each individual value that is represented in the bitmasks of the raw sensor data.

But I am stuck defining the base data type of the sensor reading from modbus, and so far unable to get it to work. I have tried int8 for ENUM8 and uint16 for UNSIGNED16, in combination with a template sensor like {{ states('sensor.elga_heating_mode')|int|bitwise_and(1) > 0 }} (this example was intended to read the first value from an ENUM8 represented as an int8). I’m not getting sensible results back though.

Has any one any clue how to do this? Or a similar config to share?

Thanks!

Here’s the specific config I have now for the modbus parameters:

      - name: "Elga Appliance Status 1"
        unique_id: elga101
        slave: 100
        address: 279
        input_type: holding
        data_type: uint16 # UNSIGNED16
      - name: "Elga Appliance Status 2"
        unique_id: elga102
        slave: 100
        address: 280
        input_type: holding
        data_type: uint16 # UNSIGNED16
      - name: "Elga Heating Mode" #varZoneCurrentHeatingMode
        unique_id: elga103
        slave: 100
        address: 1109
        input_type: holding
        data_type: uint8 #ENUM8

Using this config, the last sensor becomes unavailable. The above two work and get integer values (I’ve seen 2 and 0) that (understandably) don’t correspond with the actual state. I just can’t seem to get the state out.

I’ve gotten the UNSIGNED16 to work! The approach I had was working, I just had a typo in my template sensor. Yay!

Hi mate
do you had any luck with this regisrer value? I got always or 0 or invalid value. Just tried all device_class (int16, uint16, float16, etc…). or maybe do you found this information (DHW tank temperature) from other register…

1 Like

Same challenge here, very curious if anyone solved this… Cant get the enum8 to work.

solved reading the equivalent register in Zone 2 so 1631 and 1632.

thanks the same :wink:

Could you elaborate more on the specific hardware you are using to read the Elga modbus?

Sure Koen, you need the GTW-08 module installed (you can do this yourself or have an installer do it for you). That then connects to a simple Modbus → Wifi / Ethernet module which you can get off Aliexpress.

Cool. My Elga ace 6kw is being placed next month.
Just need to find an affordable gtw-08 module.

I remember buying it in Germany for a lot less (around 130 euro - still a lot of money).

And in all honesty… its pretty useless :pensive:

OTGW can do the same with less effort to set up.

Still no luck here in writing settings to the Elga with the modbus set up.

And would recommend tweakers website, there is a detailed thread on the OTGW and modbus setup.

Hey Bastiaan,

I’ve got a question, I have also connected the GTW-08, but have no clue how to write the YAML-file. is it possible to place a copy of your file.

thanks, Wilco

I can’t share my whole configuration.yaml, but here’s the relevant bit. Remember to change the IP of your modbus host and potentially other settings depending on how your Modbus bridge device is configured.

modbus:
  - name: Remeha Elga Ace
    type: tcp
    host: 192.168.1.124
    port: 502
    delay: 2
    sensors:
      - name: "Elga Flow Temperature Combined" #FlowTemperatureReceived
        unique_id: elga1
        scan_interval: 60
        slave: 100
        address: 273
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Return Temperature" #ReturnTemperatureReceived
        unique_id: elga2
        scan_interval: 60
        slave: 100
        address: 274
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Water Pressure" #ApWaterPressure
        unique_id: elga3
        scan_interval: 60
        slave: 100
        address: 409
        input_type: holding
        data_type: int16
        device_class: pressure
        unit_of_measurement: bar
        state_class: measurement
        scale: 0.1
        precision: 1
      - name: "Elga Outside Temperature" #varApTOutside
        unique_id: elga4
        scan_interval: 60
        slave: 100
        address: 384
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Flow Temperature Heat Pump" #remeha_varHpHeatPumpTF
        unique_id: elga5
        scan_interval: 60
        slave: 100
        address: 403
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Return Temperature Heat Pump" #remeha_varHpHeatPumpTR
        unique_id: elga5x
        scan_interval: 60
        slave: 100
        address: 404
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga System Flow" #varApFlowmeter
        unique_id: elg6
        scan_interval: 60
        slave: 100
        address: 410
        input_type: holding
        data_type: uint16
        unit_of_measurement: l/min
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Flow Temperature Setpoint" #varZoneTemperatureSetpoint
        unique_id: elga7
        scan_interval: 60
        slave: 100
        address: 1101
        input_type: holding
        data_type: uint16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.01
        precision: 1
      - name: "Elga Room Setpoint" #remeha_varZoneTRoomSetpoint
        unique_id: elga8
        scan_interval: 60
        slave: 100
        address: 1102
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.1
        precision: 1
      - name: "Elga Room Temperature" #varZoneTRoom
        unique_id: elga9
        scan_interval: 60
        slave: 100
        address: 1104
        input_type: holding
        data_type: int16
        device_class: temperature
        unit_of_measurement: °C
        state_class: measurement
        scale: 0.1
        precision: 1
      - name: "Elga Heating Energy Consumption" #varApChEnergyConsumption
        unique_id: elga10
        scan_interval: 60
        slave: 100
        address: 433
        input_type: holding
        data_type: int32
        device_class: energy
        unit_of_measurement: kWh
        state_class: total
        scale: 1
        precision: 1
      - name: "Elga Cooling Energy Consumption" #varApChEnergyConsumption
        unique_id: elga1011
        scan_interval: 60
        slave: 100
        address: 437
        input_type: holding
        data_type: int32
        device_class: energy
        unit_of_measurement: kWh
        state_class: total
        scale: 1
        precision: 1
      - name: "Elga Appliance Status 1"
        unique_id: elga101
        scan_interval: 60
        slave: 100
        address: 279
        input_type: holding
        data_type: uint16
      - name: "Elga Appliance Status 2"
        unique_id: elga102
        scan_interval: 60
        slave: 100
        address: 280
        input_type: holding
        data_type: uint16
    climates:
      - name: "Elga Ace eTwist Thermostat"
        unique_id: elga11
        scan_interval: 60
        slave: 100
        address: 1104
        target_temp_register: 1102
        input_type: holding
        data_type: int16
        max_temp: 35
        min_temp: 5
        precision: 1
        scale: 0.1
        temp_step: 0.5
        temperature_unit: C

Thx, I’ve got it working, it was a pain in the … to get the modbus working, i’ve read about the twist in A+ and B-. That was one off the issues I ran in, and than the communicationpart with the modbus device.

Next page of the chapter is to make a nice looking interface for in HA.

Any ideas or suggestions

Mvg Wilco

Congrats :slight_smile:

I can post a few screenshots of my setup. If there’s something you like I’m happy to share my configs.

I have an energy section in my main dash:

Which has a Heat Pump page:

Which links through to all the nitty gritty details:

I used that last page mainly to tweak elga parameters and see the result in energy usage.

That last page is more then cool, not shure if and or you would like to share that one.

Another question, in the yaml everything has an unique-id, where did you find it, it’s not in the modbus-list?

I would like to write the (almost) complete modbuslist. See if I can work this out, and to understand yaml.

Grts Wilco

Those IDs are random - they don’t matter as long as they are unique to your home assistant installation. It is an internal thing that helps HA identify each sensor.

The dashboard are these cards in sequence:

type: custom:history-explorer-card
header: " "
cardName: historycard-41805631
legendVisible: true
combineSameUnits: false
graphs:
  - type: line
    title: Temperatures
    options:
      height: 400
    entities:
      - entity: sensor.elga_flow_temperature
        color: "#FF5722"
        name: Flow
      - entity: sensor.elga_return_temperature
        color: "#00BCD4"
        name: Return
      - entity: sensor.elga_room_temperature
        fill: rgba(0,0,0,0)
        lineMode: stepped
        name: Room
        process: "( Math.abs(state) < 100 ) ? state : \"unavailable\""
      - entity: sensor.filtered_elga_outside_temperature
        color: rgba(124,179,66,1)
        fill: rgba(124,179,66,0)
        name: Outside
      - entity: sensor.elga_cop
        color: "#ebbf46"
        name: COP
        lineMode: stepped
        hidden: true
  - type: line
    title: " "
    options:
      showTimeLabels: false
    entities:
      - entity: sensor.shellyem3_3494547565ab_channel_b_power
        name: Energy usage
  - type: timeline
    entities:
      - entity: binary_sensor.elga_status_1_flame_on
        name: Gas
      - entity: binary_sensor.elga_status_1_heatpump_on
        name: Elga
type: custom:history-explorer-card
header: " "
defaultTimeRange: 3o
cardName: historycard-2
legendVisible: true
combineSameUnits: true
showCurrentValues: false
statistics:
  mode: min
  period: day
graphs:
  - type: line
    title: " "
    options:
      height: 300
      showSamples: true
    entities:
      - entity: sensor.kwh_per_degree_day
        fill: rgba(0,0,0,0)
        color: "#039BE5"
        name: kWh/DD
      - entity: sensor.kwh_per_degree_day_thermostat
        color: "#00897B"
        name: kWh/DD (thermostat)
        hidden: true
  - type: line
    title: " "
    options:
      height: 300
      showSamples: false
    entities:
      - entity: sensor.filtered_elga_outside_temperature
        color: green
        name: Outside temperature
  - type: bar
    title: " "
    options:
      interval: daily
      stacked: false
      height: 250
    entities:
      - entity: sensor.cumulative_degree_days
        name: Degree days
        color: "#E53935"
        unit: DD
      - entity: sensor.cumulative_degree_days_thermostat
        name: Degree days (thermostat)
        color: "#8E24AA"
        unit: DD
        hidden: true
  - type: bar
    title: " "
    options:
      interval: daily
      stacked: true
      height: 250
    entities:
      - entity: sensor.shellyem3_3494547565ab_channel_b_energy
        name: Heat pump
        color: "#FF5722"
        unit: kWh / m³
      - entity: sensor.gas_consumed
        name: Gas (total)
        color: "#4527A0"
        unit: kWh / m³

You’ll need the history explorer card. Note that the degree day calculations are custom. If you’re interested in those I can share the config for that too – but it is getting quite complicated and I want to check if you’re interested in that.

Hi @bastiaanterhorst it looks like you’ve solved most of the things I need for my use case:
Actually in my manual it says GTW-30 instead of GTW-08 for the Elga Ace. Do you know whether the GTW-08 may be used instead of the GTW-30?
What I want to achieve is to replace the 0-10V output port of the ELGA Ace with a DAC output of an ESP32 Arduino. The 0-10V output actually does not work (properly), It should give a signal 0 to 10V proportional to the required power from the gas heater (Calenta). Unfortunately the output is 0V -OR- 10V. Which is useless. So I hope to read that signal through the Modbus interface.
Any idea whether that value is available??
The second implementation which I want to achieve is to write the current EPEX spot market price to the Elga Ace. This in turn should improve/ optimise the calculation in the Elga Ace if and when an how much energy should come from the gas heater instead of the heat pump. In this way I could optimize using the dynamic EPEX prices on the spot market.
Any idea whether this value is also available through the Modbus interface for writing?

So I do hope the GTW-08 would work also for me.
Could you please let me know which Modbus to Wifi gateway you are using? Is it - by chance - the RS485 to WiFi gateway from spotpear/ wavechare??
Which integration are you using for that one? From HACS? Could you share the configuration/ setup for this gateway?
Last not least could you share the documentation of the GTW-08 including the Modbus address table with me/us?