An XML template for selecting custom device UI icons within a plugin.
Select the More Information
link to download the template from GitHub.
Within Devices.xml
<Template file="template_icon_selector.xml"/>
Within plugin.py
def set_icon(dev):
icon_name = dev.pluginProps.get('icon', 'SensorOff')
icon = getattr(indigo.kStateImageSel, icon_name)
dev.updateStateImageOnServer(icon)