more G-Labs products

Author Topic: Change icon dynamically from program code?  (Read 897 times)

August 28, 2015, 02:53:40 PM
Read 897 times

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Can I change the widget icon dynamically from my app/program program code (not in the webpage/javascript)?  Something like this, which doesn't seem to work:
Code: [Select]
if(GarageDoorClosed){
 Program.Parameter("Widget.DisplayIcon").Value = "http://cdn.device-icons.smartthings.com/doors/garage/garage-closed.png";
}esle{
 Program.Parameter("Widget.DisplayIcon").Value = "http://cdn.device-icons.smartthings.com/doors/garage/garage-open.png";
}

August 31, 2015, 02:16:34 PM
Reply #1

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
A time I have made one modification in the widget icon gestion.
If the icon name (Widget.DisplayIcon) contains _off it's replace automatically replace by _on when the widget receives level change to 1. So only you have to put the 2 icons in the same folder and specify the off icon in the parameter