-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[enocean] Add second action for two rocker switches #10769
Conversation
Signed-off-by: Dietmar Franzen <[email protected]>
HI @CountBigBang , thanks a lot for your work. I just have some questions before doing the review:
If you answer my last questions with yes, I would suggest to rename "PRESSED_SEC" into "SEC_VALID" and just emit a "PRESSED" event in the convertToEventImpl function. Furthermore I am thinking about to introduce some new events or channels instead of handling this case the same as pressing both channels one after another. What do you think? |
Hi @fruggy83, all my rocker switches are PTM200 switches. Almost all of them are two rocker switches. And some people in my household just love pressing the two buttons simultaneously. Therefore I was very much affected by the missing second action ;-) The second action is only triggered if both rockers are pressed (or released) simultaneously. My understanding of the EEP specification is that this is a feature. To be honest, I did not spend much time testing the RELEASED events, because to my knowledge they do not affect the item states. Is that right? I am totally indifferent to the way the second action is handled. I just wanted to get the issue fixed and tried to be as "non-invasive" as possible with your code. Would you take over and adjust the names (and procedures)? I don't have much experience with Java and are fairly new to openHAB (I am using Python for most of my projects). |
@fruggy83 : Are you making progress with your changes? I would really like to see this issue closed as soon as possible. |
@CountBigBang sorry for my late answer, I was not happy with my implementation (could not add configuration options to the system channel types). However I found a solution and will push them to your PR. |
* Added two new channels: * secondActionPressed: Indicates if second action of rocker switch is pressed too * rockerSwitchAction: emits the combined rocker switch actions "ChannelADir|ChannelBDir", extensible channel, filter for each channel * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Signed-off-by: Daniel Weber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your work. I have just added two new channels and profiles.
Signed-off-by: Daniel Weber <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two general questions that I do not yet understand:
- The referenced issue mentions that certain telegrams (when pressing rockers simultaneously) are not or wrongly interpreted and as such item states are not correctly reflected in openHAB. Why do we need to add additional channels to the thing type for this?
- Why does this PR contain binding specific profiles? How is that related to the issue?
package org.openhab.binding.enocean.internal.config; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a short line of Javadoc here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The javadoc has to go above the author tag (see other classes as a reference).
...ava/org/openhab/binding/enocean/internal/profiles/RockerSwitchActionTogglePlayerProfile.java
Show resolved
Hide resolved
...ava/org/openhab/binding/enocean/internal/profiles/RockerSwitchActionToggleSwitchProfile.java
Show resolved
Hide resolved
Hi @kaikreuzer
I guess this is a little bit to much. I would suggest to revert @CountBigBang change, remove the state channel and just keep the trigger channel type with its profiles? |
Hi @fruggy83 , @kaikreuzer, how do we continue from here? I must say that I am somehow frustrated. I opened the issue on 8 January. After nothing happened for more than four months, I started inspecting the code myself (having little experience with Java), found and solved the problem and made my (first) code contribution to the project in May. Four months on, and the issue is still open ... |
* Channels "rockerswitchA" and "rockerswitchB" do not longer react if second action is pressed * Added new parameter "handleSecondAction" to channel "rockerswitchListenerSwitch" and "rockerswitchListenerRollershutter" to define if classicDevice should react if second action is pressed too * Added documentation * EEP F6-02 refactoring Signed-off-by: Daniel Weber <[email protected]>
Hi @CountBigBang I changed the the behaviour as suggest in my last post. RockerSwitches do nt longer react on second action. If you want to handle a two button press, you have to use the new channel "rockerSwitchAction" or a classic device with corressponding listener channel. These channels can be configured to handle the second action press too. I am really sorry that it took so long. To be honest I just forgot this issue. |
This is good news. Thank you. I'm looking forward to the next milestone release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I also missed somehow @fruggy83's question or rather thought it was directed to @CountBigBang and was hence waiting for feedback on it.
@CountBigBang changed this implementation in a way that an event for channel A and afterwards a second event for channel B is emitted.
I personally would expect no events for channels A+B to be emitted, since the user wish is a simultaneous event. I don't think that a single user event should result in 3 technical events within openHAB (channel A + channel B + sim-Action).
Therefore I introduced a state channel which indicates if second channel is pressed simultaneously.
How would this channel be used? I don't really understand its purpose (unless it is only there to detect that events "channel A" and "channel B" should be ignored, but with the suggestion above, this would not be needed at all).
So I introduced another trigger channel which can be configured in which case it should emit a PRESSED or RELEASED event.
Hm, the code says that this channel emits DIR1|-
, DIR1|DIR1
, etc. events (which makes sense to me).
To be able to link these channels to an item I implemented two binding specific profiles.
If it emits DIR1|-
events, the profile should actually have the filter configuration to say on which combinations it wants to react. This way, you only need the single trigger channel (emitting invariably the same events) and you can link different items to it, which each have a different profile configuration (and thus can react on different button press combinations). Does this make sense?
package org.openhab.binding.enocean.internal.config; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The javadoc has to go above the author tag (see other classes as a reference).
...ava/org/openhab/binding/enocean/internal/profiles/RockerSwitchActionTogglePlayerProfile.java
Show resolved
Hide resolved
...ava/org/openhab/binding/enocean/internal/profiles/RockerSwitchActionToggleSwitchProfile.java
Show resolved
Hide resolved
bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/RockerSwitch.xml
Outdated
Show resolved
Hide resolved
That is exactly how it is implemented since my last commit. The old rockerSwitchA and rockerSwitchB channels just emit an event on a single button press now.
I removed this state channel with my last commit. because of the same thoughts as you had :) Makes it even more simple now. However I forgot to remove this channel from the readme.
I did it the other way around. I have added extensible channel with a filter configuration. However your suggestion of adding just a single trigger channel and do the filtering in the profile is a better approach as it fits more. I will update the PR. Thanks a lot for your thoughts. |
Hi @CountBigBang , you just have to add enable the new parameter "handleSecondAction" in your channel config. Like
I will do a PR for the release notes after this issue got merged. |
* Moved channel config for "rockerSwitchAction" into profiles * Updated and cleaned README Signed-off-by: Daniel Weber <[email protected]>
* Updated and cleaned README Signed-off-by: Daniel Weber <[email protected]>
Thanks for all your work @fruggy83! |
See openhab/openhab-addons#10769 Signed-off-by: Daniel Weber <[email protected]>
See openhab/openhab-addons#10769 Signed-off-by: Daniel Weber <[email protected]>
…) (openhab#10769) * Added new channel: * secondActionPressed: Indicates if second action of rocker switch is pressed too * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Also-by: Dietmar Franzen <[email protected]> Signed-off-by: Daniel Weber <[email protected]>
…) (openhab#10769) * Added new channel: * secondActionPressed: Indicates if second action of rocker switch is pressed too * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Also-by: Dietmar Franzen <[email protected]> Signed-off-by: Daniel Weber <[email protected]> Signed-off-by: Dave J Schoepel <[email protected]>
…) (openhab#10769) * Added new channel: * secondActionPressed: Indicates if second action of rocker switch is pressed too * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Also-by: Dietmar Franzen <[email protected]> Signed-off-by: Daniel Weber <[email protected]> Signed-off-by: Nick Waterton <[email protected]>
…) (openhab#10769) * Added new channel: * secondActionPressed: Indicates if second action of rocker switch is pressed too * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Also-by: Dietmar Franzen <[email protected]> Signed-off-by: Daniel Weber <[email protected]>
…) (openhab#10769) * Added new channel: * secondActionPressed: Indicates if second action of rocker switch is pressed too * Added two new profiles for channel rockerSwitchAction: * rockerswitchaction-toggle-switch * rockerswitchaction-toggle-player * EnOceanSensorHandler can now handle extensible channels too * EEP F6-02 refactoring Also-by: Dietmar Franzen <[email protected]> Signed-off-by: Daniel Weber <[email protected]>
Added code to read a (potential) second action when using switches with two rockers (EEP F6-02-xx) according to the EnOcean specification.
This fixes issue #9750.
Signed-off-by: Dietmar Franzen [email protected]