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.
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.
Requirements
- openHAB server
- Fhem server
- MQTT broker
- DuoFern usb stick
- a supported DuoFern device
Installation and configuration
openhab
openHAB should already be installed an configured, of cause.
MQTT
Install a MQTT broker like mosquitto and configure it.
There should be plenty tutorials online for that.
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.
Fhem
Plug in the DuoFern usb stick to your server (or wherever you want to install Fhem).
Install Fhem.
https://wiki.fhem.de/wiki/Hauptseite
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 \
sejnub/fhem:rpi-latest
source: GitHub - sejnub/docker-fhem: Docker images for the home autoomation software FHEM
configure the DUOFERNSTICK module
Once you installed Fhem you should be able to open the web interface.
http://<your-ip>:8083/
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.
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.
MQTT
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 192.168.1.23:1883 fhem mysectret
see: MQTT ā FHEMWiki
MQTT-Bridge
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 192.168.1.23 -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
fhem.items
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:set/fhem/Rollo_WZ/down:command:down:default],
>[mosquitto:set/fhem/Rollo_WZ/stop:command:stop:default],
>[mosquitto:set/fhem/Rollo_WZ/toggle:command:toggle:default],
>[mosquitto:set/fhem/Rollo_WZ/dawn:command:dawn:default],
>[mosquitto:set/fhem/Rollo_WZ/dusk:command:dusk: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],
>[mosquitto:set/fhem/Rollo_WZ/reset:command:full:default]",
autoupdate="false" }
fhem.sitemap
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]
}
}
}
onoffcases.map
on=ON
off=OFF
ON=on
OFF=off
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.
Demo:
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.
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.