-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Generic buttons defined by attribute changes #346
Conversation
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 @t-8ch I'll probably let @hsudbrock review this since he wrote the initial implementation. From a quick look though it looks fine. As you say - tests are needed, and I might also suggest the occasional line or two of comments ;)
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
Will do! |
ac88934
to
42c5777
Compare
Currently the value of the attribute is compared via via its string representation.
|
How should the tests be grouped/ordered in relation to the existing command tests? |
42c5777
to
10e4a27
Compare
It seems the channels can't be linked from the UI, as no profile can be selected. Edit: It's probably because the channel only triggers and has no state |
d9d8828
to
71f7284
Compare
@cdjackson One question about the configuration application: |
No - this is not the intention. There should only be a single thing discovered - initially the generic device, and finally the specific device. I am reasonably sure that it used to work like this, but I also know there have been some changes in ESH recently to remove some inbox functionality, so maybe this is now broken.
… On 26 Dec 2018, at 11:45, Thomas Weißschuh ***@***.***> wrote:
@cdjackson <https://github.com/cdjackson> One question about the configuration application:
Currently after pairing the switch from the inbox it will take some time until it is fully discovered. After the device is fully discovered a second Thing, with the properties and channels configured via the XML files, appears in the Inbox.
Adding this Thing will again trigger a full discovery process.
In the end there are two Things configured, one generic and one properly usable.
Is this intentional or is my configuration somehow broken?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#346 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA_kQys6ZXJ0HswekiyBrAzGHgJI2Eiiks5u82FggaJpZM4ZgAFp>.
|
Ok. Maybe someone with one of the other configured devices can try to reproduce the issue. |
Hi @t-8ch, thanks for contributing! I had a first look at the PR, and before I start a detail-level review, I have a general question. The reason for the question is that, at first glance, it looks a little odd to me to use trigger channels in combination with ZigBee attribute reporting - but maybe this is only due to how the Xiaomi Aqara wall switch (which I have not used so far) is implemented. You have added three trigger channels for the wall switch, The channel triggers when the device reports a new value for the attribute The question: Will the value of the attribute always indicate the last press that was performed on the left button of the device? I.e., imaging doing a double press, then waiting for 10 seconds, and then reading the attribute from the device. Will the attribute value still be Background of the question: It seems strange to me that an attribute is used to model an action like a button press, and I wonder why this is modeled like this for the wall switch. Attributes smell like some state that can be retrieved from the device - which could, maybe, be better modeled with a state channel and not a trigger channel in openHAB. |
To be honest, I only ever used the attribute changed commands emitted by the switch presses. |
Also the physical device itself does not indicate any state to the user. |
Thanks for the feedback, @t-8ch. From what you write, it sounds like the wall switch uses attributes in a - for me - strange way (which might be completely normal when looking at it from another angle though...) From what you write, it sounds reasonable to cover this with the |
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 had a look at the changes, see comments inline.
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
Thanks for the feedback. I will try to implement it soon. |
023589f
to
364db45
Compare
@hsudbrock I update the PR to incorporate your suggestions. FYI: Currently I don't have access to the switch, so this version of the PR is not actually tested with a physical device. |
364db45
to
47ee72d
Compare
The CI seems to be happy now. |
@t-8ch Thanks for the update. Sorry, I did not get to have a look again yet, will do this soon! Just one hint, as I see that you force-pushed to your branch: For the reviewer, it is often easier if you add new commits instead of changing commits, so that one can see what has changed in addition. (When merging the PR github will squash the commits anyway...) |
If you prefer it this way sure. |
Thanks; no need to change anything now for the review though, just as hint for next time :)
Fine for me; as far as I recall, github will squash the commits though when merging, creating a commit that has the PR title as commit message, so the reorganization might not be visible in this project's commit history anymore. Not sure 100% though... |
You should be able to choose when performing the merge. |
OK, thanks for the hint! |
Hm, I will also perform some cosmetic cleanups. (Rewording, things that should not be changed, etc) |
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 for the update to the PR! I have added some small comments inline.
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/openhab/binding/zigbee/internal/converter/ZigBeeConverterGenericButton.java
Outdated
Show resolved
Hide resolved
@hsudbrock I addressed your comments. |
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, lgtm! OK to merge from your side, @cdjackson ?
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Hi @t-8ch; could you please rebase the PR on the I just had a look at the merge conflict, I think it is only two things to do:
WDYT? |
Signed-off-by: Thomas Weißschuh <[email protected]>
2a22eff
to
3ec985b
Compare
@hsudbrock Done |
Signed-off-by: Thomas Weißschuh <[email protected]>
Signed-off-by: Thomas Weißschuh <[email protected]>
Signed-off-by: Thomas Weißschuh <[email protected]>
3ec985b
to
d809a97
Compare
@t-8ch Thanks! |
This PR extends the generic button functionality. It allows the definition of buttons based on attribute changed events.
An example configuration for a Xiaomi Aqara wallswitch is provided.
The logic and checks to validate the configuration should be cleaned up.
Also tests are need.
If there is interest in this feature I will provide them.