Binding for Warema Mobile System WMS

Hello folks,
i have today install a new version from openhab 2.5.2 with Binding for Warema WMS Stick.

dmesg say:
1775.225750] usb 1-1.4: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 1775.225771] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1775.225781] usb 1-1.4: Product: FT232R USB UART
[ 1775.225790] usb 1-1.4: Manufacturer: FTDI
[ 1775.225800] usb 1-1.4: SerialNumber: A908E018
[ 1936.305829] usb 1-1.4: USB disconnect, device number 5
[ 1945.817951] usb 1-1.3: new full-speed USB device number 6 using dwc_otg
[ 1945.975457] usb 1-1.3: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 1945.975471] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1945.975481] usb 1-1.3: Product: FT232R USB UART
[ 1945.975490] usb 1-1.3: Manufacturer: FTDI
[ 1945.975499] usb 1-1.3: SerialNumber: A908E018
[ 2527.921702] usb 1-1.3: USB disconnect, device number 6
[ 5363.929394] usb 1-1.3: new full-speed USB device number 7 using dwc_otg
[ 5364.086962] usb 1-1.3: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 5364.086976] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5364.086986] usb 1-1.3: Product: FT232R USB UART
[ 5364.086995] usb 1-1.3: Manufacturer: FTDI
[ 5364.087004] usb 1-1.3: SerialNumber: A908E018

Step1:
I have configure the OpenWMS Binding over
OpenWMS WAREMA WMS-Stick Transceiver
or
OpenWMS WAREMA WMS-Stick Transceiver over TCP/IP

Openhab has no connect with USB Stick.

Step 2:

I enter

sudo socat tcp-listen:4001,fork,keepalive,nodelay,reuseaddr /dev/ttyAMA0,nonblock,raw

open a telnet session:
telnet localhost 4001

enter in the console: {G} for get any answer from USB Stick.
No answer

Enter M%174DE4 in the console. No answer from Stick.

In WAREMA WMS Studio PRO has connect to USB Stick.

I’m confused :frowning: Can somebody help me.

2020-03-01 12:53:56.851 [INFO ] [penwms.connector.OpenWMSTcpConnector] - Connecting to OpenWMS USB at 127.0.0.1:4001 over TCP/IP

==> /var/log/openhab2/events.log <==

2020-03-01 12:53:56.810 [hingStatusInfoChangedEvent] - ‘openwms:tcpbridge:996bd085’ changed from UNINITIALIZED to INITIALIZING

2020-03-01 12:53:56.859 [hingStatusInfoChangedEvent] - ‘openwms:tcpbridge:996bd085’ changed from INITIALIZING to OFFLINE

I have the same problem as @Sascha_Jostock and @klausharald.

The USB stick is brand new, article number 1002775 Rev. D
Tried sending the “{G}” command via minicom, to no avail. Will soon check with WMS Studio to make sure the stick works fine.

The stick works with WMS Studio and with the javascript plugin for IoBroker.

port opened
sending {G} debug
received message: gWMS USB-Stick debug
{"type":"stickType","payload":{"name":"WMS USB-Stick"}} debug
received expected answer: gWMS USB-Stick debug
sending {V} debug
received message: v37605107 debug
{"type":"stickVersion","payload":{"version":"37605107"}} debug
received expected answer: v debug
Stick Version: v37605107
sending {K4010E99EB48AB0AEDBB5682857D933D294D} debug
received message: a debug
{"type":"ack"} debug
received expected answer: a debug
sending {M%17F228} debug
received expected answer: a debug
sending {R04FFFFFF7020F22802} debug
received expected answer: a debug
sending {R04FFFFFF7020F22802} debug
received message: r4FE70C50600F96021100 debug
{"type":"message","payload":{"src":"4FE70C","type":"switchChannelRequest","messagePayload":{"panId":"0F96","deviceType":"02","channel":17}}} debug
received switchChannelRequest, switching channel to 17 debug
sending {M%17F228} debug
received message: a debug

Trying to manually interact with the stick using Minicom or any other serial console emulator, I can’t find any configuration that allows me to send commands to the stick.
However, using the serialport javascript package available via NPM (and the serialport-terminal emulator), I can access the stick:

$ ./node_modules/.bin/serialport-terminal -p /dev/ttyUSB0 -b 125000
Opening serial port: /dev/ttyUSB0 echo: true
{G}{gWMS USB-Stick}
{V}{v37605107   }

The latest version of the OpenHAB binding, as downloaded from GitHub, can’t properly initialize the usb stick. Relevant debug logs:

2020-03-24 16:21:05.167 [INFO ] [wms.connector.OpenWMSSerialConnector] - Connecting to OpenWMS USB at /dev/ttyUSB0
2020-03-24 16:21:05.171 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port #### Jetzt gehts los
2020-03-24 16:21:05.190 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port event listener started
2020-03-24 16:21:05.194 [DEBUG] [penwms.connector.OpenWMSStreamReader] - Data listener started
2020-03-24 16:21:05.497 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Try to send to controller
2020-03-24 16:22:06.504 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Checking OpenWMS transceiver connection, thing status should be = OFFLINE
2020-03-24 16:22:06.509 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Connecting to OpenWMS transceiver
2020-03-24 16:22:06.514 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Disconnecting
2020-03-24 16:22:06.548 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port event listener stopped
2020-03-24 16:22:06.552 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Interrupt serial listener
2020-03-24 16:22:06.556 [DEBUG] [penwms.connector.OpenWMSStreamReader] - Data listener stopped
2020-03-24 16:22:06.561 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial out stream
2020-03-24 16:22:06.565 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial in stream
2020-03-24 16:22:06.570 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial port
2020-03-24 16:22:06.578 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Closed
2020-03-24 16:22:06.582 [INFO ] [wms.connector.OpenWMSSerialConnector] - Connecting to OpenWMS USB at /dev/ttyUSB0

@rainer300: does the latest JAR reflects the latest published code, or are there unpublished changes?

1 Like

I have the same problem as @Sascha_Jostock and klausharald and giuseppeiannello

This is what I have done:

Raspberry openHAB 2 Stable 2.5.3 Image from https://www.openhab.org/download/
flashed with BaleaEtcher under Windows 10 on 8GB SD card.
SD card inserted, WMS stick plugged in, LAN, router and power connected and waited for 17 hours until the installation and subsequent update were safely completed.
Afterwards logged in with Putty:
User and PW: openhabian

Latest stable version 2.5.3-1 is on and running.

From "https://github.com/zeezee300/openwms"
“org.openhab.binding.openwms-2.5.0 SNAPSHOT.jar” and uploaded it to the directory
/usr/share/openhab2/addons
copied with Filezilla.
Raspberry restarted with “sudo reboot”
After the restart with Putty logged in on openhab and
openhab-cli console
(PW habopen)
feature:install openhab-transport serial
(takes a half minute)
logout
sudo reboot

executed.

For the first time on "http://openhab:8080/start/index"

logged in and selected Standard Recommended Setup.
Waited until Paper UI is selectable.

See picture here: "https://abload.de/img/wmsbindingeojp9.jpg" (only 2 Pictures for new forum-users allowed)

The stick has been successfully tested with the network under Windows 10 with WMS-Studio-Pro. It controls the external blind perfectly.

My Warema hardware:
WMS Wandsender basic
WMS Stick
WMS Zwischenstecker für Raffstore
WMS Wetterstation Plus

"First of all you have to configure an Warema USB-Stick. This device has to be added manually to OpenHab and is represented by an OpenWMS bridge.

You just have to set the right serial port. If everything is running fine you should see the Current firmware version: of your USB-Stick in the properties of your bridge."

In the inbox “Search for things”, OpenWMS Binding, WMS Stick Transceiver USB selected and “/dev/ttyUSB0” selected and confirmed with a click on the blue tick.

The result is as depressing as the first time I tried it. The stick has the status “OFFLINE”.

The PANID is unknown to me, so I cannot configure it manually.

Automatic configuration according to these instructions:


"Discovery (search for new devices with the remote control)
(Rainer Tested with: WAREMA WMS Handsender basis (ArtNr. 1002953))
In my opinion technically identical with my WMS wall transmitter basic (ArtNr. 1002881)

The devices could be automatically discovered by pressing the scan-button of your warema remote control and put in the Inbox (PAPER UI) or may be configured manually.

Note: However, it is a prerequisite that the devices have already been trained in the warema network and are known.

After the bridge is configured in openhab, wake up the remote control (simply press any button on the remote control). Then press the “Learn” button in the battery compartment for about 5 seconds until the green control lamp lights up.

You have to wait a few seconds until the green light (the right one on the front of the remote control) stops blinking and turns into red or orange. During the first scan the WMS network ID is determined and the LED light turns red. Then the red stop button must be pressed (this is the round button between the high and low buttons).

The USB-Stick should receives scan response messages from any sensor or actuator. You can find the new devices put in the Inbox (openhab PAPER UI). You can also find the current WMS network key as a property of the WMS-Stick transceiver"


“L” button on the rear panel pressed for more than 5 seconds. “L” lamp lights up.
Transmit LED on front:
2 x short green, short pause, 7 x green flashes, green 2 sec, 3 x green flashes, green 2 sec, 3 x green flashes, orange remains on

No red lamp as in Rainer’s description, but still “Stop” pressed in the middle of the remote control. No reaction. Exit the search mode by pressing the “L” button again.

Paper UI Inbox remains empty. WMS Stick remains “OFFLINE”.

The LOG viewer shows for the stick:
2020-03-27 15:18:11.533 [hingStatusInfoChangedEvent] - ‘openwms:bridge:039b8524’ changed from UNINITIALIZED to INITIALIZING
2020-03-27 15:18:11.589 [hingStatusInfoChangedEvent] - ‘openwms:bridge:039b8524’ changed from INITIALIZING to OFFLINE
2020-03-27 15:18:11.678 [INFO ] [wms.connector.OpenWMSSerialConnector] - Connecting to OpenWMS USB at /dev/ttyUSB0

I don’t know what else to do. This was my second attempt at a complete fresh installation.

Unfortunately again without success.

First problem: Status of the stick “OFFLINE”. Reason? No idea.
2nd problem: When searching with the wall transmitter no new device with “RED” is found. Possible cause:
The wall transmitter has already become familar with the stick by WMS Studio Pro under Windows.

What is our fault?

Without @rainer300 nothing works here anymore!

Just to add more details: I’ve managed to make the binding work by configuring it, then launching the program available at https://www.npmjs.com/package/warema-wms-venetian-blinds#example-getting-wms-network-parameters
Looks like the serial port is not properly opened by the binding, but once that JS thingy opens the port, everything works as expected.

Auto-detection of the devices works even with a wall remote (wake it with any button, long-press the learn button, new devices land in the inbox).

@pet2001 I don’t know why but sometimes the serial port is not initialized correctly. For testing purposes I have provided a small java program to fix this problem as a workaround:

1.) download serialport.jar
2.) copy it where you want (f.e. /opt/warema) and make it excecutable
3.) excecute it with your device as an argument (f.e./dev/ttyUSB2):

java -jar /opt/warema/serialport.jar /dev/ttyUSB2

This script should open the port and everything should work as expected until the wms-stick is unpluged :thinking:

@rainer300 Great work! My Stick ist ttyUSB0 so I used

java -jar /opt/warema/serialport.jar /dev/ttyUSB0

and the stick gets ONLINE Tschakka!!

That’s a big success. The serialport.jar has to be executed after every reboot to get the stick ONLINE again after reboot. No big problem.

But I get stucked in finding the WMS-stick and reading the PANID/KEY from the wall remote.
When pushing the L-Button on the wall remote it ends in orange and not red.

After manually adding the things “weather sensor” and “blind actuator” with the correct PANID and DEVICEID in Hex (read with iobroker and pman script) they are OFFLINE and not connected with the WMS-Stick.

I do not know where to enter the Network Key.

Any idea?

@pet2001

The serialport.jar has to be executed after every reboot to get the stick ONLINE again after reboot. No big problem

This can be solved with a simple script, which is executed at boot time. However, it can happen that the USB stick does not necessarily always get the same port name.

To solve this, you can define a udev rule to create a symlink so that the port name for the WMS stick is always /dev/warema.

1.) Check which is the ATTRS{serial} of your WMS stick:
udevadm info --name=/dev/ttyUSB0 --attribute-walk

2.) Edit /lib/udev/rules.d/99-usbsticks.rules and add the following line (pls. replace ABC12345 with the ATTRS{serial} of your WMS stick)

SUBSYSTEM==“tty”, ATTRS{serial}==“ABC12345”, SYMLINK+=“warema”

If necessary, an initialization script can be executed at the same time:

SUBSYSTEM==“tty”, ATTRS{serial}==“ABC12345”, SYMLINK+=“warema”, RUN+=“/usr/bin/at -M -f /opt/warema/yourscript.sh now + 1 minutes”

3.) Do not forget to restart the udev rules after the changes:
udevadm control --reload-rules && udevadm trigger

@rainer300 I’m willing to help hunting this bug down, have you started already? Is there any info you need?

@giuseppeiannello

Hi,
I’m not sure whether that’s a bug.
The problem only occurs to me when a connection should be established via TCP/IP and the stick has not been opened on the server side before.
If, after successful initialization, the stick is pluged out and pluged in again, the tcp connection is lost and cannot be restored from the client side (until the server side is reinitialized).
This is only the case with the WMS stick. With other USB sticks, e.g. RFXTRX or Enocean, I do not have this problem.

But the workaround described above works quite well for me and I can live with it :slightly_smiling_face:

@rainer300 in my case, this happens with the stick connected to a local USB port.

Haven’t tried your serialport.jar yet, but kudos for pointing out that udev can fire a script :slight_smile:

I might start hacking into it, maybe get it ready for inclusion into the official repository. How much of it is based off the RFXCom binding?

@giuseppeiannello
Hi,
yes, I have learned the basics from the RFXcom and the EnOcean binding.

Hello Rainer,

would it be possible to plug the WMS Stick into a docker host machine and use the stick inside an openhab docker container? If so which devices I have to pass from the host machine to the docker container?

Best regards,
Jörg

The USB stick is a classic FTDI serial-over-usb, it’s normally /dev/ttyUSB0

Yes, thank you for your answer. Therefore I pass the ttyUSB0 from the host into the docker container with

 --device=/dev/ttyUSB0

But my openhab.log shows only

2020-04-29 07:49:11.898 [INFO ] [wms.connector.OpenWMSSerialConnector] - Connecting to OpenWMS USB at /dev/ttyUSB0

every minute.

Best regards,
Jörg

You’re hitting a known bug.
A workaround is available here: Binding for Warema Mobile System WMS

Okay, you mean the serial port is not initialized correctly.

So far I don’t have java installed on my host machine. That’s the reason why I use docker…

I have set the log level to debug. Now I get the following output in openhab.log:

2020-04-29 09:48:35.534 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Checking OpenWMS transceiver connection, thing status should be = OFFLINE
2020-04-29 09:48:35.536 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Connecting to OpenWMS transceiver
2020-04-29 09:48:35.538 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Disconnecting
2020-04-29 09:48:35.560 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port event listener stopped
2020-04-29 09:48:35.562 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Interrupt serial listener
2020-04-29 09:48:35.568 [DEBUG] [penwms.connector.OpenWMSStreamReader] - Data listener stopped
2020-04-29 09:48:35.570 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial out stream
2020-04-29 09:48:35.572 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial in stream
2020-04-29 09:48:35.574 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Close serial port
2020-04-29 09:48:35.579 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Closed
2020-04-29 09:48:35.581 [INFO ] [wms.connector.OpenWMSSerialConnector] - Connecting to OpenWMS USB at /dev/ttyUSB0
2020-04-29 09:48:35.583 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port #### Jetzt gehts los
2020-04-29 09:48:35.600 [DEBUG] [wms.connector.OpenWMSSerialConnector] - Serial port event listener started
2020-04-29 09:48:35.603 [DEBUG] [penwms.connector.OpenWMSStreamReader] - Data listener started
2020-04-29 09:48:35.905 [DEBUG] [openwms.handler.OpenWMSBridgeHandler] - Try to send to controller

Are you sure the serial port initialization issue is the root cause?

@joerg_beck

Hi,
i don’t know why, but with the default libs from openhab2 the usb-stick is not initialized correctly. It is sufficient to open the serial port once with other libs (e.g. jssc). :thinking:
To solve this problem I still have to search for solutions … :roll_eyes:

Only for testing purposes I have included a workaround in the binding to initialize the serial port.
If you use it, please give me a short feedback if it works stable for you or not.
But please note that it is only a quick an dirty solution and the usage is at your own risk!

  1. download the Workaround and replace the original binding in the addon folder.
  2. restart openhab

(You may need to copy the lib jssc.jar to the addon folder as well)

Works for me - without having to copy jssc.jar.
Thanks

Hello Rainer, works for me. USB Stick is online. Thank you for the workaround.

Kind regards,
Sascha Jostock