New Integration: Grünbeck softliQ

Hallo zusammen,

ich komme mit den Sensoren noch nicht ganz klar. Ich habe eine Softliq SC18 und mir werden nur die Werte im Anhang angezeigt.

Einrichtung hat soweit alles geklappt.

Wie bekomme ich den aktuellen Weichwasserverbrauch am Tag hin?
Ich sehe immer nur den Wert von gestern.

Vielen Dank.

Mit freundlichen Grüßen
Benjamin

IMG_3084|690x463

hello is it required to update the admin adapter @ the iobroker? because after that i can’t connect to the ui anymore…
i need to update the adapter for mqtt … i’m stuck

can someone tell me why i’m not receiving any information of my device?

I think the update procedure in the addon is broken. Maybe installing iobroker via docker directly is better:

https://www.libe.net/iobroker

or if you have proxmox via lxc:

but this solution is so bad. Someone has to adapt this directly to homeassistant. The Login procedure is documented here, i think it is very easy to adapt it to homeassistant but i have no progaming skills:

1 Like

i have adapted the login part of the iobroker gruenbeck adapter to python:

It does not work yet, but I’m on vacation from tomorrow. In 2 weeks I’ll look again. If others here have python experience they can use my code and work on it.

Can you (or someone else) create an example curl out of that? Not that familiar with that oauth bearer foo - and would love to have a super slim integration in the config yaml.

Next problem would be, that the rest platform integration can’t use bearer tokens… Would be nice to see that in the future. (like this: Rest sensor - Dynamic Bearer Token (Using Sensor) - #2 by Gautch)

I had a working ioBroker integration the last months but the ioBroker addon is not working since a few weeks and the owner of the repository is quite silent. A smaller integration would be much appreciated…

1 Like

Hey,
I got the initial library working to get the basic info from the Gruenbeck-Cloud, also in an async matter :slight_smile:

But for the streaming part it seems that a websocket needs to be implemented. As I just started with python programming: Does anybody knows from an integration which uses a websocket connection to communicate with a “device” in an async-way?

Regards
Joerg

can you post your code ?
Or link github repo?

Hi @gomble,

sorry for the late reply I was distracted by personal stuff.
Till now I don’t have a github repo (it is my first time I started with coding not for my own).

So the progress:

  • Login is working
  • I get the devices
  • I get all needed/wanted stuff from the Rest-API (basic info, parameters, measurements)

Regarding the “Stream” info (receiving the real usage) I’m a bit lost :frowning:
I tried to understand the source-code of the ioBroker adapter and also found an interessting github-repo (GitHub - haizz94/gruenbeck-prometheus-exporter: Simple prometheus exporter for Grünbeck's water softener devices), additionally I tried to understand the work from @frenck regarding his python-wled library and the use of websockets, but the Gruenbeck stuff is “strange”.
You have to open a websocket and then somehow “enter” the SD-device and also “refresh” the SD-device, but the only thing I get from the websocket is a “CLOSE” message.

I’m a bit lost here

1 Like

So here is my first try (it is my first time I’m programming in Python so please be polite :slight_smile: )

As stated above, I’m lost regarding this websocket and how to receive the “Stream” info

6 Likes

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:
2023-11-18 10_06_41-Overview – Home Assistant - Iron

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. :slight_smile:

3 Likes

not working with SD21
curl: “Failed to connect to 192.168.1.120 port 80…”

Does the SD21 have a web interface like below?

If not it cannot be reached locally…

No only via app mybe also webversion. I wrote that th SD21 hast a MQTT Interface, but this feature was deleted with an update.
I use iobroker with softliQ Integration and MQTT to transfer the data to HomeAssistent - dirty way, but it works :slightly_frowning_face:

hey your solution is good, i tested it i am getting info from the api.
Puting this info in a integration would be the next step?

1 Like

Hey @gomble ,

But only the basic info can be received. The important values (the stream values), which are only accessible through the websocket are not received as I don’t really understand this websocket-stuff within the gruenbeck implementation.

If this is solved and all info are available through the python library you are right, the next step would be an integration.

1 Like

I used the way to get the data via iobroker and sent it to home assistant.
It worked until June 2023 - now it does not work.

Does anyone have an idea?

I am using a softliq SD:21

I just started this week going deeper into the topic to get the data for my softIQ into homeassistant.

I was able to get the data from the Cloud including Websocket data, and started now to implement a integration.

I think I will have a first working version until end of next week, as soon as it’s kind of stable I will upload it to GitHub and provide it as an HACS Custom Integration.

Does someone know which information is relevant to be provided via the integration? As far as I have seen, there is a lot of information given back from the API.

In the first implementation, I’m focusing on the data as described here: https://www.plauder-blog.de/gruenbeck-daten-in-home-assistant-unraid-server/

8 Likes

That’s great news. I will directly test it when available! :+1:

1 Like

Here is a small update about current status. There are still some bugs and some missing information, but the Websocket information is being pushed successfully into HA.

6 Likes