AdyRock / com.ady.button_plus

GNU General Public License v3.0
2 stars 3 forks source link

Use capability values in button configuration #92

Open denniedegroot opened 8 months ago

denniedegroot commented 8 months ago

This might be a a weird/unique use case but I would like to display a capability value (battery percentage for example) in the button configuration. Currently this is possible in the display configuration but not for the button configuration.

AdyRock commented 8 months ago

The issue is the Button + wouldn't know what to do when the button is pressed.

I could remove the filter and then add code to detect that the capability is read only so the button just publishes a generic message that can just be handled by a Flow.

Or, you could leave the On and Off fields empty and then set the Label text via a Flow when the capability changes.

Obviously I prefer the second option 😁

denniedegroot commented 8 months ago

I am currently already using the second option. The only problem is when the Button+ is restarted/refreshed the initial value seems to be gone so the label text is empty until the capability changes it's value again which can take a long time.

I also don't use it as a button, only text and I use the LED as a warning when the battery is too low.