Rademacher Homepilot (DuoFern) via http-Binding

After reading a lot of info about openHAB and Rademacher Homepilot I was able to add my Rademacher “DuoFern” roller shutters, Rademacher closing contacts and Rademacher sun sensors into openHAB.

It was not necessary to use a workaround with FHEM or MQTT.

Maybe you are looking for the same – I try to summarize how I did it:

Prerequisites

  • Rademacher HomePilot (Software Version 5.x)
  • openHAB http-Binding
  • Rademacher DuoFern roller shutter or
  • Rademacher DuoFern closing contact or
  • Rademacher DuoFern sun sensor

First of all you need to find out your Rademacher Device ID (DID).
This device id “DID” need to be used in items (see below).

The “DID” can be found for roller shutters:
http://192.168.1.55/v4/devices
(replace 192.168.1.55 with your HomePilot-IP)

The URL for sensors (closing contact, sun sensor) is:
http://192.168.1.55/v4/devices?devtype=Sensor

Please be aware that we need both URL’s in the http.cfg file, if you have both (shutters and sensors).

My config looks like this:

http.cfg (in directory services)

homepilotCache.url=http://192.168.1.55/v4/devices
homepilotCache.updateInterval=20000

homepilotCache2.url=http://192.168.1.55/v4/devices?devtype=Sensor
homepilotCache2.updateInterval=20000

Sitemap:

Slider item=RollladenZimmer1              icon="rollershutter"
Text item=Tuerkontakt                     icon="door"           valuecolor=["closed"="green", "open"="red"]
Text item=Sonnensensor                    icon="sun"            valuecolor=["false"="green", "true"="red"]

Items:

Rollershutter RollladenZimmer1    "Rollladen Zimmer 1[%d %%]"   (GRollo)       {http="<[homepilotCache:20000:JSONPATH($.devices[?(@.did==5)].statusesMap.Position)] "}
String Tuerkontakt                "Fenster [%s]"                (GTuerkontakt) {http="<[homepilotCache2:20000:JSONPATH($.meters[?(@.did==12)].readings.contact_state)] "}
String Sonnensensor               "Sonnensensor [%s]"           (GTuerkontakt) {http="<[homepilotCache2:20000:JSONPATH($.meters[?(@.did==20)].readings.sun_detected)] "}

rules:

rule "GetRollershutterUpdate"
when
Member of GRollo received command
then
     logDebug("rolershutter","rolershutter " + triggeringItem.name + " recieved update" + receivedCommand )
     var String myUrl = ""
     switch(triggeringItem.name) {
     case "RollladenZimmer1": { myUrl = "http://192.168.1.55/devices/5"}
     case "RollladenZimmer2": { myUrl = "http://192.168.1.55/devices/7"}
     }
}
var String myData = '{"name":"GOTO_POS_CMD","value":"' + receivedCommand + '"}'
logDebug("rolershutter","Sending put "+ myData + " to " + myUrl)
sendHttpPutRequest(myUrl, "application/x-www-form-urlencoded", myData)
end

Hope that helps :grinning:
If you have further ideas or questions, please comment.

4 Likes

Hi,

very cool. Exactly what I was searching for!

Thanks!

You should add “JSONPath Transformation” to the prerequisites.

1 Like

I finally got it also working with the Android App. Change the fourth last line to:
var String myData = ‘{“name”:“GOTO_POS_CMD”,“value”:"’ + (receivedCommand as Number).intValue() + ‘"}’

The App transfers the value with a decimal point and the tenth. But the JSON may only contain Integer values.

1 Like

Thanks Oskar for sending this hint! :+1:

Going forward I tried moving my OH2.5 stuff to openHAB Version 3.
I am currrently stuck how to move the above mentioned http-1 config to the new http-3 binding.

I created an new (http) thing:
Base URL: http://192.168.1.55/v4/devices?devtype=Sensor
(I took this from http.cfg CacheURL)

Now I understood that I need to create new (string) channel and entered as State Transformation:
JSONPATH:$.meters[?(@.did==12)].readings.contact_state

But this is not working, error message in Log:

Transformation service JSONPATH for pattern $.meters[?(@.did==12)].readings.contact_state not found!

The old OH2.5 item config was:

String SZ_Window_Contact "Door/Window [MAP(transform.map):%s]" 	{http="homepilotCache2:20000:JSONPATH($.meters[?(@.did==12)].readings.contact_state)] "}

Can someone help me, how the new channel config need to be configured? What would be the correct syntax?
Thanks in advance! :slight_smile:

Thanks for your tutorial, it works great - also with the Rademacher Start2Smart Bridge!

1 Like

Hi, I currently also preparing my system for OH3 but finally couldn’t integrate my Rollotrons via the HTTP Binding properly. However, I found another solution via MQTT: GitHub - pduck27/hp2mqtt: Python proxy between Rademacher HomePilot and mqtt broker for individual smarthome solution.
I’ve adapted and expanded the python script according to my needs (if error occurs) and it works! Maybe this helps you as well.

1 Like

Thanks for your feedback, @serg_003
In the meantime I was able to integrate my Rademacher stuff into OH3 - without using MQTT.
My goal was to use http-binding only.
It’s working with http-binding only - and I am happy.

If it helps - the correct syntax for string channel, state transformation is, e.g.:

JSONPATH:$.devices[?(@.did==24)].statusesMap.Position

(Of course you need to adapt the DID to your environment - I described in the first article how to find out the DID of your devices.)

Using that channel allows to “add link to item” and steer e.g. blinds.


/—

1 Like

hi @April_Wexler,

thank you for the explanation for the OH3 integration. I tried to replicate this to my system as well, but it did not work. Couple of questions:

  • My DID from Homepilot are like “1010006”, in your case it is a shorter number. Do I need to “shorten” the DID somehow?
  • My understanding is that I need to create an own new channel for every roller shutter that I want to control. Correct?
  • Do I need to add the state transformation expression to the channel as well as to the item that I created based on the channel?

Regards
Patrick

1 Like

hi Patrick,

  • My DID from Homepilot are like “1010006”, in your case it is a shorter number. Do I need to “shorten” the DID somehow?

I’m pretty sure you have to use the whole DID number

  • My understanding is that I need to create an own new channel for every roller shutter that I want to control. Correct?

Correct

  • Do I need to add the state transformation expression to the channel as well as to the item that I created based on the channel?

In my case, I put it in the channel.
Here is an example from my test configuration:

UID: http:url:homepilot
label: HTTP - Homepilot
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://192.168.178.76/v4/devices
  refresh: 10
  commandMethod: GET
  contentType: application/json
  timeout: 3000
  bufferSize: 2048
channels:
  - id: TEST
    channelTypeUID: http:number
    label: Rollo im EZ
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.devices[?(@.did==6)].statusesMap.Position

1 Like

Hello everybody,

do I still need a rule for the OH3 configuration as mentioned in the first post?

I created the http binding with the homepilot as described and also created the channels for each individual rollershutter. There are no warnings or errors in the log when I try to operate the blinds. Nothing happens, however.

How do I set position in OH3 as with: “name”: “GOTO_POS_CMD”, “value”: "?

1 Like

yes (at least I needed it)

Did you define the channels and links as string? Do not use “rollershutter” because the transformation is looking for a string.

When you have created the rule you can add in your sitemap e.g.:

Slider item  = YourRollershutter icon="rollershutter" 
Selection item=YourRollershutter mappings=[0="0%", 30="30%", 50="50%", 70="70%", 100="100%"] icon="rollershutter"

Hi Phillip,

How do I set position in OH3 as with: “name”: “GOTO_POS_CMD”, “value”: "?

You can try this script (please adapt it to your environment):

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
var HTTP = Java.type("org.openhab.core.model.script.actions.HTTP");
var url = "";

logger.info("Rollosteuerung beginnt");
try {
  if (event != null) {
    switch (event.itemName) {
      case "HTTPHomepilot_EZ":
        url = "http://192.168.178.76/devices/6";
        break;

    //... etc ...
    }

    HTTP.sendHttpPutRequest(url, "application/json", '{"name":"GOTO_POS_CMD","value":"' + itemRegistry.getItem(event.itemName).getState() + '"}', 1000);

  }
}
catch (e) { logger.info("Exception: " + e); }
    
logger.info("Rollosteuerung beendet");

Hey there,

some days ago I received my smart2smart bridge and it works great for me.
Currently my rule to control my rollershutter looks like this:

rule "Rolladen"
when
    Item Rolladen received command
then
    logInfo("Rule triggered", Dateiname + ": \"Rolladen\": " + receivedCommand)
    var String url = "http://192.168.XXX.XXX/devices/1"
    var String kommando = '{"name":"GOTO_POS_CMD","value":"'
    if (receivedCommand == DOWN) {
        kommando += "100"
    } else if (receivedCommand == UP) {
        kommando += "0"
    } else if (receivedCommand == STOP) {
        kommando += "STOP"
    } else {
        kommando += (receivedCommand as Number).intValue()
    }
    kommando += '"}'
    sendHttpPutRequest(url, "application/x-www-form-urlencoded", kommando)
end

Everything works but one thing: the STOP command. Sending {"name":"GOTO_POS_CMD","value":"STOP"} to the rollershutter doesn’t stop it. Sending a number instead of the STOP works flawlessly.

The STOP-Command is sent when pressing the middle button:
image

Does anyone know which command you have to send so it stops in the current position?


Edit: I figured it out. This is my working rule now which also supportes the STOP-command:

rule "Rolladen"
when
    Item Verdunklung_Rolladen received command
then
    logInfo("Rule triggered", Dateiname + ": \"Rolladen\": " + receivedCommand)
    var String url = "http://192.168.XXX.XXX/devices/1"
    var String kommando = '{"name":"'
    if (receivedCommand == DOWN) {
        kommando += 'POS_DOWN_CMD'
    } else if (receivedCommand == UP) {
        kommando += 'POS_UP_CMD'
    } else if (receivedCommand == STOP) {
        kommando += 'STOP_CMD'
    } else {
        kommando += 'GOTO_POS_CMD","value":"'
        kommando += (receivedCommand as Number).intValue()
    }
    kommando += '"}'
    sendHttpPutRequest(url, "application/x-www-form-urlencoded", kommando)
end
1 Like

awesome, @Felix_Schneider!
Thanks for posting it! :slight_smile:

Hello everyone,
the control and the position query as well as the query of the status e.g. a sun sensor from Rademacher works perfectly thanks to your help.

But I haven’t found a way that works if the homepilot is password-protected.

Not even via the username / password transfer via URL.

Example:
http://admin:[PASSWORD]@192.168.1.2/v4/devices

When I enter this URL in the browser, the output is:
Unauthorized

The following entry is in the logbook:
HTTP protocol violation: Authentication challenge without WWW-Authenticate header

Has anyone already tried it or found a solution for it?
Maybe the homepilot is using a different username than admin?

Thanks in advance

No, sadly not. I also tried setting up a password but had the same issue as you did

First, many thanks to Kai, without your post I would never have made it.

But unfortunately it took me quite a long time to get the shutters working.

1. Additional Prerequisites:
+openHAB Add-on "JSONPath Transformation

2. No password protection

3. My configuration files:

/* http.things */

Thing http:url:homepilot "HomePilot" [
  authMode="BASIC",
  baseURL="http://192.168.1.2/v4/devices",
  ignoreSSLErrors=false,
  refresh=10,
  commandMethod="GET",
  contentType="application/json",
  timeout=3000,
  bufferSize=2048 ] {
    Type string : 1010000#status        [ stateTransformation="JSONPATH:$.devices[?(@.did==1010000)].statusesMap.Position"]
    Type string : 1010001#status        [ stateTransformation="JSONPATH:$.devices[?(@.did==1010001)].statusesMap.Position"]
    Type string : 1010002#status        [ stateTransformation="JSONPATH:$.devices[?(@.did==1010002)].statusesMap.Position"]
  }
/* rademacher.items */

Rollershutter Rollershutter_1010000 "Rollershutter 1010000[%d %%]" <blinds> (gRollershutter) { channel="http:url:homepilot:1010000#status" }
Rollershutter Rollershutter_1010001 "Rollershutter 1010001[%d %%]" <blinds> (gRollershutter) { channel="http:url:homepilot:1010001#status" }
Rollershutter Rollershutter_1010002 "Rollershutter 1010002[%d %%]" <blinds> (gRollershutter) { channel="http:url:homepilot:1010002#status" }
/* rademacher.rules */

rule "Rollershutter"
when
    Member of gRollershutter received command
then
    logDebug("rolershutter","rolershutter " + triggeringItem.name + " recieved update " + receivedCommand )

    var String url = 'http://192.168.1.2/devices/'
    switch (triggeringItem.name){
      case "Rollershutter_1010000":{
        url += '1010000'
      }
      case "Rollershutter_1010001":{
        url += '1010001'
      }
      case "Rollershutter_1010002":{
        url += '1010002'
      }
    }

    var String payload = '{"name":"'
    switch (receivedCommand.toString()){
      case "UP":{
        payload += 'POS_UP_CMD'
      }
      case "DOWN":{
        payload += 'POS_DOWN_CMD'
      }
      case "STOP":{
        payload += 'STOP_CMD'
      }
      default:{
        if ((receivedCommand as Number).intValue() >= 0 && (receivedCommand as Number).intValue() <= 100)
        payload += 'GOTO_POS_CMD", "value":' + (receivedCommand as Number).intValue()
      }
    }
    payload += '"}'
    sendHttpPutRequest(url, "application/json", payload)
    logDebug("rolershutter","url: " + url + "| payload: " + payload )
end
1 Like

Thank you @CheesePete for your post!
I think that helps a lot :+1:
Thanks for sharing.

regards, Kai

Anyone got it already working on OpenHAB3 ?

Sending requests is working, but the update not…

My configuration:

UID: http:url:8208d83d49
label: RademacherRolladen
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://192.168.0.23/v4/devices
  delay: 1000
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  contentType: application/json
  timeout: 3000
  bufferSize: 4096
location: Buero
channels:
  - id: Rademacher_RolladenBuero
    channelTypeUID: http:rollershutter
    label: RolladenBuero
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.devices[?(@.did==1)].statusesMap.Position

In the log I get:

2021-09-24 15:40:35.003 [WARN ] [ofiles.JSonPathTransformationProfile] - Could not transform state 'UNDEF' with function '$.devices[?(@.did==1)].statusesMap.Position' and format '%d'

Why do I get “undef” ?

Json looks good.

{
   "response":"get_visible_devices",
   "devices":[
      {
         "description":"Rolladen Fenster",
         "deviceGroup":2,
         "did":1,
         "hasErrors":0,
         "iconSetInverted":0,
         "iconSet":{
            "k":"iconset8"
         },
         "messages":[
            
         ],
         "name":"Büro",
         "properties":{
...
         },
         "statusValid":true,
         "statusesMap":{
            "Manuellbetrieb":0,
            "Position":100
         },
...

Sending put is for working:

Sending put {"name":"GOTO_POS_CMD","value":"100"} to http://192.168.0.23/devices/1

I have this problem since update from OpenHAB 2 to 3.

Anyone got it working on OH3?