Is there a way to fire a method when a device is displayed?


(Ron) #1

I reported bug with slider not initializing when the device detail page is opened.

I could temporarily fix it if I could fire a method when the page it opened. I could get the current value and send an attribute event to set that same value. The slider seems to display it’s slider value correctly when the attribute event is issued.

I could see this perhaps being useful at other times also.

On a similar note is there a list of events that can be subscribed to ?
Location events are listed on the documentation page but I am assuming there are many other types of events. Actually can a device generate it’s own events ?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Ummm… That’s what most devices do – either process Commands and/or initiate Events. The only way to update and share an Attribute is via an Event.

Currently, I believe that you do not need to declare all such “Attributes” in the metadata{}; but technically the Event name is the Attribute name, if you don’t mind the quick oversimplification.


Or am I misunderstanding your question?



(Ron) #3

Good point, my last question came to mind while typing main question. Technically it’s off topic from my main question if there is a way to fire a method when the device tiles page is displayed. If not I will just wait for ST to fix the slider bug.


(Patrick Stuart [@pstuart]) #4

To my knowledge, there isn’t any UI hooks to wire up to when something is displayed or loaded in the UI.

However, you can easily add a refresh button to do this.


(Ron) #5

Thanks, I was thinking of adding action to displayed value tile to update the slider but I was hoping to fix the issue in a seamless manner. I think ST will fix this one since they just broke it :slight_smile: