I own a Gruenbeck softliQ:SC18 from 2016 which can still be accessed locally via TCP. Based on the information in this thread and in this one I also managed to connect my “Enthärtungsanlage” (German for desalination system) to Home Assistant. Here is my set-up:
In configuration.yaml I have the following entries:
# Loads default set of integrations. Do not remove.
default_config:
python_script:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
command_line:
- sensor:
name: gruenbeck
command: "/usr/bin/python3 /home/homeassistant/.homeassistant/python_scripts/gruenbeck.py"
json_attributes:
- code
- durchfluss
- restkapazitaet
- restdauer_wartungsintervall
- seit_regeneration
- regeneration_progress
- wasserverbrauch
- anlagenkapazitaet
- salzreichweite
- aktueller_regenerationsschritt
- restdauer_regeneration
value_template: "{{ value_json }}"
scan_interval: 120
template:
- sensor:
- name: "Grünbeck Durchfluss"
unit_of_measurement: "l"
state: "{{ state_attr('sensor.gruenbeck', 'durchfluss') }} "
- name: "Grünbeck Restkapazität"
unit_of_measurement: "m³"
state: "{{ state_attr('sensor.gruenbeck', 'restkapazitaet') }} "
- name: "Grünbeck Zeit seit Regeneration"
unit_of_measurement: "h"
state: "{{ state_attr('sensor.gruenbeck', 'seit_regeneration') }} "
- name: "Grünbeck Protzentsatz Regeneration"
unit_of_measurement: "%"
state: "{{ state_attr('sensor.gruenbeck', 'regeneration_progress') }} "
- name: "Grünbeck Wasserverbrauch pro Tag"
unit_of_measurement: "l/d"
state: "{{ state_attr('sensor.gruenbeck', 'wasserverbrauch') }} "
- name: "Grünbeck Anlagenkapazität"
unit_of_measurement: "m³"
state: "{{ state_attr('sensor.gruenbeck', 'anlagenkapazitaet') }} "
- name: "Grünbeck aktueller Regenerationsschritt"
unit_of_measurement: ""
state: "{{ state_attr('sensor.gruenbeck', 'aktueller_regenerationsschritt') }} "
- name: "Grünbeck Restdauer Regeneration"
unit_of_measurement: "min"
state: "{{ state_attr('sensor.gruenbeck', 'restdauer_regeneration') }} "
Then in my /home/homeassistant/.homeassistant/
folder (I’m running HA Core on Raspberry Pi 4/2GB) I created a /python_scripts
folder. In this folder I placed the gruenbeck.py
file containing the python code to poll the SC18. The code is as follows:
#!/usr/bin/python3
import json
import requests
# curl -X POST -i 'http://192.168.24.80/mux_http' --data 'id=670&show=D_A_1_1|D_A_1_2|D_A_2_2|D_A_3_1|D_A_3_2|D_Y_1|D_A_1_3|D_A_2_3|D_Y_5|D_A_2_1~'
url = "http://192.168.188.38/mux_http"
data="id=625&show=D_A_1_1|D_A_1_2|D_A_2_2|D_A_3_1|D_A_3_2|D_Y_1|D_A_1_3|D_A_2_3|D_Y_5~"
content="<data><code>nok</code><D_A_1_1>0.00</D_A_1_1><D_A_1_2>0.00</D_A_1_2><D_A_2_2>000</D_A_2_2><D_A_3_1> 0</D_A_3_1><D_A_3_2>000</D_A_3_2><D_Y_1>000</D_Y_1><D_A_1_3>0.0</D_A_1_3><D_A_2_3>00</D_A_2_3><D_Y_5>0</D_Y_5></data>"
try:
resp = requests.get(url,data=data)
#print(resp.status_code)
#print(resp.text)
#print(resp)
except BaseException as err:
# Log out the error to the openHAB console for better investigation
print("Grünbeck:", "POST request failed: {0}".format(err))
#content="<data><code>ok</code><D_A_1_1>0.00</D_A_1_1><D_A_1_2>0.28</D_A_1_2><D_A_2_2>000</D_A_2_2><D_A_3_1> 8</D_A_3_1><D_A_3_2>100</D_A_3_2><D_Y_1>309</D_Y_1><D_A_1_3>6.1</D_A_1_3><D_A_2_3>99</D_A_2_3><D_Y_5>0</D_Y_5><D_A_2_1>0.0</D_A_2_1></data>"
else:
content=resp.text
import re
#print("resp=",resp.text)
#print("content=",content)
code = re.findall(r'<code>(\w+)<\/code>',content)[0]
da11 = re.findall(r'<D_A_1_1>([0-9\.]+)<\/D_A_1_1>',content)[0] # aktueller Durchfluss (m3/h)
da12 = re.findall(r'<D_A_1_2>([0-9\.]+)<\/D_A_1_2>',content)[0] # Restkapazität (m3)
da22 = 0#re.findall(r'<D_A_2_2>([0-9\.]+)<\/D_A_2_2>',content)[0] # Restdauer Wartungsintervall (d)
da31 = re.findall(r'<D_A_3_1> *([0-9\.]+)<\/D_A_3_1>',content)[0] # Zeit seit letzer Regeneration (h)
da32 = re.findall(r'<D_A_3_2>([0-9\.]+)<\/D_A_3_2>',content)[0] # Protzentsatz der laufenden Regeneration (%)
dy1 = re.findall(r'<D_Y_1>([0-9\.]+)<\/D_Y_1>',content)[0] # wasserverbrauch pro Tag (l)
da13 = re.findall(r'<D_A_1_3>([0-9\.]+)<\/D_A_1_3>',content)[0] # Anlagenkapazität
da23 = re.findall(r'<D_A_2_3>([0-9\.]+)<\/D_A_2_3>',content)[0] # Salzreichweite (nur bei SC23)
dy5 = re.findall(r'<D_Y_5>([0-9\.]+)<\/D_Y_5>',content)[0] # Aktueller Regenerationsschritt (0,1-5)
#da21 = re.findall(r'<D_A_2_1>([0-9\.]+)<\/D_A_2_1>',content)[0] # # Restdauer oder Restmenge aktueller Regenerationsschritt
#print(code,da11,da12,da22,da31,da32,dy1,da13,da23,dy5,da21)
print(f'{{"code":"{code}","durchfluss":{da11},"restkapazitaet":{da12},"restdauer_wartungsintervall":{da22},"seit_regeneration":{da31},"regeneration_progress":{da32},"wasserverbrauch":{dy1},"anlagenkapazitaet":{da13},"salzreichweite":{da23},"aktueller_regenerationsschritt":{dy5} }}')
With this python code and the trigger in configuration.yaml I’m polling the SC18 every two minutes. In Home Assistant I created a simple card to display the essential values:
The yaml for this card is as follows:
type: entities
entities:
- entity: sensor.grunbeck_anlagenkapazitat
- entity: sensor.grunbeck_restkapazitat
- entity: sensor.grunbeck_durchfluss
- entity: sensor.grunbeck_wasserverbrauch_pro_tag
- entity: sensor.grunbeck_protzentsatz_regeneration
- entity: sensor.grunbeck_zeit_seit_regeneration
- entity: sensor.grunbeck_aktueller_regenerationsschritt
title: Grünbeck SoftLiq SC18
This set-up works fine with my SC:18. Sometimes there is an error in the log stating that no reply is coming from Gruenbeck, but I guess that’s a performance problem of the (very poor) web interface of the Gruenbeck system.