openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[enocean] Sending command to rollershutter with value similar to current state closes or opens the rollershutter completely #15491

Open JanMattner opened 1 year ago

JanMattner commented 1 year ago

Apparently, either the Eltako FSB14 rollershutter actuators or this binding have a strange behavior, as described below. This behavior has been confirmed in two different buildings and setups, one with a USB 300 Gateway connection and the other one with a FAM14 bridge.

Even if the behavior is an inherent Eltako problem, this binding should take care of this to match the expected behavior.

Expected Behavior

Rollershutter is completely open, i.e. has a value of 0. Send a command to close an FSB14 rollershutter to e.g. 15. -> rollershutter closes a bit and remains e.g. at 12. Now send a command value close to the current state value of 12, e.g. again 15. -> rollershutter should do nothing

Current Behavior

See this log:

2023-08-22 21:57:39.179 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Rollershutter1' received command 15 2023-08-22 21:57:43.164 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Rollershutter1' updated to 12 2023-08-22 21:57:43.165 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Rollershutter1' changed from 0 to 12 2023-08-22 21:57:45.721 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Rollershutter1' received command 15 2023-08-22 21:58:26.485 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Rollershutter1' updated to 100 2023-08-22 21:58:26.485 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Rollershutter1' changed from 12 to 100

In this example, this particular rollershutter can only be set to values in steps of 6. So if it starts at 0 and I send a command "15", it remains at 12. If I send again the command "15", the rollershutter closes completely and even updates it state properly (though with some latency). If I send as a second command "10" instead, the rollershutter opens completely.

This behavior is shown if the command is in the range of +/-6 of the current state. For example for a state of 30: Command 30: nothing happens, rollershutter keeps its position. Command 31-36: rollershutter closes completely. Command 37-100: rollershutter closes down to about the specified value (in steps of 6). Command 29-24: rollershutter opens completely. Command 23-0: rollershutter opens up to about the specified value (in steps of 6).

I noticed that for the rollershutters of the roof windows, which are slower, the step size is 3 instead of 6 - and the above strange behavior only occurs in the range of +/-3 of the current state. So it seems to be related to the step size.

Possible Solution

Option 1 (if possible): calculate / get the step size, maybe from the shutTime. If the command is not 0 or 100 (or UP / DOWN), then ignore all commands within the range of the step size around the current state value. Option 2: add a configuration parameter (e.g. for the channel) to define the step size and ignore the commands as in Option 1.

Your Environment

jlaur commented 1 year ago

Side note: You should upgrade to 4.0.2 since 4.0.1 still has some nasty bugs with wild-running threads.

0void commented 1 month ago

I can confirm the same issue on 4.2.0 with Eltako FJ62NP-230V

lsiepel commented 1 month ago

Could you provide a debug log file of the binding?

0void commented 1 month ago

Unfortunately, I do not have the time to collect the log.

But I noticed the duration can become 0 in

https://github.com/openhab/openhab-addons/blob/cc6a202034bc325fe5759d63c71e7a61ef57b938/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFSB.java#L75

The regarding EEP specifies only values from 1 to 255.

In my point of view, there are 2 approaches:

  1. Check duration for 0 and skip the commend
  2. Use the option to provide the duration in 100ms steps

The last one is more accurate because of 100ms steps instead of 1 second steps. But I do not know if there will be a break in compatibility to other devices. At least it would be fine with Eltako FSB14, FSB61, FSB71 and FJ62 devices.

lsiepel commented 1 month ago

As this is very specific to this binding and/or devices, i can only ask @lovery to comment on this.