Pause/resume visual feedback and button position

I'm rewritting some cust apps and would love to know how in groovy one can make the app's name return the little red "paused" feedback.

Also, I would like to know which parameters allows to define a button's position inside the preferences.

Thanks in advance for your help!

This app has the easiest way to to it that I've been able to find. I used similar code in some custom apps that I wrote for myself.

The method used is quite simple. A separate method is called in the pageConfig method. In this app it is called "pauseOrNot".

Thank you @Ryan780. However, the link is dead...

Never mind, it's my browser not interpreting the %%2520 as a space. I went directly to the repository instead
Thanks again, I'll now look into it

No, it's a discourse bug...

https://github.com/Botched1/Hubitat/blob/master/Apps/Dimmer%20Sync/Dimmer%20Sync%20Child.groovy

The methods you're looking for are in the Dimmer Sync Child app, just so you don't have to search for them.

1 Like

https://github.com/Botched1/Hubitat/tree/master/Apps/Dimmer Sync

The 'pauseOrNot' code I originally wrote is not always as reliable as I had hoped.
Just an FYI, it sometimes leaves a (paused) addition to the app.name (not in red)

Never really did get to the bottom of why it sometimes does that as I do it differently now.

Andy

There are no 'parameters' as such
But... you should be able to position it with standard html

Andy

Thanks. The issue is that I don't know how to implement some html code within the object "button" so to trigger the btn event. I can create any button in html, of course, but how do I fuse this with HE's groovy "button" type so to trigger, for example, the pause action?

You beat me to the punch. :slight_smile:

I think I directly used your pause code (as credited in the app, but I probably could have been more explicit on which parts of the code are attributed to whom - instead of a general credit). I also noticed that in some scenarios I could get a leftover (paused). Didn't happen often, so I didn't bother to try and fix it.

That was actually the 1st groovy app I wrote in HE. As always, your and Brian's utility/layout examples were monumentally helpful.

On second thought, there has to be a way within groovy directly to place the button since it is done in RM: Update button, for example, is always to the right end of the page, while "run actions" is to the left...

Have a look at this post to see how the button is coded..

Andy

2 Likes

Thank you. I have read this entire thread already. The issue is not that I don't know how to code the button nor its corresponding evt handler. The issue is that I don't know how to format, position and maybe even resize the button just like I would do in HTML or CSS. I know it's possible since RM does it.

Maybe @bravenel or @mike.maxwell can come save me again from the daemons of my ignorance? :slight_smile:

You should play around with

, width: 4

for an input or paragraph. The total width of a computer size page is 12. You have to manage the widths of things to add up to 12.

paragraph " ", width: 6

would space over half a screen. Follow with

input myButton, "button", title: "My Button", width: 6

would put a button on that right half..... etc. Play with it to figure out it out.

3 Likes

ooooh! That thing I didn't even dare to try for I would again be accused of barbaric coding! Just kidding. True, though, that I thought of playing with spaces " " using paragraph... But since I read saw that html was somewhat accepted, I was stubbornly betting on an html solution!

Thank you so much @bravenel!

while(app.label.contains(" (Paused) "))        {app.updateLabel(app.label.minus("(Paused)" ))}

Actually I code it complete differently now so that it never does that :crazy_face:
I also have a proper button rather than than a switch on my revised apps

Andy