Skip to content
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

[hue] Update example (item Kitchen_Wallplate_Switch_Last_Event) #15656

Merged
merged 1 commit into from
Oct 14, 2023

Conversation

Gemertw
Copy link
Contributor

@Gemertw Gemertw commented Sep 26, 2023

Under demo.items the button-last-event channel was of the Number type. I have changed this to String. In the channels for devices section this was already corrected but is not 'live' yet?

Under demo.items the button-last-event channel was of the Number type. I have changed this to String.
In the channels for devices section this was already corrected but is not 'live' yet?   

Signed-off-by: Gemertw <59452423+Gemertw@users.noreply.github.com>
@jlaur jlaur changed the title Update readme_v2.md [hue] Update readme_v2.md Sep 26, 2023
@lolodomo
Copy link
Contributor

lolodomo commented Oct 8, 2023

@openhab/add-ons-maintainers : I have a doubt: can an item be linked to a trigger channel ?

@kaikreuzer
Copy link
Member

No.

@lolodomo
Copy link
Contributor

lolodomo commented Oct 8, 2023

No.

Thank you.

So the proper documentation fix will be to remove this item, not to fix its type.

@andrewfg
Copy link
Contributor

andrewfg commented Oct 8, 2023

No

Umm. @kai I am not sure that your statement is correct. You can certainly link a a String item to a Trigger channel by means of a profile. I think this was what the creator of this PR is getting at. The button trigger channels produce a numeric value e.g. 1002 indicating the button id and the button press type, and this can be linked to a String type item via a profile.

@lolodomo
Copy link
Contributor

lolodomo commented Oct 8, 2023

But there is no profile used in the example?

@andrewfg
Copy link
Contributor

andrewfg commented Oct 8, 2023

there is no profile used in the example.

Correct. So probably the correct answer for this PR is not to delete the example, but rather to modify it to also include a profile element in the item definition. Or?

@lolodomo
Copy link
Contributor

lolodomo commented Oct 8, 2023

Ok.
I am myself not comfortable with profile. So a working/valid example is welcome.

@andrewfg
Copy link
Contributor

andrewfg commented Oct 8, 2023

I am not currently at home, but from SSH into my system I can see that I do have String Items connected to such Trigger channels (by means of a profile) where the profile used is the default profile type (namely String) and since this is the default type, it does not need to be explicitly declared in the .items file entry. So -- in other words -- the changes to the example that are proposed here by the OP, do in fact work correctly. (Albeit perhaps not for the reasons that one might expect...)

String Dining_Room_Dimmer_Last_Event "Dining Room Dimmer Last Event" {channel="hue:device:g24:81d9a9d5-228c-45df-828e-0d224929b3d1:button-last-event"}

@Gemertw
Copy link
Contributor Author

Gemertw commented Oct 8, 2023

I am not using a profile either and have this working for several wall switches in the same way as the example of @andrewfg.
Hence my request for this minor documentation change.

String   WskmrKntrWallSwitch   "Dimmer switch state"  (PersistForRestore)    {channel="hue:device:huebridge2:WskmrWallSwitch:button-last-event"}

Copy link
Contributor

@andrewfg andrewfg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the comments IMHO LGTM

@lolodomo
Copy link
Contributor

https://www.openhab.org/docs/configuration/items.html#profiles

For default profile (type state):

If you don't specify any Profile, this Profile will be used. For State Channels, this means that states and commands are just propagated from the Channel to the Item and vice versa without any changes. For Trigger Channels, the Default Profile won't change anything on the Item.

For trigger-event-string profile (type trigger):

This Profile can be used to link a trigger channel to a String item. The item's state will be updated to the string representation of the triggering event (e.g. PRESSED).

Considering what you are noticing, the documentation is wrong ?

@openhab/core-maintainers : do you know where is the code in core framework that applies a profile per default to channel links ? We could check what is really implemented and then fix the documentation.

@andrewfg
Copy link
Contributor

Considering what you are noticing, the documentation is wrong ?

Yes I think so. For trigger channels it appears that it defaults to 'trigger-event-string' if no other profile is explicitly specified.

@andrewfg
Copy link
Contributor

andrewfg commented Oct 14, 2023

do you know where is the code in core framework that applies a profile per default to channel links ?

@lolodomo the respective code line is HERE which confirms that the default profile for trigger channels is indeed TRIGGER_EVENT_STRING and that therefore the doc is wrong.

@lolodomo if you agree with this, then I am happy to create a PR to fix the doc. => Please let me know.

@lolodomo
Copy link
Contributor

do you know where is the code in core framework that applies a profile per default to channel links ?

@lolodomo the respective code line is HERE which confirms that the default profile for trigger channels is indeed TRIGGER_EVENT_STRING and that therefore the doc is wrong.

@lolodomo if you agree with this, then I am happy to create a PR to fix the doc. => Please let me know.

Yes, please do it.

@lolodomo lolodomo merged commit 57b2655 into openhab:main Oct 14, 2023
2 checks passed
@lolodomo lolodomo added this to the 4.1 milestone Oct 14, 2023
@lolodomo lolodomo changed the title [hue] Update readme_v2.md [hue] Update example (item Kitchen_Wallplate_Switch_Last_Event) Oct 14, 2023
@andrewfg
Copy link
Contributor

Yes, please do it.

@lolodomo - done - see openhab/openhab-docs#2141

querdenker2k pushed a commit to querdenker2k/openhab-addons that referenced this pull request Oct 21, 2023
Under demo.items the button-last-event channel was of the Number type. I have changed this to String.
In the channels for devices section this was already corrected but is not 'live' yet?

Signed-off-by: Gemertw <59452423+Gemertw@users.noreply.github.com>
querdenker2k pushed a commit to querdenker2k/openhab-addons that referenced this pull request Oct 29, 2023
Under demo.items the button-last-event channel was of the Number type. I have changed this to String.
In the channels for devices section this was already corrected but is not 'live' yet?

Signed-off-by: Gemertw <59452423+Gemertw@users.noreply.github.com>
Signed-off-by: querdenker2k <querdenker2k@gmx.de>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Under demo.items the button-last-event channel was of the Number type. I have changed this to String.
In the channels for devices section this was already corrected but is not 'live' yet?

Signed-off-by: Gemertw <59452423+Gemertw@users.noreply.github.com>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants