-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Standard Native Buttons #3822
Comments
As I understand it, you would like to retrieve in an item state the user actions done in UI on buttons? Is that correct? We defined recently the Buttongrid element for sitemap UIs but without this feature but I believe it can be enhanced. |
I would like to have a new item type added... Button. |
Maybe the button from this Binding does what you want? |
Interesting set of tools there, it doesn't state that those buttons are visible in standard sitemaps though. It's more likely they are widgets. |
The binding is about things which simulate real life devices - to make testing easier or use as dummy things - I have it installed but not used yet - but thought, as you were asking about events, that it may be useful - as it simulates a button |
I believe there is no Button Item type by design so this will be a hard sell (any changes to Item types is a hard sell because it impacts all the repos, not just this one). A Button doesn't really have a state, it has events. An Item's entire reason for being is to store state so when you have events and do not have state, a Thing's Event Channel is to be used. In MainUI, when one wants to generate an event like that, it has the ability to call a rule as an action when activated. That mimics how an event Channel would trigger a rule. Maybe something similar could be worked up for sitemaps? I would imagine it would be an extension to the behavior of the Switch element with mappings. Am I completely off base @lolodomo? |
If you could get a switch to look like a button with some styling magic that would work, that would essentially be a toggle button. |
Reverting of the switch would be possible already - think it's one of those meta things you can add - I know I did it before |
It's been a long time since I messed with sitemaps. I think you can set up a mapping on the Switch (which gives you the button UI element) and have it send TOGGLE which will flip the switch (i.e. command ON when OFF, OFF when ON).
The There is also the rawbutton_on_off_profile which might be useful here. https://www.openhab.org/docs/configuration/items.html#profiles |
Just looked at that, good idea in principle, but that simply reverts to a state after a period of time, there is no way to 'press and hold'.
I agree it may well constitute a level of change that others may find uncomfortable undertaking, however I would suggest adding things is easier than removing things (from a backwardly compatibility point of view) and furthermore I would respectfully hope the team are still willing to evolve the existing toolset rather than having a view that 'this is what you have, make do'. I actually asked for buttons way back in OH2, I was genuinely surprised they wasn't included in the item types. |
That's what the rawrocker-to-dimmer profile does. There might be something you can use there.
Well, like I said, an Item that doesn't represent a state violates the architecture and defined meaning of an Item. It's not just adding a new Item, it's changing the entire meaning of what an Item is. And, like I said, even merely adding a new Item impacts openhab-core, openhab-addons, openhab-webui, openhab-android, and openhab-ios at a minimum. It's a pretty big deal. Someone would have to be pretty dedicated to volunteer to take that on. |
Why would it not have an item state? Surely if it's pressed it's ON, and released it's OFF, the end user simply maps these to PRESSED and UNPRESSED respectively. This is the behaviour I would expect it to adopt (ie. Button gets ON state change event, rule executes, maybe runs a timer if jogging is required, Button gets OFF state change event, which is either ignored or cancels the timer is automation is jogging). I mean, there would be nothing stopping a person from binding this to a light and using the button to send morse code to their neighbours. |
Then this isn't the right repo for this. You don't need a new Item type, you need new UI elements/widgets to send ON/OFF when pressed/released. The Switch Item would still be appropriate. |
What is requested is not a new item type but a new UI stateless element having specific commands on a switch item. When the UI button is pressed, the UI sends command ON and the button is released, the UI sends command OFF. |
For sitemap UIs, what do you think about a new Switch element parameter named It should not be too much difficult to implement that in Basic UI. @openhab/android-maintainers |
I am still hoping this will be adopted in some fashion, It still baffles me we have a toolset for almost everything you can touch in your home, apart from buttons. |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/button-on-when-pressed/153062/5 |
Yes, it would be great to have a button that works like a button in real life :) |
+1
If the item is currently OFF, it shows as "not pressed down" and when the user touches and holds (press and hold), it sends an ON command, and when the user releases the widget, it sends OFF command. Another alternative is that it can show the current state of the item. So if the item is currently ON, it shows as being depressed (pressed down). If the user touches it, and holds it, it does nothing but when the user releases the button, it becomes "not pressed down", and it would send an OFF command. Also similar to https://community.openhab.org/t/confirm-button/146490 we could add a Multi-clicksHowever, this doesn't support "double click, triple click, (N-clicks), hold". To do this, it needs to be linked to a string or number item, and then it would need the ability to specify the intervals between clicks to be considered double clicks vs two single clicks, etc. Maybe add another parameter |
In that case (so many different options), it is better to create a new sitemap element named "button" with its own dedicated parameters. |
@openhab/core-maintainers : it would cool to tag this feature request with the tag "sitemap". |
What the use case of these new buttons? I read rollershutters somewhere, but the Android app already has a "press and hold" feature for the rollersutter buttons. |
I'd just like to mention that we have buttons in sitemaps since openHAB 0.6 or earlier already... They are part of the Switch widget, if a mapping is added to them. The nice thing about this feature is that you can even have several buttons on the same line (all with different/custom commands and label texts). If the underlying item does not have an auto-update configured, the buttons should always be shown as "not active" (it feels that we currently have a bug in the Basic UI, because this somehow does not seem to work as expected). So imho the feature request here is mainly about adding support for different kinds of events like "released" or "double-press". Events do not really fit to the concept of sitemaps, though, which are about interacting with items. Not sure if we have any example of events in the UI so far and how those could be best incorporated. I would want to avoid blowing up the logic for all our UIs to implement, such as defining 4 different items for 1, 2, 3 and 4th press within a certain timeframe etc. Only sending press/release events and then processing those on the runtime (similar to processing thing channel events through different profiles) is probably the much better choice. |
Any item really where 'jogging' would be useful. Scene selection is another benefit. Or simply as a trigger to perform multiple actions from rules. |
@psychuk It really sounds as if you do not know the button feature yet. Check out https://demo.openhab.org/basicui/app?w=0202&sitemap=demo, where you can see a demo button. It is exactly made for switching scenes and such stuff. |
Interesting, I like the idea of having many buttons on one line, however do those buttons have a press and release action? |
No, see my comment above. |
If this approach is taken (I've no opinion either way) please don't add yet another custom subsystem to handle events from UIs to the Item. If it is at all possible, please try to come up with a way to use the already existing Profiles (note there are already some button press profiles which might be applicable here). As an added bonus, providing a way to add profiles to an Item without a Channel would be awesome! I think it would be a boon if profiles could be made generic like that. |
I think It's also worth mentioning that this kind of enhancement (or addition) would not break anyone's current setup or configuration. |
If by that, you meant using rules (rulesdsl/jsscripting/ruby, etc), keeping track of precise timing for multi-clicks will be difficult because of the latency between front end UI -> REST -> event bus -> rule. This is one thing that needs to be done on the front end. |
I agree it would be better, to have such things handled in the GUI, however if this becomes a reason not to implement any changes I would rather have some button functionality, than none whatsoever. |
You mean a new concept to implement in core framework: events attached to item that will be handled by rule engines ? |
I believe it was already discussed few years ago, I even proposed a fix but you did not like my solution. Then no other solution was proposed. |
This is like the regular
Yes, this would be great. Just no hold after a push would be wonderful. |
@kaikreuzer : can you please develop your thoughts, I am not sure to understand the solution you would prefer. |
Is there any progress in the development of the button? |
No progress on my side, I simply did not understand what was the preferred implementation solution. |
From my point of view, an addition or change to the current "Switch" element would suffice. |
Maybe the proposed solution by @kaikreuzer was to define a new kind of events on the bus, a special UI event that would be sent by UIs when the button is pressed or released for example. The core framework should then be updated to handle these new events and in particular to add a new trigger in all rule engines. Not something trivial I believe. |
If you are assuming you have to implement various button states, then it gets more complicated, having a button element that reports 'ON' when pressed and 'OFF' when released is far easier, in my opinion, those events already exist (state change event). This was my original 'bare minimum' functionality when creating this feature request. |
Let's restart all of this. First, Kai has right, we have buttons in sitemap UIs since many many years. With the following items:
and the following sitemap elements:
The result is: These buttons are click buttons, the command is sent to the item when clicking the button.
This could be used even with several buttons:
This extended syntax is fully backward compatible. This is an easy solution to implement, first in the core framework with a small change in the sitemap syntax and finally in Basic UI to support the two different modes. Edit: use ":" rather than "-" as separator as a command can be a negative number. |
Mappings attribute for switch element now accepts one or two commands for each button. If only one command is provided, the button is a click button, the command is sent to the item when the button is clicked. If two commands are provided (separated by ":"), the button is a press & release button, the first command is sent to the item when the button is pressed and the second when the button is released. Syntax example for a click button: Switch item=DemoSwitch mappings=[ ON="ON" ] Syntax example for a press & release button: Switch item=DemoSwitch mappings=[ ON:OFF="ON" ] Related to openhab#3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Related to openhab/openhab-core#3822 Depends on openhab/openhab-core#4183 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Related to openhab/openhab-core#3822 Depends on openhab/openhab-core#4183 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
…4183) * Extend sitemap syntax for switch to support press & release buttons Mappings attribute for switch element now accepts one or two commands for each button. If only one command is provided, the button is a click button, the command is sent to the item when the button is clicked. If two commands are provided (separated by ":"), the button is a press & release button, the first command is sent to the item when the button is pressed and the second when the button is released. Syntax example for a click button: Switch item=DemoSwitch mappings=[ ON="ON" ] Syntax example for a press & release button: Switch item=DemoSwitch mappings=[ ON:OFF="ON" ] Related to #3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Related to openhab/openhab-core#3822 Depends on openhab/openhab-core#4183 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
The feature is now available in Basic UI. @openhab/ios-maintainers @openhab/android-maintainers : any plan to add this feature in iOS and Android apps ? |
Related to openhab/openhab-core#4183 and openhab/openhab-core#3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Related to openhab/openhab-core#4183 and openhab/openhab-core#3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
) Related to openhab/openhab-core#4183 and openhab/openhab-core#3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
I believe this feature request can now be closed. |
* Apply logo for free@home binding Apply logo for free@home binding Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com> * [sitemap] New Slider parameter releaseOnly (#2287) * [saicismart][renault] Add addon SVG logo for Renault and SAIG MG Cars (#2290) * [saicismart] Add addon logo for MG Cars from https://de.wikipedia.org/wiki/Datei:Mg_logo.svg Signed-off-by: dougculnane <doug@culnane.net> * [saicismart] Use SVG not PNG for addon logo Signed-off-by: dougculnane <doug@culnane.net> * [renault] Use SVG not PNG for addon logo Signed-off-by: dougculnane <doug@culnane.net> --------- Signed-off-by: dougculnane <doug@culnane.net> * Update persistence actions docs (#2289) * update persistence actions docs Signed-off-by: Mark Herwege <mark.herwege@telenet.be> * correction Signed-off-by: Mark Herwege <mark.herwege@telenet.be> * document HistoricItem Signed-off-by: Mark Herwege <mark.herwege@telenet.be> * review adjustment Signed-off-by: Mark Herwege <mark.herwege@telenet.be> --------- Signed-off-by: Mark Herwege <mark.herwege@telenet.be> * Update link to update-description-1.0.0.xsd (#2275) The link for the update-description-1.0.0.xsd is wrong. Signed-off-by: M Valla <12682715+mvalla@users.noreply.github.com> * Replace logo of free@home binding with SVG version Replace logo of free@home binding with SVG version Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com> * [sitemap] Precision for Default element leading to Slider element (#2294) Signed-off-by: Laurent Garnier <lg.hc@free.fr> * [sitemap] Press & release feature for buttons in a switch element (#2293) Related to openhab/openhab-core#4183 and openhab/openhab-core#3822 Signed-off-by: Laurent Garnier <lg.hc@free.fr> * [airgradient] Add logo for recently added binding (#2296) * [airgradient] Add logo for recently added binding * Add airgradient logo in SVG format Signed-off-by: Jørgen Austvik <jaustvik@acm.org> --------- Signed-off-by: Jørgen Austvik <jaustvik@acm.org> * [multimedia] Add record and transcribe commands (#2295) * [multimedia] Add record and transcribe commands Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com> * apply pr review Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com> * fix md errors Signed-off-by: Stefan Höhn <mail@stefanhoehn.com> --------- Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com> Signed-off-by: Stefan Höhn <mail@stefanhoehn.com> Co-authored-by: stefan-hoehn <mail@stefanhoehn.com> * Apply logo for free@home binding Apply logo for free@home binding Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com> * Replace logo of free@home binding with SVG version Replace logo of free@home binding with SVG version Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com> --------- Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com> Signed-off-by: dougculnane <doug@culnane.net> Signed-off-by: Mark Herwege <mark.herwege@telenet.be> Signed-off-by: M Valla <12682715+mvalla@users.noreply.github.com> Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: Jørgen Austvik <jaustvik@acm.org> Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com> Signed-off-by: Stefan Höhn <mail@stefanhoehn.com> Co-authored-by: stefan-hoehn <mail@stefanhoehn.com> Co-authored-by: mueller-ma <mueller-ma@users.noreply.github.com> Co-authored-by: Doug Culnane <32482395+dougculnane@users.noreply.github.com> Co-authored-by: Mark Herwege <mherwege@users.noreply.github.com> Co-authored-by: M Valla <12682715+mvalla@users.noreply.github.com> Co-authored-by: lolodomo <lg.hc@free.fr> Co-authored-by: Jørgen Austvik <jaustvik@acm.org> Co-authored-by: GiviMAD <GiviMAD@users.noreply.github.com>
I would very much appreciate the inclusion of standard buttons as a type of item in both the OH web interface and the iOs and Android sitemaps.
As of now this type of interaction is best achieved using switches, but switches are not buttons, there is no button-down, button-up, click, or double click event availability (at the very least the first two events should be supported, other behaviours could be simulated in code).
Native buttons would do much to not only beautify sitemaps but to greatly improve functionality where a user simply wants OH to 'do this', instead of having to choose a state implicitly.
The text was updated successfully, but these errors were encountered: