OEG KMS solarboiler data 2 MQTT home assistant

My OEG-KS2W boiler installation is in the attic as well as my raspberry pi 4B 2 GB.
Debian is installed on the RPI and has been in use for some time for VirtualHere server, among other things.
The RPI is connected to the OEG-KS2W via a USB cable.
Virtualhere ensures that COM3 can be forwarded to my Windows 10 laptop via WiFi.
The “Software zum KMS-D” is installed on the laptop so that I can connect to the OEG-KS2W via WiFi and the RPI.

By chance I found the site OEG KMS data in Home Assistant – Welcome to DIY! and I also wanted some parameters
of my OEG-KS2W in my home assistant.
I have installed the “github software” on the existing RPI software.
Installed all software from my user (robert) account.

Starting the oeg_kmsd.service always produced the following error

  Loaded: loaded (/lib/systemd/system/oeg_kmsd.service; enabled; vendor pres>
  Active: activating (auto-restart) (Result: exit code) since Mon 2023-05-22>
 Process: 8508 ExecStart=/usr/bin/python3 /home/pi/oeg_kmsd/oegscan_mqtt.py >
Main PID: 8508 (code=exited, status=1/FAILURE)
     CPU: 87ms

lines 1-6/6 (END)

By manually running the command “/usr/bin/env python3 /home/robert/oeg_kmsd/oegscan_mqtt.py” via:
Also found somewhere to put "env " in the line, to solve an error, I don’t remember it anymore,

sudo /usr/bin/env python3 /home/robert/oeg_kmsd/oegscan_mqtt.py I was able to solve several problems:

I have therefore adapted the service line accordingly.

The following modules did not work or did not work properly: minimalmodbus,pyserial,paho-mqtt.
Perhaps because apparently multiple versions of Python are installed on my RPI.
With the help of “google” I was able to solve these errors, but I still couldn’t start the service,
because there was no connection to the OEG-KS2W device.

Using google and this command:

sudo python -m serial.tools.miniterm , got me a list of my RPI serial ports:

Available ports:
— 1: /dev/ttyACM0 ‘SELTRON HEATING CONTROLLER’
— 2: /dev/ttyAMA0 ‘ttyAMA0’
— Enter port index or full name: 1
— Miniterm on /dev/ttyACM0 9600,8,N,1 —
— Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
— unknown menu character Ctrl+[ –
I then modified the “oegscan_mqtt.py” as follows:

instrument = minimalmodbus.Instrument(’/dev/ttyACM0’, 128, minimalmodbus.MODE_ASCII) # port name, slave address (in decimal)
#Change the COM port above to the OEG Usb comport or USB address on Linux.
instrument.serial.baudrate = 9600 # Baud
instrument.serial.parity = serial.PARITY_NONE
instrument.serial.bytesize = 8
instrument.serial.stop bits = 1
instrument.serial.timeout = 0.05 # seconds

Now the service starts without errors and the MQTT connection between OEG-KS2W > RPI > Home Assistant works without problems

My HA runs on an Odroid C4 as HomeAssistant OS;
To make the KS2W entities work in HA I also modified the configuration.yaml:

#MQTT sensors
mqtt:
sensor:
- name: “Roof T1”
unique_id: “Roof_T1”
state_topic: “home-assistant/oeg/OegT1”
state_class: “measurement”
unit_of_measurement: “C”

 - name: "Boiler low T2"
   unique_id: "Low_T2"
   state_topic: "home-assistant/oeg/OegT2"
   state_class: "measurement"
   unit_of_measurement: "C"

 - name: "Boiler high T3"
   unique_id: "High_T3"
   state_topic: "home-assistant/oeg/OegT3"
   state_class: "measurement"
   unit_of_measurement: "C"

 - name: "OEG pump"
   unique_id: "OEG_pump"
   state_topic: "home-assistant/oeg/oegpump"
   unit_of_measurement: "%"

It remains to be seen why the Oeg pump does not provide data, but this will also be fine.

regards
robert
translation from dutch to english with google translate.

to start the service you need to edit oeg_kmsd.service in the file the user is pi, your user is robert.

hello,

can someone help me with this I have every time te same error.


I won’t start. I’ve reset and reinstalled the raspberry w but noting helps.

Remco read the message above.

hi i’ve try the message above but it won’t work.


You need to edit the service file

It is working fine now

1 Like

Remco
can you do
sudo /usr/bin/env python3 /home/pi/oeg_kmsd/oegscan_mqtt.py
and tell me what the error is you get?

I see you are also working from your emco account, try to login to the pi account or change your oeg_kmsd service file to : /usr/bin/env python3 /home/remco/oeg_kmsd/oegscan_mqtt.py

robert

when I do sudo /usr/bin/env python3 /home/pi/oeg_kmsd/oegscan_mqtt.py I got this.


sorry I’m new in HA how can I login to my pi I use now putty to login without emco ?

I think your “oegscan_mqtt.py” file is not in the “pi” directory but in a “remco” directory, send me an email.
robert

Hi Yannic,

I have a small question about the configuration. I have running a RB-PI -4Gb, running with HA. I have connect the OEG to this device with a USB-cable. Is it possible to read out the OEG direct into HA?

I like to hear from you!
Seltron to USB

I read this post several times but can’t get it working. I’m all new to HA and Pi etc. so I learn a lot form trying, but it’s becoming a frustration :-). Service won’t start, stating:

Any help on that?thanks a lot!

When you start oegscan_mqtt.py, do you get any values?
and can send you a screenshot of oeg_kmsd.service

Stefan, thank you for responding. How do I start oegscan_mqtt.py ?

if you are in the folder oeg_kmsd then type: python3 oegscan_mqtt.py

U are working from your harco account, try to change your oeg_kmsd service file to : /usr/bin/env python3 /home/harco/oeg_kmsd/oegscan_mqtt.py

thanx again. Just another error:

Scherm­afbeelding 2024-09-17 om 12.50.14

Hi Harko, I had the same kind of issues with installing this service. In my case the mqtt integration was not starting well, when I remember it well it had to do with the newest version of python on the PI-2 (which I connected to my OEG). It was not compatible with the older code we are using with this service. I had to downgrade from version 2 to 1.6. It was kind of a struggle, but in the end I got it working. Except for the pump RPM’s.

can you take a screenshot of oegscan_mqtt.py

thanks for helping me out! Sorry for taking your time, but I can’t get it working.

I assume that you have connected the kms to the pi with a USB cable, change com3 to /dev/ttyACM0 and then try again with oeg_kmsd then type: python3 oegscan_mqtt.py