Item.type in HabPanel - Advanced function

Hi All,

Im successfully using the following, to populate a list of items as switches. This works great but if you want to use a Dimmer, which also has an ON/OFF, effectively still a switch, the code fails.

<div class="widget" ng-if="item.type=='Dimmer' && itemValue('OFF'" ng-click="sendCmd(, 'ON')">

if I replace Dimmer, with Switch and change the item type it works.

@ysc any suggestions?


Just a guess here but have you tried a value of 0 instead of OFF. If I’m right dimmer items can accept ON or Off as commands but interpret them as 100 or 0. So 0 might be the State value the RestApi gives you for a switched off dimmer and you have to use that to check.
Best regards Johannes

I havent, but i will. Its not so much the command doesnt work, its the code doesnt even display the item.


EDIT: that doesnt work either. Its almost as if it doesnt understand the item type

Looks like dimmer is not a supported type in Habpanel. But have a look here:


Thanks Johannes! Looks like he’s managed to get something to work using 0/100 like you’d mentioned. Hm