[SOLVED] Force sending command to zwave device even if it is in desired state

Hi,

I have a Qubino ZMNHND Flush 1D Relay connected via Zwave to OpenHab 2.4 running on Raspberry Pi 3 with RaZberry. I can switch the relay ON and OFF using sendCommand, like this:

Item:

Switch Relay_Switch "Relay on/off" <switch> {channel="zwave:device:REDACTED:node13:switch_binary"}
Switch Relay_Desired "Desired relay state" <switch>

Rule:

rule "update relay"
when
        Item Relay_Desired changed or
        Time cron "0 0/1 * * * ? *"
then
        logInfo("relay", "sending state " + Relay_Desired.state)
        Relay_Switch.sendCommand(Relay_Desired.state as OnOffType)
end

I can switch the relay by sending commands/UI changes to Relay_Desired and this works fine.

Now, the relay has a feature that it can switch the circuit it controls (I’m testing with a lightbulb now, but this the relay will control heater) off after a configured time if it does not receive commands from the controller. The idea is to have this timer configured in the relay so that in case my OpenHAB instance is down for any reason, the heater will turn off after some time to prevent damaging it. That’s why I tried calling sendCommand every minute. However, the relay switches off after the configured interval and is turned on again only after the next time the cron triggers the rule, so the timer in the relay is apparently not being reset.

When Relay_Desired is ON, the zwave logs show different output based on whether the state physically switched or not (sending command in the former case, but only updating channel state in the latter). Based on this I think that OpenHAB does not send the ON command to the relay over zwave network if the relay is in ON state. (I don’t have permission for uploading files here, so if you need the log, let me know).

I have tried adding postUpdate before the sendCommand like this:

if (Relay_Desired.state == ON) {
    Relay_Switch.postUpdate(OFF)
    Relay_Switch.sendCommand(ON)
} else {
    Relay_Switch.postUpdate(ON)
    Relay_Switch.sendCommand(OFF)
}

But adding the postUpdate did not change the behaviour.

Is there any way to force OpenHAB to send the command to the relay every time the sendCommand(ON) is called or synchronize the item state in another way so that the timer in the relay is reset?

You should be able to post your logs now

Thanks. I’m attaching the logs:
zwave-relay.log (66.6 KB)

The ON command is sent around 17:50:00, 17:51:00 and 17:52:00 in the logs. The relay turns off based on the configured 90 second timer around 17:51:30, while it should have reset the internal timer based on the 17:51 command. It is again turned on by a command around 17:52:00.

I’m attaching logs from another test run zwave-relay2.log (36.4 KB)
but these look similar to me.

I’ve reproduced the behaviour with 90 second timer configured in the relay and just a simple rule

rule "update relay"
when
        Time cron "0 0/1 * * * ? *"
then
        logInfo("relay", "sending ON")
        Relay_Switch.sendCommand(ON)
end

I’ve re-checked the logs and it seems I’ve misread the logs at first. In the mean-time I’ve also read the source code of the zwave binding and I believe the commands are always sent from OpenHAB. Could someone please check?

OK, turns out the problem is not in OpenHAB. I have contacted the manufacturer of the relay and they confirmed the issue is in the device. They already have a fix that should be released this month.