Instance ID of a widget

Post your questions and help other users.

Moderator: Martin

Post Reply
jojjas
Posts: 2
Joined: 31 Jan 2014 09:36

Instance ID of a widget

Post by jojjas » 20 Feb 2014 21:58

Hi,
I looking for a way to re-use one widget but distinguish between each instance of the widgets.
Basically, what I want to do is to control some electrical devices which are connected to my web server.
I would like to place 10-20 widgets on my home screen and each instance should have a different ID when creating the HTTP GET calls:
Widget instance 1: tool.php?device=1&action=on/off
Widget instance 2: tool.php?device=2&action=on/off
... and so on

Is there a smart way of doing this without needing to making n copies of the widget and modify the action for each one of them? I'm not able to figure this out...
Same would apply for the other direction, is there a way to access a specific instance of a widget through setWidgetElementProperty() ? This should be used for setting the current status of each widget instance. By using setWidgetElementProperty() ALL instances of the widget will get updated...

Thanks for a great app!!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Instance ID of a widget

Post by Martin » 21 Feb 2014 18:08

Hi,

There's probably no easy way to do this at the moment. I could add a new feature to define a name when a widget is placed on the home screen, that could be passed to the action/flow when an action is clicked. Let me add this to the todo-list. I will also add a variable that will pass an ID of the clickable action cell to the flow so you could create one widget with 3*3 buttons and dynamically change the behavior of the flow depending on the clicked cell.
Modifying a widget by ID will not be possible since this would require to actually create multiple instances/copies of the same widget which does not happen. There's only one instance of a widget regardless of how many places you add this widget to the home-screen.

Regards,
Martin

Post Reply