New Integration: Grünbeck softliQ

This issue is a request for a new integration.
The entry is split into multiple replies because as a new user I am only allowed to add two links per post. I want to add as much context as I have, that’s why I do multiple posts.

General information

API

Request

curl --data-binary "id=8151&show=D_A_1_1|D_A_1_2|D_A_1_3|D_C_2_1|D_A_2_1|D_A_2_2|D_A_3_1|D_A_3_2|D_C_5_1|D_Y_5|D_Y_6|D_Y_7|D_Y_10|D_Y_2_1|D_Y_2_2|D_Y_2_3|D_Y_2_4|D_Y_2_5|D_Y_2_6|D_Y_2_7|D_Y_2_8|D_Y_2_9|D_Y_2_10|D_Y_2_11|D_Y_2_12|D_Y_2_13|D_Y_2_14&code=0~" 'hxxp://192.168.178.29/mux_http'

Response

<data>
    <code>ok</code>
    <D_A_1_1>0.00</D_A_1_1>
    <D_A_1_2>0.17</D_A_1_2>
    <D_A_1_3>6.2</D_A_1_3>
    <D_C_2_1>0</D_C_2_1>
    <D_A_2_1>0.0</D_A_2_1>
    <D_A_2_2>000</D_A_2_2>
    <D_A_3_1> 9</D_A_3_1>
    <D_A_3_2>82</D_A_3_2>
    <D_C_5_1>0</D_C_5_1>
    <D_Y_5>0</D_Y_5>
    <D_Y_6>V01.01.02</D_Y_6>
    <D_Y_7>-</D_Y_7>
    <D_Y_10> 68</D_Y_10>
    <D_Y_2_1>165</D_Y_2_1>
    <D_Y_2_2>273</D_Y_2_2>
    <D_Y_2_3>137</D_Y_2_3>
    <D_Y_2_4>110</D_Y_2_4>
    <D_Y_2_5>271</D_Y_2_5>
    <D_Y_2_6>85</D_Y_2_6>
    <D_Y_2_7>145</D_Y_2_7>
    <D_Y_2_8>130</D_Y_2_8>
    <D_Y_2_9>256</D_Y_2_9>
    <D_Y_2_10>261</D_Y_2_10>
    <D_Y_2_11>126</D_Y_2_11>
    <D_Y_2_12>116</D_Y_2_12>
    <D_Y_2_13>121</D_Y_2_13>
    <D_Y_2_14>112</D_Y_2_14>
</data>

Context

Above is the API call for this iPhone App view (numbers might differ):

Implementation

At first, I would suggest a read-only implementation.

Parameter Type Example
ip string 192.168.178.29

What this issue is about

This issue is not an “I want this, please do this”-thing.
I open this issue for three main reasons

  1. To check back with you (the project owners/the community) if a native Home Assistant Integration is welcomed (before putting the work in)
  2. To write down all details of the integration and discuss a potential design/implementation with you (e.g. to get the best solution, answer open questions)
  3. To mark who is doing the implementation and save time in case of double work. I am not expecting that you (the project owners/the community) are doing the integration and i am the person who benefits. I might be do the implementation myself and contribute back. Maybe someone is faster, has a local branch ready somewhere or is just keen to learn how to do it.

Especially 1. and 2. might decrease the time inside a Pull Request because details are often clarified already.

Open questions

  1. Is a native integration welcomed? Or is the platform: command_line-way (described in the community forum) the solution?
  2. Can someone from the community confirm the API? (e.g. if you own such a system at home)
  3. Do you have any open questions?

In general, *please let me know what you think about this.

Integrations of other systems

API Documentation

While browsing, I found a Homematic forum entry (see Script für SC18 Grünbeck Enthärtungsanlage (language is german). This post had documentation attached. It describes all parameters for read- and write access: Webserver_Dokumentation.pdf

Community work

There seems to be an alternative implementation by using the platform: command_line.
See Gruenbeck Soft Water sensor Durchfluss @ Home Assistant Community Forum.

Grünbeck did change the approach for the SD series of devices, no local API any more, but the Cloud API can be accessed as demonstrated here

https://forum.fhem.de/index.php?topic=110323.45 (GERMAN)

I happen to own an SD18 since yesterday and luckily enough still run FHEM in parallel to Home Assistant, so I exposed the FHEM device values to MQTT and can use them in Home Assistant.


A native Home Assistant integration would still be nice.

2 Likes

Hello,

is there any progress or howto to get it into homeassistant?

Best regards,
Stefan

1 Like

I have sent an email to Grünbeck.
I got an email back, that they are working on some api to get it connected to homeautomation systems!

Best regards

2 Likes

Here is a Solution for FEHM:

and here for IOBroker:

this is the part for authenticating with the cloud api (fehm solution):

sub authenticate {
    my $hash = shift;
    my $name = $hash->{NAME};

    # if ( AttrVal( $name, 'sq_user', '' ) eq '' || AttrVal( $name, 'sq_password', '' ) eq '' ) {
    #     return "Please maintain user and password attributes first";
    # }

    if ( !exists &{"urlsafe_b64encode"} ) {
        Log3 $name, 1, "urlsafe_b64encode doesn't exist. Exiting";
        return;
    }

    my $auth_code_verifier
        = urlsafe_b64encode( join( '', map { ( 'a' .. 'z', 'A' .. 'Z', 0 .. 9 )[ rand 62 ] } 0 .. 31 ) );
    $auth_code_verifier =~ s/=//xsm;
    $hash->{helper}{code_verifier} = $auth_code_verifier;
    my $auth_code_challenge = urlsafe_b64encode( sha256($auth_code_verifier) );
    $auth_code_challenge =~ s/\=//xsm;
    readingsSingleUpdate( $hash, 'code_challenge', $auth_code_verifier, 0 );

    my $param->{header} = {
        "Accept"          => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "Accept-Encoding" => "br, gzip, deflate",
        "Connection"      => "keep-alive",
        "Accept-Language" => "de-de",
        "User-Agent" =>
            "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1"
    };
    my $url
        = "https://gruenbeckb2c.b2clogin.com/a50d35c1-202f-4da7-aa87-76e51a3098c6/b2c_1a_signinup/oauth2/v2.0/authorize?state=NzZDNkNBRkMtOUYwOC00RTZBLUE5MkYtQTNFRDVGNTQ3MUNG"
        . "&x-client-Ver=0.2.2"
        . "&prompt=select_account"
        . "&response_type=code"
        . "&code_challenge_method=S256"
        . "&x-client-OS=12.4.1"
        . "&scope=https%3A%2F%2Fgruenbeckb2c.onmicrosoft.com%2Fiot%2Fuser_impersonation+openid+profile+offline_access"
        . "&x-client-SKU=MSAL.iOS"
        . "&code_challenge="
        . $auth_code_challenge
        . "&x-client-CPU=64"
        . "&client-request-id=FDCD0F73-B7CD-4219-A29B-EE51A60FEE3E&redirect_uri=msal5a83cc16-ffb1-42e9-9859-9fbf07f36df8%3A%2F%2Fauth&client_id=5a83cc16-ffb1-42e9-9859-9fbf07f36df8&haschrome=1"
        . "&return-client-request-id=true&x-client-DM=iPhone";
    $param->{method}   = "GET";
    $param->{url}      = $url;
    $param->{callback} = \&parseAuthenticate;
    $param->{hash}     = $hash;

    #$param->{ignoreredirects} = 1;

    Log3 $name, LOG_DEBUG, "1st Generated URL is $param->{url}";

    my ( $err, $data ) = HttpUtils_NonblockingGet($param);
    return;
}

can anyone adapt this to homeassistant ?

or here

Got a mail from Grünbeck Support today:

Sehr geehrter Hr. —,

besten Dank für Ihr Feedback.

Für das Jahr 2021 hat sich die Entwicklung auf die Agenda gesetzt eine offene API via. MQTT zu realisieren um auch den kleinen Teil an Kunden, meist sehr technisch Affiner Kundenteil, zufrieden zu stellen.

Wie, Wann und Welche Schritte in Zukunft genau abgefragt werden können, kann ich zu jetzigem Zeitpunkt noch nicht sagen.
Die Funktion der MQTT Schnittstelle kann zum Zeitpunkt des Releases mittels Softwareupdate an der Anlage softliQ:SD/MD heruntergeladen werden.

In Vergangenheit hat man zwischen einer REST und MQTT Schnittstelle abgewogen und sich für das MQTT Protokoll entschieden, ich hoffe Sie haben hierfür Verständnis.

Is there any news ? Does anybody did hear something from Grünbeck ?

Today I got this email from Grünbeck:

Sehr geehrter Herr -,

zunächst vielen Dank für Ihre Anfrage.

Das MQTT Protokoll steht der Entwicklung bereits zu den ersten Tests zur Verfügung.

Einen konkreten Termin wann der Release konkret erscheint, kann ich allerdings zu jetzigem Zeitpunkt noch nicht sagen, ich hoffe Sie haben hierfür Verständnis.

1 Like

Any news did you hear something?

no, not yet.

Grünbeck wrote me:

Sehr geehrter Herr xxx,

 

Unsere Entwicklung ist derzeit noch an einer Implementierung der Schnittstelle beschäftigt.

Wann dieses Feature zur Verfügung steht können wir zu jetzigem Zeitpunkt noch nicht sagen.

 


Mit freundlichen Grüßen

So nothing new

:roll_eyes::roll_eyes::roll_eyes: they are slow

but what i not understand is why does iobroker has a integration ?

There must be already a api ?
See here, iobroker connects to an api: ioBroker.gruenbeck/main.js at f3054622ddc6a9da6dce71b74879d5b55de87f74 · TA2k/ioBroker.gruenbeck · GitHub

Hi,
yes there is an API, but to access it you need to first gain a token from Grünbeck login page. With it you can access api and gain data. This is done with an SD21
If you enter this adress
https://prod-eu-gruenbeck-api.azurewebsites.net/api/devices/softliQ.D/BS… (Whereas BS… is your device ID) you get forwarded to sign up here
https://gruenbeckb2c.b2clogin.com/a50d35c1-202f-4da7-aa87-76e51a3098c6/b2c_1a_signinup/oauth2/v2.0/authorize?response_type=id_token&redirect_uri=https%3A%2F%2Fprod-eu-gruenbeck-api.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback&client_id=5a83cc16-ffb1-42e9-9859-9fbf07f36df8&scope=openid+profile+email&response_mode=form_post&nonce=802a5038445043b89ef9a5a0093cd037_20211129210417&state=redir%3D%2Fapi%2Fdevices%2FsoftliQ.D%2F and after signing up you get acess to api


So manually it is working to acess the API, but no idea how to automate it and bring it online in HA…

And don´t forget to vote for it :wink:

5 Likes

yes its working, can access my softliq

Is help still needed?
I’ve written a .NET Application running under ubuntu which connects to the API and post the JSON content into a mqtt-queue or to another REST-Service.

1 Like

Ist your Code Open Soruce ?