Binding Request: Judo Entkalkungsanlagen


(Zippochonda) #1

We have a decalcification system from the company Judo (https://judo.eu/produkt/judo-i-soft-plus-vollautomatische-enthaertungsanlage/), which I have queried so far with a rule.
Unfortunately, with the conversion to 2.4, the query no longer works due to an SSL error. (sendHttpGetRequest not working under OH 2.4 M7 after Update from 2.3)

I have done the following so far:
Installation of the certificate for the decalcification system

Loaded the crt to /home/openhabian

export JAVA_HOME=/usr/lib/jvm/zulu-embedded-8-armhf

keytool -importcert -file /home/openhabian/PeterBauer.crt -keystore $JAVA_HOME/jre/lib/security/cacerts -alias Judo

Used the password: changeit

The rule so far has been this:

val String BENUTZER= "USER"
val String PASSWORD= "PW"
val String GERAETEID= "XXXXXX"
val String JUDOIP= "192.168.178.28"
val String PORT= "8124"


rule "Judo"
when
    Item residual_hardness_setpoint changed or
    Item watervalveswitch changed or
    Time is midnight or
    Time is noon

then
logInfo("Judo","1")
	var String tokenjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=register&command=login&msgnumber=2&name=login&user=" + BENUTZER + "&password=" + PASSWORD + "&role=customer")

logInfo("Judo","2")
	var String TOKEN = transform("JSONPATH", "$.token", tokenjson)

logInfo("Judo","3")
	var String loginjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=register&command=connect&msgnumber=5&token=" + TOKEN + "&parameter=i-soft%20plus&serial%20number=" + GERAETEID)

logInfo("Judo","4")
    var String LOGINSTATUS = transform("JSONPATH", "$.status", loginjson)

    if (LOGINSTATUS == "ok")
    {
        logInfo("Judo","Login erfolgreich")

        var String wcjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=water%20current&msgnumber=1&token=" + TOKEN )
        var String var_water_current = transform("JSONPATH", "$.data", wcjson)
        water_current.postUpdate(var_water_current)

        var String wtjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=water%20total&msgnumber=1&token=" + TOKEN )
        var String var_water_total = transform("JSONPATH", "$.data", wtjson)
        var Number var_rawwater = Float::parseFloat(var_water_total.split(" ").get(1))
        var Number var_decarbonatedwater = Float::parseFloat(var_water_total.split(" ").get(2))
        water_total.postUpdate(var_water_total)
        rawwater.postUpdate(var_rawwater)
        decarbonatedwater.postUpdate(var_decarbonatedwater)

        var String wajson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=water%20average&msgnumber=1&token=" + TOKEN )
        var String var_water_average = transform("JSONPATH", "$.data", wajson)
        water_average.postUpdate(var_water_average)

        var String aqjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=actual%20quantity&msgnumber=1&token=" + TOKEN )
        var String var_actual_quantity = transform("JSONPATH", "$.data", aqjson)
        actual_quantity.postUpdate(var_actual_quantity)

        var String sqjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=salt%20quantity&msgnumber=1&token=" + TOKEN )
        var String var_salt_quantity = transform("JSONPATH", "$.data", sqjson)
        salt_quantity.postUpdate(var_salt_quantity)

        var String srjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=salt%20range&msgnumber=1&token=" + TOKEN )
        var String var_salt_range = transform("JSONPATH", "$.data", srjson)
        salt_range.postUpdate(var_salt_range)

        var String rhjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=settings&command=residual%20hardness&msgnumber=1&token=" + TOKEN )
        var String var_residual_hardness = transform("JSONPATH", "$.data", rhjson)
        residual_hardness.postUpdate(var_residual_hardness)

        var String nhjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=settings&command=residual%20hardness&msgnumber=1&token=" + TOKEN )
        var String var_natural_hardness = transform("JSONPATH", "$.data", nhjson)
        natural_hardness.postUpdate(var_natural_hardness)

        var String vajson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=waterstop&command=valve&msgnumber=1&token=" + TOKEN )
        var String var_valve = transform("JSONPATH", "$.data", vajson)
        valve.postUpdate(var_valve)

        var String wwjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=water%20weekly&msgnumber=1&token=" + TOKEN + "&year=%3CYEAR%3E&month=%3CMONTH%3E&day=%3CDAY%3E")
        var String var_water_weekly = transform("JSONPATH", "$.data", wwjson)
        var Number var_mon = Float::parseFloat(var_water_weekly.split(" ").get(1))
        var Number var_tue = Float::parseFloat(var_water_weekly.split(" ").get(2))
        var Number var_wed = Float::parseFloat(var_water_weekly.split(" ").get(3))
        var Number var_thu = Float::parseFloat(var_water_weekly.split(" ").get(4))
        var Number var_fri = Float::parseFloat(var_water_weekly.split(" ").get(5))
        var Number var_sat = Float::parseFloat(var_water_weekly.split(" ").get(6))
        var Number var_sun = Float::parseFloat(var_water_weekly.split(" ").get(7))
        water_weekly.postUpdate(var_water_weekly)
        watermon.postUpdate(var_mon)
        watertue.postUpdate(var_tue)
        waterwed.postUpdate(var_wed)
        waterthu.postUpdate(var_thu)
        waterfri.postUpdate(var_fri)
        watersat.postUpdate(var_sat)
        watersun.postUpdate(var_sun)


        var String wyjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=consumption&command=water%20yearly&msgnumber=1&token=" + TOKEN + "&year=%3CYEAR%3E")
        var String var_water_yearly = transform("JSONPATH", "$.data", wyjson)
        var Number var_jan = Float::parseFloat(var_water_yearly.split(" ").get(1))
        var Number var_feb = Float::parseFloat(var_water_yearly.split(" ").get(2))
        var Number var_mar = Float::parseFloat(var_water_yearly.split(" ").get(3))
        var Number var_apr = Float::parseFloat(var_water_yearly.split(" ").get(4))
        var Number var_mai = Float::parseFloat(var_water_yearly.split(" ").get(5))
        var Number var_jun = Float::parseFloat(var_water_yearly.split(" ").get(6))
        var Number var_jul = Float::parseFloat(var_water_yearly.split(" ").get(7))
        var Number var_aug = Float::parseFloat(var_water_yearly.split(" ").get(8))
        var Number var_sep = Float::parseFloat(var_water_yearly.split(" ").get(9))
        var Number var_okt = Float::parseFloat(var_water_yearly.split(" ").get(10))
        var Number var_nov = Float::parseFloat(var_water_yearly.split(" ").get(11))
        var Number var_dez = Float::parseFloat(var_water_yearly.split(" ").get(12))

        water_yearly.postUpdate(var_water_yearly)
        waterjan.postUpdate(var_jan)
        waterfeb.postUpdate(var_feb)
        watermar.postUpdate(var_mar)
        waterapr.postUpdate(var_apr)
        watermai.postUpdate(var_mai)
        waterjun.postUpdate(var_jun)
        waterjul.postUpdate(var_jul)
        wateraug.postUpdate(var_aug)
        watersep.postUpdate(var_sep)
        waterokt.postUpdate(var_okt)
        waternov.postUpdate(var_nov)
        waterdez.postUpdate(var_dez)

        if (residual_hardness_setpoint.state != residual_hardness)
            {
            var String rhsjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=settings&command=residual%20hardness&msgnumber=1&token=" + TOKEN + "&parameter=" + residual_hardness_setpoint.state )
            var String var_residual_hardness_status = transform("JSONPATH", "$.status", rhsjson)
            if ( var_residual_hardness_status == "ok")
                {
                var String var_residual_hardness_setpoint = transform("JSONPATH", "$.parameter", rhsjson)
                residual_hardness.postUpdate(var_residual_hardness_setpoint)
                residual_hardness_setpoint.postUpdate(var_residual_hardness_setpoint)
                }
            }


        if (watervalveswitch.state == ON && valve.state.toString.contains("opened"))
            {
            var String vsjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=waterstop&command=valve&msgnumber=1&token=" + TOKEN + "&parameter=close")
            logInfo("Judo","Wassersperrventil GESCHLOSSEN")
            }


        if (watervalveswitch.state == OFF && valve.state.toString.contains("closed"))
            {
            var String vsjson = sendHttpGetRequest("https://"+ JUDOIP +":" + PORT + "?group=waterstop&command=valve&msgnumber=1&token=" + TOKEN + "&parameter=open")
            logInfo("Judo","Wassersperrventil OFFEN")
            }

        }
end

The information I got from the blog of Mario “µ” Mueh. (https://blog.muwave.de/2017/06/monitoring-and-controlling-a-judo-i-soft-plus-water-softening-device-via-lan/) Who has already written a PHP script for the query, which can be used if necessary.
https://blog.muwave.de/wp-content/uploads/2017/06/judo_ui.txt


(Vincent Regaud) #2

It’s not very clear, does it work again or not?


(Zippochonda) #3

No, the rules are not working anymore since the Change to 2.4,

A Http Request with the Http Binding to the URL is working. Thats also the reason why im asking for a Binding, perhabs its working like Http Binding and not like the rules.