Rademacher Homepilot (DuoFern) via http-Binding

Tags: #<Tag:0x00007fc8fa9a9c08> #<Tag:0x00007fc8fa9a9af0> #<Tag:0x00007fc8fa9a99d8>

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.

3 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