Rademacher DuoFern via Fhem and MQTT

Tags: #<Tag:0x00007f617fcad3b0> #<Tag:0x00007f617fcad040> #<Tag:0x00007f617fcd3830>

Devices from the german Company Rademacher use a proprietary protocol called DuoFern.
Unfortunatelly there is no openhab binding yet.
see: https://community.openhab.org/t/rademacher-duofern/25128

This tutorial will explain how to connect and control the devices anyway.
It is easier than the tutorial looks like. :smile:

We will make use of another smart home solution called Fhem.
This solution has a great module (actually two) for the DuoFern usb stick that supports any DuoFern-device and every feature of the protocol.


  • openHAB server
  • Fhem server
  • MQTT broker
  • DuoFern usb stick
  • a supported DuoFern device

Installation and configuration


openHAB should already be installed an configured, of cause.


Install a MQTT broker like mosquitto and configure it.
There should be plenty tutorials online for that. :wink:

Make yourself familiar with MQTT.
Lear the basics of how to publish messages and subscribe to topics.
It’s not that hard.

Install the mqtt binding in openHAB and connect to the broker.


Plug in the DuoFern usb stick to your server (or wherever you want to install Fhem).

Install Fhem.

If you use docker, like I did on my Raspberry Pi, you need to specify your usb device.

docker run \
        -d \
        --device /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0 \
        -p 8083:8083  \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v fhem:/opt/fhem \
        --name fhem \

source: https://github.com/sejnub/docker-fhem#update-fhem

configure the DUOFERNSTICK module

Once you installed Fhem you should be able to open the web interface.

At the top you get a white text field to enter commands.

Insert the following command to add your usb stick.
It is kind of like a “thing” or “bridge” in openHAB

You might want to change “Rademacher” to any name you want to give your stick
And code at the end must start with “6F”, while the last four characters can be defined as you want (hex 0-F).

define Rademacher DUOFERNSTICK /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0@115200 6F1A2B

see: https://wiki.fhem.de/wiki/DUOFERNSTICK

add a DUOFERN device

Press anything on your device, so it will send a message to all other DuoFern devices.
The usb stick will receive this message and Fhem will automatically create a new device.

Read the manual to see how to activate the pairing mode on the device.
Enter the following command in the web interface.

set Rademacher pair

Check the Fhem log (web interface) to see if the device is paired.

Optionally rename the device.

rename DUOFERN_409180 Rollo_WZ

For Belt Winders you need to defibe the start and end points before you can automatically control the device.

Click “Save Config” below the Fhem logo every now and then. :wink:

On the left menu in Fhem you will find a group called “DUOFERN”.
In that group you will find your device. Open it.

You should see the status of every available attribute under “Readings”.
Like “state: open” or “position: 0”.

To see if everything works you can use the “set” command at the top.

Select “position” from the drop down menu and move the slider (green rectangle). Hit “set”.
The Belt Winder should move now.


Connect Fhem to your MQTT broker and choose a name for it (here mosquitto).

define <name> MQTT <ip:port> [<username>] [<password>]

# example
define mosquitto MQTT fhem mysectret

see: https://wiki.fhem.de/wiki/MQTT_Einführung


A great feature of Fhem that makes this tutorial so easy if the ability to use the MQTT-Bridge to send and receive attributes via MQTT for complete devices.

Define a bridge for every device you need.

define <mqtt-device-name> MQTT_BRIDGE <fhem-device>

# example
define mqtt_Rollo_WZ MQTT_BRIDGE Rollo_WZ

The new mqtt device should be listet under “Everything” (left menu).

Configure a custom publish-topic for the device if you do not want to use the default one.
I recommend something like this:

attr mqtt_Rollo_WZ  publish-topic-base state/fhem/Rollo_WZ/

The following command will create all necessary attributes to publish all “Readings”.

get mqtt_Rollo_WZ readings

Next you need to define the first subscribe attribute, that executes a “set” command once a message is received.

attr mqtt_Rollo_WZ  subscribeSet_position set/fhem/Rollo_WZ/position

Now you can check if everything works by subscribing to the “state/fhem/” topic with a MQTT client.
And you can publish messages to see if you can control the device.

# This example uses "mosquitto_pub" as a MQTT client for linux
mosquitto_pub -h -p 1883 -u fhem-P mysecret -t set/fhem/Rollo_WZ/position -m "7"

Once you verified that everything works as expected you can define all the other attributes to control the device.

attr mqtt_Rollo_WZ subscribeSet_sunPosition         set/fhem/Rollo_WZ/sunPosition
attr mqtt_Rollo_WZ subscribeSet_ventilatingPosition set/fhem/Rollo_WZ/ventilatingPosition
attr mqtt_Rollo_WZ subscribeSet_dawnAutomatic       set/fhem/Rollo_WZ/dawnAutomatic
attr mqtt_Rollo_WZ subscribeSet_duskAutomatic       set/fhem/Rollo_WZ/duskAutomatic
attr mqtt_Rollo_WZ subscribeSet_manualMode          set/fhem/Rollo_WZ/manualMode
attr mqtt_Rollo_WZ subscribeSet_sunAutomatic        set/fhem/Rollo_WZ/sunAutomatic
attr mqtt_Rollo_WZ subscribeSet_sunMode             set/fhem/Rollo_WZ/sunMode
attr mqtt_Rollo_WZ subscribeSet_timeAutomatic       set/fhem/Rollo_WZ/timeAutomatic
attr mqtt_Rollo_WZ subscribeSet_ventilatingMode     set/fhem/Rollo_WZ/ventilatingMode

# moving commands
attr mqtt_Rollo_WZ subscribeSet_up                  set/fhem/Rollo_WZ/up
attr mqtt_Rollo_WZ subscribeSet_down                set/fhem/Rollo_WZ/down
attr mqtt_Rollo_WZ subscribeSet_stop                set/fhem/Rollo_WZ/stop
attr mqtt_Rollo_WZ subscribeSet_toggle              set/fhem/Rollo_WZ/toggle
attr mqtt_Rollo_WZ subscribeSet_dawn                set/fhem/Rollo_WZ/dawn
attr mqtt_Rollo_WZ subscribeSet_dusk                set/fhem/Rollo_WZ/dusk
attr mqtt_Rollo_WZ subscribeSet_getStatus           set/fhem/Rollo_WZ/getStatus
attr mqtt_Rollo_WZ subscribeSet_remotePair          set/fhem/Rollo_WZ/remotePair
attr mqtt_Rollo_WZ subscribeSet_remoteUnpair        set/fhem/Rollo_WZ/remoteUnpair
attr mqtt_Rollo_WZ subscribeSet_reset               set/fhem/Rollo_WZ/reset

configure openHAB


mosquitto: is the name of my mqtt broker I defined in services/mqtt.cfg.

// Control
Number Rollo_WZ_position        "Rollo WZ pos. [%d %%]" <rollershutter>  { mqtt=">[mosquitto:set/fhem/Rollo_WZ/position:command:*:default],
                                                                                 <[mosquitto:state/fhem/Rollo_WZ/position:state:default]" }
String Rollo_WZ_mode            "Rollo WZ mode."        <movecontrol>    { mqtt=">[mosquitto:set/fhem/Rollo_WZ/up:command:up:default],
                                                                                 <[mosquitto:state/fhem/Rollo_WZ/moving:state:default]" }
Switch Rollo_WZ_sunMode         "Rollo WZ sunMode."     <sun>            { mqtt=">[mosquitto:set/fhem/Rollo_WZ/sunMode:command:*:MAP(onoffcases.map)],
                                                                                 <[mosquitto:state/fhem/Rollo_WZ/sunMode:state:MAP(onoffcases.map)]" }
Switch Rollo_WZ_ventilatingMode "Rollo WZ ventil.Mode." <fan>            { mqtt=">[mosquitto:set/fhem/Rollo_WZ/ventilatingMode:command:*:MAP(onoffcases.map)],
                                                                                 <[mosquitto:state/fhem/Rollo_WZ/ventilatingMode:state:MAP(onoffcases.map)]" }
Switch Rollo_WZ_manualMode      "Rollo WZ manualMode"   <boy_3>          { mqtt=">[mosquitto:set/fhem/Rollo_WZ/manualMode:command:*:MAP(onoffcases.map)],
                                                                                 <[mosquitto:state/fhem/Rollo_WZ/manualMode:state:MAP(onoffcases.map)]" }

// Settings
Switch Rollo_WZ_dawnAutomatic   "Rollo WZ dawnAuto."    <sunrise>           { mqtt=">[mosquitto:set/fhem/Rollo_WZ/dawnAutomatic:command:*:MAP(onoffcases.map)],
                                                                                    <[mosquitto:state/fhem/Rollo_WZ/dawnAutomatic:state:MAP(onoffcases.map)]" }
Switch Rollo_WZ_duskAutomatic   "Rollo WZ duskAuto."    <sunset>            { mqtt=">[mosquitto:set/fhem/Rollo_WZ/duskAutomatic:command:*:MAP(onoffcases.map)],
                                                                                    <[mosquitto:state/fhem/Rollo_WZ/duskAutomatic:state:MAP(onoffcases.map)]" }
Switch Rollo_WZ_timeAutomatic   "Rollo WZ timeAuto."    <clock>             { mqtt=">[mosquitto:set/fhem/Rollo_WZ/timeAutomatic:command:*:MAP(onoffcases.map)],
                                                                                    <[mosquitto:state/fhem/Rollo_WZ/timeAutomatic:state:MAP(onoffcases.map)]" }
Switch Rollo_WZ_sunAutomatic    "Rollo WZ sunAuto."     <sun>               { mqtt=">[mosquitto:set/fhem/Rollo_WZ/sunAutomatic:command:*:MAP(onoffcases.map)],
                                                                                    <[mosquitto:state/fhem/Rollo_WZ/sunAutomatic:state:MAP(onoffcases.map)]" }
Number Rollo_WZ_sunPosition     "Rollo WZ sunPos. [%d %%]" <rollershutter>  { mqtt=">[mosquitto:set/fhem/Rollo_WZ/sunPosition:command:*:default],
                                                                                    <[mosquitto:state/fhem/Rollo_WZ/sunPosition:state:default]" }
Number Rollo_WZ_ventilatingPosition "Rollo WZ ventil.Pos. [%d %%]" <rollershutter>  { mqtt=">[mosquitto:set/fhem/Rollo_WZ/ventilatingPosition:command:*:default],
                                                                                            <[mosquitto:state/fhem/Rollo_WZ/ventilatingPosition:state:default]" }

// Configuration
Switch Rollo_WZ_getStatus        "Rollo WZ getStatus"    <zoom>             { mqtt=">[mosquitto:set/fhem/Rollo_WZ/getStatus:command:ON:default]",
                                                                              autoupdate="false" }
Switch Rollo_WZ_remotePair       "Rollo WZ remotePair"   <lock>             { mqtt=">[mosquitto:set/fhem/Rollo_WZ/remotePair:command:ON:default]",
                                                                              autoupdate="false" }
Switch Rollo_WZ_remoteUnpair     "Rollo WZ remoteUnpair" <lock>             { mqtt=">[mosquitto:set/fhem/Rollo_WZ/remoteUnpair:command:ON:default]",
                                                                              autoupdate="false" }
String Rollo_WZ_reset            "Rollo WZ reset"        <error>            { mqtt=">[mosquitto:set/fhem/Rollo_WZ/reset:command:settings:default],
                                                                              autoupdate="false" }


sitemap fhem label="Fhem"
    Frame label="Rollo_WZ" {
        Frame label="Control" {
            Text      item=Rollo_WZ_position
            Slider    item=Rollo_WZ_position
            Switch    item=Rollo_WZ_mode mappings=[up=up, down=down, stop=stop, toggle=toggle]
            Switch    item=Rollo_WZ_mode mappings=[dawn=dawn, dusk=dusk]
            Switch    item=Rollo_WZ_sunMode
            Switch    item=Rollo_WZ_ventilatingMode
            Switch    item=Rollo_WZ_manualMode
        Frame label="Settings" {
            Switch    item=Rollo_WZ_dawnAutomatic
            Switch    item=Rollo_WZ_duskAutomatic
            Switch    item=Rollo_WZ_timeAutomatic
            Frame label="Sun" {
                    Switch    item=Rollo_WZ_sunAutomatic
                    Text      item=Rollo_WZ_sunPosition
                    Slider    item=Rollo_WZ_sunPosition
            Frame label="Ventilation" {
                    Text      item=Rollo_WZ_ventilatingPosition
                    Slider    item=Rollo_WZ_ventilatingPosition
        Frame label="Configuration" {
            Switch    item=Rollo_WZ_getStatus
            Switch    item=Rollo_WZ_remotePair
            Switch    item=Rollo_WZ_remoteUnpair
            Switch    item=Rollo_WZ_reset mappings=[settings=settings, full=full]





Check if the items in openHAB create and receive the necessary mqtt messages.
This should work very fast without any noticeable delay.

Now you should be able to control your Rademacher DuoFern device with openHAB.

Have fun.


other issues

reset usb port

After every reboot of my RasPi I had to replug the DuoFern adapter and restart the fhem container.
So I wrote a little script that rests the usb port after reboot and restarts the container for me.

see: https://github.com/CWempe/usbreset

This is my cron file

@reboot   root   sleep 30 && /home/<username>/usbreset/reset_dynamic_port.sh WR04ZFOA && sleep 20 && docker restart fhem

I don’t know if the sleep commands are necessary. I just put them there. :wink:



danke für das super Tutorial. Danach habe ich lange gesucht.

Leider funktioniert bei mir nicht alles. Vielleicht hast du eine Idee?
Die MQTT-Bridge ist eingerichtet und ich konnte über einen MQTT Befehl den Rollladen auf Position 50 fahren.

Über den Regler auf der FHEM Seite kann ich den Rollladen auch steuern.

In openHAB habe ich die default.items und default.sitemap angelegt. Die openHAB Seite sieht soweit auch gut aus:

Aber wenn ich auf der openHAB Seite nun versuche den Rollladen zu bewegen, passiert nichts.

I will answer in english, because this is an international community.

I would recommend to subscribe to the topics with a mqtt client to see if openhab is sending the correct mqtt messages.
If you see messages the question would be if fhem is subscribing to the topics correctly.
Or maybe openhab is sending wrong topics.

How can i do this? What should i do?

I would use the linux command “mosquitto_sub”.

To subscribe to every topic, use this command:

mosquitto_sub -h <mqtt-server-ip> -u <user> -P <password>-p 1883 -t +/# -v

When you click the “up” button in the openhab GUI, you should see something like this:

set/fhem/Rollo_WZ/up up
state/fhem/Rollo_WZ/moving up

If i use the command nothing happens:

Where should i see the informations (set/fhem/Rollo_WZ/up up state/fhem/Rollo_WZ/moving up)? I have look into the fhem log but there is now entry if i click on a button.

Ok, now it works. I have forgot to Install the mqtt binding in openHAB.

Now i try to connect this settings with amazon alexa. But it dosn´t work. Do you have test this?

No, I don’t have an Alexa device, yet.

very interesting solution.
i have a similar problem, there is no oh2 binding for eltaco enocean actors, but they works fine with fhem.
it should be possible to follow your instructions to make it work, right?

Just get your devices to work with Fhem and configure the MQTT bridge (in Fhem and in openhab).

after couple hours it works fine now with all enocean actors/rollershutters.
thx for this great idea and solution @christoph_wempe

Do I need a manual central operating unit, standard hand transmitter, home pilot or duo fern comfort device from Rademacher, to use your solution OR is it enough, if I have all the software running and a Rademacher USB Device?

Currently I only have 2 Rolloport Duofern Standard and I’m thinking about which operating unit I should buy. If I only need the stick, it would be greatful, because I have a running openHAB on a Pi2 for control all of my heating devices.


You only need the stick!

btw: I currently have an issue where fhem does not publich any info to mqtt after I reinstalled my setup again.
sending commands from openhab to fhem via mqtt does work.
Hopefully I will figure this out soon. :slight_smile:
I am sure it’s only a simple mistake I made.

EDIT: I did not change anything, but it id working after restarting fhem. :slight_smile:

Now, the USB-Stick is active on the Pi and FHEM know him:

But I’m not able to pair any of my Rollotron Duofern Standard. I press the up or down key, but
the stick nor the FHEM say me something about new devices.

“set Rademacher pair” dont work, the enabled pairing mode on the device does not work.
I dont see any devices in the log:
2017.05.23 13:11:39 3: Opening Rademacher device /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0
2017.05.23 13:11:39 3: Can’t open /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0: Datei oder Verzeichnis nicht gefunden
2017.05.23 13:13:39 1: PERL WARNING: Use of uninitialized value in numeric eq (==) at ./FHEM/10_DUOFERNSTICK.pm line 574.
2017.05.23 13:13:39 1: PERL WARNING: Use of uninitialized value in addition (+) at ./FHEM/10_DUOFERNSTICK.pm line 554.

I think, the message at line 2 can be ignored, because FHEM know a device item named DUOFERNSTICK:

DEF /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0@115200 6F1A2B
DeviceName /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFOA-if00-port0@115200
DongleSerial 6F1A2B
NAME Rademacher
NR 32
NTFY_ORDER 50-Rademacher

Did you have any hints for me? I can not find any documentation in the web about the Duofern-Stick. The Rademacher websitedont know this device.


Device adding and pairing was successful after I remove and insert the stick.
Sorry for all the trouble.

After this line I miss the command. Should be:
get mqtt_Rollo_WZ readings


I fixed it.

Even though I am not sure, because it now works for me without this command. :neutral_face:

Thank you very much for sharing this solution! Finally I have the possibility to integrate my RolloTubes into openHAB! :slight_smile:

However, there are some open questions to me (thanks to the (imo) confusing Rademacher system):

  1. What should the modes “DAWN” and “DUSK” do? Unfortunately, nothing happens if I trigger these (also not in fhem). And I can’t find a matching function in my hand-held transmitter (“DuoFern Handzentrale”). Maybe this is only for the RolloTrons?

  2. Could you please share you onoffcases.map file? :slight_smile: That would make this tutorial foolproof :slight_smile:

As far as I understand:

  • When you activate DUSK, the shutters should drive to the defined Ventilate position.
  • DAWN --> 0%, I think

EDIT: I added the map in my fisrt post.



Ok, at least for my RolloTubes this doesn’t work.
(It’s not a MQTT / OH2 Thing, FHEM also does nothing when “set Rollo_WZ dusk” is executed, although a ventilating position is programmed).

But it’s not a big deal, I just was curious about this feature.
Thanks to the openHAB rules almost any position/automatic feature of Rademacher is obsolete :slight_smile:

Best regards