Hello Folks,
I am using openhab since Feb this year and I am delighted from what I got. I’ve got 11 Velux Windows and 11 Shutter and it is nice to automate the handling thru the KLF200, which I do with ruby.
I was trying to get the state of a Velux Shutter recently and did get a NULL back from the KLF200. I saw also a warning in the log that every update of the 11 windows or/and shutter failed.
Is this a known problem or did I miss something in installing the KLF200? I was searching the web and also this site and couldn’t find anything helpful.
Thanks, Falk
I am controlling 2 windows and blinds with the KLF200 without issues.
Is your bridge Thing online?
I’ve had this once. It was solved by disabling the bridge thing, power cycling the klf200 device (pulling the plug for half a minute) and then after another 30 seconds enabling the bridge again.
There is a known issue whereby the KLF goes into a “zombie” state. The OH binding opens a TCP socket connection to the KLF for sending and receiving the commands. It can happen that if OH is stopped and restarted then obviously OH knows that the TCP socket connection was lost. However quite often the KLF does not realise that the socket was closed, and sits quite happily in solitary bliss. Unfortunately the KLF only accepts one single socket connection, so if it is in such blissful state it will refuse any second socket connection attempt from OH. The solution – as @Chiuaua79 so rightly says – is to power cycle the KLF. Indeed I have both my KLFs powered via a smart plug so I can do the power cycle process from OH. I have a script that detects when the Bridge is down and does the respective power cycle automatically…
Exactly what I implemented last year. No more issues since then.
Thank you Andrew, that sounds logical. If that “zombie” state is in place, does that mean that any communication with the KFL200 does not workin? I am asking this, because OPEN, CLOSE of windows and UP and DOWN of shutter is always working!
Thanks you Chiuaua, I’ll try this one …
If the KLF is in a zombie state then commands from OH will not work, but commands from remote control devices will still work.
Thanks for quick answer and sorry for being not accurate… OPEN, CLOSE, UP and DOWN work always from OH using ruby or the UI …
Fixed - two steps. First the hint from Chiuaua79 … after power on the KLF200 the WARNING in the log disappeared. Second step I found in the openhab console (I was first time there that there is the myshutter item AND the myshutter_Position item as well! With the position item I get the position very exact … Thanks guys, this community works very well.
As my unit went zombie about every three months, I installed a smart plug for the KLF200 and created a rule over one year ago. The rule also logs to the openhab.log.
But after the smart plug and rule, the rule apparently NEVER had the need to run automatically and no problems with zombie state at all . Only one or two openhab restarts in that year for installing openhab updates. I have even run the rule a few times manually to check it was actually writing messages to the log.
Well, I’ve had the “part zombie” state as well.
OH commands would work, Remote control commands would work, but no state would get sent back to OH.
It all came back after a power cycle on the KLF
@AndrewFG @hmerk
So far, I’ve manually unplugged the KLF but I actually got a spare smart plug, so I will also automate this step!
Any chance you can post the script you’re using ?
I’ve never did something with Things state in OH. Do you switch off the KLF, disable thing, switch on KLF, enable thing? Or simply restart the KLF and OH does it’s thing?
Thanks!
Here is the rule I’m using:
configuration: {}
triggers:
- id: "1"
configuration:
thingUID: velux:klf200:abcdef
type: core.ThingStatusChangeTrigger
conditions: []
actions:
- inputs: {}
id: "3"
configuration:
type: application/javascript;version=ECMAScript-2021
script: >-
(
function()
{
const bridge = things.getThing("velux:klf200:abcdef");
const aubess = items["Prise_Aubess_zigbee2mqtt_state"];
console.log("Veluf KLF status changed: " + bridge.status + " / " + bridge.statusInfo);
if (bridge.statusInfo.startsWith("OFFLINE (COMMUNICATION_ERROR)"))
{
console.warn("Veluf KLF is zombie, restarting it via the zigbee power socket");
console.log("Veluf KLF zombie -> disable bridge");
bridge.setEnabled(false);
java.lang.Thread.sleep(2000);
console.log("Veluf KLF zombie -> power off");
aubess.sendCommand("OFF");
java.lang.Thread.sleep(10000);
console.log("Veluf KLF zombie -> power on");
aubess.sendCommand("ON");
java.lang.Thread.sleep(5000);
console.log("Veluf KLF zombie -> enable bridge");
bridge.setEnabled(true);
}
}
)
();
type: script.ScriptAction
Awesome, thanks a lot!
The statusInfo
is interesting, will use that too. And I see you do disable and re-enable the bridge, perfect.