LightwaveRF + OpenHab2

I’ve also been trying to get LWRF working with openHAB2.
I have the newer type of light link (no digital display).
openhab2 is running on a Pi3

I’ll dropped the jar file into "add ons"
I see LWRF traffic in the logs.
I added an item in .items :
Switch LH_WallLight “Wall” { lightwaverf=“room=4,device=2,type=SWITCH” }
Also in .sitemap :
Switch item=LH_WallLight label=“Left Wall Light”

When I use a remote to turn my wall light on, the switch widget changes state and I get this in the log:
16:26:05.792 [ERROR] [twaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{“trans”:937,“mac”:“20:46:9C”,“time”:1483633565,“pkt”:“433T”,“fn”:“on”,“room”:4,“dev”:2}
16:26:05.793 [INFO ] [marthome.event.ItemStateChangedEvent] - LH_WallLight changed from OFF to ON

However trying to control via openhab widget I get this:
16:23:49.563 [ERROR] [twaverf.internal.LightwaveRfWifiLink] - Error converting message: !{“trans”:928,“mac”:“20:46:9C”,“time”:1483633428,“pkt”:“error”,“fn”:“nonRegistered”,“payload”:"Not yet registered. Send !Fp to register"}

Conclusion; my hub is not paired.
I have read:
"To force the WiFi Link to register your new device paste this into a shell, making sure to set the IP address of the WiFi Link correctly. Then head over to the WiFi Link so you can press ‘OK’."
echo -ne ‘001,!F*p|’ | nc -w1 -u 192.168.x.xx 9760
(obviously with the correct IP)
However WHERE do I type this? I’ve tried from the console, but of course the command is incorrect, also from when just ssh’d into the Pi, but “nc” is of course not a valid command.
I’ve spent hours and hours searching yet no-one has documented where it should be executed.

Any help would be appreciated, & no doubt would help many more people in the future.

Wayne

Do you have this set to true in your openhab config? If so restart openhab and then rush to the wifi link.

# For a new computer you will need to register it with the wifi link to be allowed to send messages
# setting this to true we will send a registration message on startup. You will need to confirm
# registration on the wifi link. There is no harm leaving this as true but you can set to false
# once you have registerd for the first time.
lightwaverf:registeronstartup=true

Or on your pi “sudo apt-get install nc” and then run the command above.

Alas:
[17:05:48] pi@openHABianPi:/usr$ sudo apt-get install nc
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package nc

I do have that set to true in my openhab.config
I run:
sudo service openhab2 restart
then go and press the link button on my lightwaveRF light link?
Tried that and the light flashes, once openhab is back up and running, checked logs yet still showing nonRegistered.

I used:
sudo apt-get install netcat
now I can run the command, the light on my light-link flashes, and the button pairs.

Now my widget turns the light on and off :slight_smile:

Thanks Neil for pointing me in the correct direction, it’s been many years since I used linux.

Hi,

So also new to OpenHAB and pretty new to LWRF. On the message parsing, has all messages changed syntax/structure? I am seeing errors decoding messages to do with lighting, simple ones. It would seem that the current firmware offers some backwards compatibility in terms of messages received, but al in all, OpenHAB binding seems pretty out of step with the current message structure that I see being used in my setup.

[twaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":1154,"mac":"20:46:90","time":1484151757,"pkt":"433T","fn":"off","room":5,"dev":1}

I am using the 1.9.0 version of the binding - is there a another, patched one around?

Does anyone have a view on when we could see some updated code?

Regards,

J

I get those error messages too but it doesn’t affect the operation of the lightwave switch - I can still control my lightwave switches from OpenHAB2. I just ignore the error messages.
Here is me switching an Item in my sitemap that is bound to a lightwave on/off relay:

10:36:02.875 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'LWRF_OfficeLight' received command ON
10:36:02.883 [INFO ] [marthome.event.ItemStateChangedEvent] - LWRF_OfficeLight changed from OFF to ON
10:36:02.885 [ERROR] [twaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":174,"mac":"03:XX:XX","time":1484217362,"pkt":"433T","fn":"on","room":7,"dev":1}
10:36:02.896 [ERROR] [twaverf.internal.LightwaveRfWifiLink] - Error converting message: *!{"trans":174,"mac":"03:XX:XX","time":1484217362,"pkt":"433T","fn":"on","room":7,"dev":1}
10:36:02.982 [INFO ] [erf.internal.LightwaveRFSenderThread] - Ok message received for 224,!R7D1F1

I have the 1.9.0-SNAPSHOT binding and Openhab 2.0.0-SNAPSHOT build #675.

Hi Steve,

Noted the same for lights, got that all working. Just Heating / Every Monitor that are not working at all for me.

Regards

J

Just taken the plunge to upgrade to openHAB2. LightwaveRF binding is one of the main reasons for using openHAB so it would be great to see it updated.

I’m on firmware U2.93Z.

Same as others, dimmers and sockets working but heating not. I’m guessing the cause is yet another change to the format of the network messages with the latest firmware.

I have to agree with @neil_renaud the LightwaveRF radiator valves are rubbish, although the room stat/boiler switch combination works fine. That said, I have 3 rad valves and I’m not about to replace them and then have to buy a wifi base for another system.

Happy to support by contributing observations, copies of messages, error logs, tests etc. but I’m afraid I can’t write java code.

Although I can’t write java, I’ve had a crack at reading the code in openhab/bundles/binding/org.openhab.binding.lightwaverf/src/main/java/org/openhab/binding/lightwaverf/internal/command/LightwaveRfHeatingInfoResponse.java

Looking at the list of REGEX expressions that extract the data, there seem to be a couple of new things in the message from the wifilink: pkt and fn.

Here’s an example message:
{“trans”:136,“mac”:“03:3D:0F”,“time”:1484508340,“pkt”:“868R”,“fn”:“statusPush”,“prod”:“valve”,“serial”:“B769FE”,“type”:“temp”,“batt”:2.70,“ver”:57,“state”:“man”,“cTemp”:18.4,“cTarg”:19.0,“output”:40,“nTarg”:14.5,“nSlot”:“20:15”,“prof”:7}

Here’s the bits that are extracted from the message:
private static final Pattern MAC_ID_REG_EXP = Pattern.compile(".“mac”:"([^"}])".");
private static final Pattern TIME_ID_REG_EXP = Pattern.compile(".
“time”:([^,}]).");
private static final Pattern PROD_REG_EXP = Pattern.compile(".“prod”:"([^"}])".");
private static final Pattern SERIAL_ID_REG_EXP = Pattern.compile(".
“serial”:"([^"}])".");
private static final Pattern SIGNAL_REG_EXP = Pattern.compile(".“signal”:([^,}]).");
private static final Pattern TYPE_REG_EXP = Pattern.compile(".
“type”:"([^"}])".");
private static final Pattern BATTERY_REG_EXP = Pattern.compile(".“batt”:([^,}]).");
private static final Pattern VERSION_REG_EXP = Pattern.compile(".
“ver”:([^,}]).");
private static final Pattern STATE_REG_EXP = Pattern.compile(".“state”:"([^"}])".");
private static final Pattern CURRENT_TEMP_REG_EXP = Pattern.compile(".
“cTemp”:([^,}]).");
private static final Pattern TARGET_TEMP_REG_EXP = Pattern.compile(".“cTarg”:([^,}]).");
private static final Pattern OUTPUT_TEMP_REG_EXP = Pattern.compile(".
“output”:([^,}]).");
private static final Pattern NEXT_TARGET_TEMP_REG_EXP = Pattern.compile(".“nTarg”:([^,}]).");
private static final Pattern NEXT_SLOT_REG_EXP = Pattern.compile(".
“nSlot”:"([^"}])".");
private static final Pattern PROF_REG_EXP = Pattern.compile(".“prof”:([^,}]).*");

pkt and fn are missing but then so is trans, which I think has always been there. I’m not sure exactly how this code works but I would have thought anything that the decoder doesn’t extract would just be ignored.

It is notable the the signal field is no longer present in the wifi link message so maybe this is the problem.

I’m having difficulty getting this to work. OpenHABian running on R-pi 3,
I’ve added the org.openhab.binding.lightwaverf-1.8.0-SNAPSHOT.jar file to \OPENHABIANPI\openHAB-sys\addons

added

################################### LightwaveRf Binding #####################################
#
# The IP Address of the LightwaveRf Wifi Link you can use the broadcast address (required)
lightwaveRf:ip=255.255.255.255
# The port to monitor for messages you shouldn't need to change this
lightwaveRf:receiveport=9760
# The port to send messages on, it will also be monitored for incoming messages 
# you shouldn't need to change this
lightwaveRf:sendport=9761
# For a new computer you will need to register it with the wifi link to be allowed to send messages
# setting this to true we will send a registration message on startup. You will need to confirm
# registration on the wifi link. There is no harm leaving this as true but you can set to false
# once you have registerd for the first time.
lightwaverf:registeronstartup=true
# Delay between sending messages in ms to avoid swapming Wifi Link
lightwaverf:senddelay=2000
# Timeout for OK Messages in ms, we will retry messages we don't receive an ok for in the timeout
lightwaverf:okTimeout=1000

to openhab.cfg located in \OPENHABIANPI\openHAB-conf\services

added

Switch LWRF_light1 "Living room main" { lightwaverf="room=2,device=1,type=SWITCH" }
Switch LWRF_light2 "Living room small" { lightwaverf="room=2,device=2,type=SWITCH" }

to home.items (used wireshark to get room/device

then added a widget in habpanel to operate the lights, but nothing happens.

On reboot, I get an error in the log

20:33:28.181 [ERROR] [org.openhab.binding.lightwaverf ] - FrameworkEvent ERROR - org.openhab.binding.lightwaverf
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.lightwaverf [186]
Unresolved requirement: Import-Package: org.openhab.core.binding

which I can’t seem to sort.

Any ideas?? am I missing something obvious? I’m running a newer hub with no screen.

The error messages are benign although it will be better once they are integrated…

The way it works
Openhab -> Wifi Link (set light to 50%)
Wifi Link -> Openhab (ok) it sends this even though it hasn’t sent the command (and might not if you flood the link)
Wifi Link -> Openhab (message above) this is sent when it actually sends the command so we can now do retries on this once I get to coding it (at the moment if you swamp the wifi link it will just siliently drop some commands).

The message parsing for heating/energy is quite fragile - it needs to be made more robust. I will try to look at this one day but I’m so busy at the moment.

Would be great to be able to control the heating as that is something that I am looking to do

Regards,

J.

@monkey_trumpet have you authorised your RPi as a source of commands?

I see you have set registeronstartup=true. Did you hang around by the wifilink until it asked you to confirm registration of your RPi? On the older wifi links with the display, it asked you to confirm registration. Not sure how that goes on the newer ones.

On my configuration recieveport and sendport are the other way around so
lightwaverf:receiveport=9761
lightwaverf:sendport=9760
I’m sure I had to change these way back. I think there is a comment about this somewhere else on teh forum but having that configuration works for me.

The message format looks like json. Would it be more robust to parse it with a JSON parser rather than REGEX?

Yep, waited by the unit, restarted the pi, the unit flashed, pressed to
associate, then no difference at all.

Worth a try swapping the ports?

I’ll give that a go when I’m home at the weekend!

Bump… Just looking for an update here. Would love to be able to control the heating and it would be good to know that this was being looked at.

J.

@neil_renaud is the author of the binding. Although I can read the code, I don’t know how to edit or recompile it so I’m the same as you - waiting for someone who can do that.

Even when it did work, I’m not sure it controlled the heating - I only ever used the binding to read temperatures/status etc rather than actually control.

bump - Feels like I am alone in still using LWRF and wanting to use it with OpenHAB2… Is this being looked at all?

Cheers,

J.