OEG KMS solarboiler data 2 MQTT home assistant

Hello everybody,

I made this MQTT integration for my OEG Kms solar boiler controller.
Currently it reads and publishes all the available temp. sensors to home assistant via MQTT.
T1 - Roof temp sensor
T2 - Boiler temp sensor low
T3 - Boiler temp sensor high
Pump - Shows the modulated power % of the glycol pump.

The OEG controller uses the modbus protocol over usb as found by ced2dom on the domoticz forum: https://www.domoticz.com/forum/viewtopic.php?t=18029

I forked his version of the code on github and changed it to work with Home-assisant and the built in mosquitto MQTT: https://github.com/Yannicflight/oeg_kmsd

Hey Yannic,

I’m using Home Assistant for two years now. Mostly for Hue lights and the thermostat, so I’m no pro with all integrations yet. Last year we’ve moved to a new house where we want to automate or connect more and more devices.

One of those devices is also a OEG KSW solar boiler controller, which I like to connect as well. The boiler vessel is located in the garage, where I have power and two internet cables for connection. What kind of device do I need to connect the OEG KSM to the Home Assistant network?

ps: I guess you’re Dutch as well, if that is easier.

Hi Roel, I will send you a Pm.

Hey Yannic,

how do you get this package to run. MQTT is running, the sensors are defined in the configuration.yaml.
But how do you get the “oegscan_mqtt.py” to run.

The OEG controller is attached to my Raspberry Pi and ready as a device.

Thanks in advance


how did you start the python script in HASS

Hey Dennis,
The python script is not running in HASS, Yannic and I use a Raspberry zero W, what is connected to the OEG KMS with USB (and a power supply of course).
The script is running in an Ubuntu environment. If you send me a personal message, I’ll send you the info i received from Yannic

@Yannicflight can you tell me de usual gap between your “boiler temp sensor low” and “boiler temp sensor high”? I’m assuming these are two temperature sensor, one located in the bottom, and the other at the top of the boiler. I just inserter a temperature sensor on top position of my boiler, but it gives me a temperature much lower than actual water temperature. Still wondering what’s going on there.

Hello Roel,

can you also share the information with me, I have just placed an instalation at home with the kws and would like to read it, and eventually also display it on my raspberry.

Thanks for the effort,

kan je de informatie ook met mij delen, ik heb zojuist een instalatie thuis geplaatst met de kws en wil deze graag uitlezen, en uitindelijk ook op mijn raspberry weergeven.

Draait het mogelijk ook op een pico?
alvast bedankt voor de moeite,

Hey Stefan,
No problem, could you send me your email address in a personal message? I’ll send you the info.

I just don’t see the icon anywhere to send you a personal message

I’ve managed to get a kind of system view like the energy dashboard for my solar boiler!
The only detail I haven’t got working yet is the ‘kWh’ after the stored energy in the boiler (the value of 3.4332)

2022-10-13 13_15_02-Graphs – Home Assistant

To get this working, you need to use the ‘Tesla-style-solar-power-card’, which can be installed through HACS.

The temperature of the boiler needs to be converted to stored energy in kWh.
I’ve set 20 degrees Celcius as 0 kWh stored and have a 500L boiler:


#Battery sensors OEG Boiler tank 500L
  - platform: template
        unit_of_measurement: "kWh"
        device_class: power
        icon_template: mdi:lightning-bolt
        value_template: >
            {% set value1 = states('sensor.boiler_laag_t2') %}
              {{  ((((value1|float ) - (20|float)) * (0.5819|float)) |round(2, default="not available") ) }}

  - platform: template
        unit_of_measurement: "kW"
        device_class: power
        icon_template: mdi:thermometer-plus
        value_template: >
            {{ max(0, states('sensor.boiler_derivative') | float(default=0)) }}

  - platform: template
        unit_of_measurement: "kW"
        device_class: power
        icon_template: mdi:thermometer-minus
        value_template: >
            {{ max(0, 0 - states('sensor.boiler_derivative') | float(default=0)) }}

  - platform: template
        unit_of_measurement: "kW"
        device_class: power
        friendly_name: 'Gas usage in kW'
        icon_template: mdi:meter-gas-outline
        value_template: >
            {{ ((states.sensor.gas_consumption.state | float * 10 )) | round(2) }}

# Sensors

  - platform: integration
    source: sensor.boiler_energy_charging
    name: "Total boiler energy charged"
    method: left
  - platform: integration
    source: sensor.boiler_energy_discharging
    name: "Total boiler energy discharged"
    method: left
  - platform: integration
    source: sensor.gas_usage_kw
    name: "Gas usage in kW"
    method: left

The lovelace card has the following setup:

type: custom:tesla-style-solar-power-card
show_w_not_kw: 0
name: Boiler energie
generation_to_battery_entity: sensor.boiler_energy_charging
battery_to_house_entity: sensor.boiler_energy_discharging
grid_to_house_entity: sensor.gas_usage_in_kw
battery_extra_entity: sensor.boiler_energy_stored
generation_extra_entity: sensor.dak_t1
house_extra_entity: sensor.temperatuur_woonkamer
grid_entity: sensor.gas_consumption
house_entity: climate.woonkamer
generation_entity: sensor.dak_t1
battery_entity: sensor.boiler_energy_stored
grid_icon: mdi:fire
generation_icon: mdi:solar-power-variant
house_icon: mdi:home
battery_icon: mdi:water-boiler
change_house_bubble_color_with_flow: 1
show_gap: true

Hi all!

I’ve just got a OEG boiler + KWS device up and running. It would be great if someone could help me setting up. Is there somebody (dutch) who can help me out? Any more information left?


Hi Bernd,

I can help you out and I will send you a DM.

Hi Yannic,
I’ve just send Bernd all the info you send me to set up the whole thing :slight_smile:

@Roelv @Yannicflight Could you guys send me the information to get my KSW-E to be monitored in HA too?

Alvast bedankt!

Hi Sparkelende,

Could you send me your e-mail in a PM?

1 Like

Great! Thanks :smiley:

Can you resend them to me as well?
I want to add it to the Github repo so it is a bit clearer

Thats a good idea :slight_smile: I’ll send you the email and files.