[SOLVED] Custom widget switch (not working)

Hi!
within my rollershutter custom widget i’d like to integrate a switch that toggles automode.
this is what i have (and it doesn’t work):

<div ng-if="itemValue('config.auto_item')=='ON'">
     <button ng-click="sendCmd(config.auto_item, 'OFF')">
      <i class="glyphicon glyphicon-off"></i>
     <widget-icon iconset="'eclipse-smarthome-classic'" icon="'blinds'" size="40" state="itemValue(config.blind_item)" />
    </button>
</div>

<div ng-if="itemValue('config.auto_item') !='ON'">
     <button ng-click="sendCmd(config.auto_item, 'ON')">
      <i class="glyphicon glyphicon-off"></i>
    </button> 
</div>

if i press the button within my widget it always sends the “ON” command, no matter the state of my item.

i “lost” 2 hours searching for a working custom switch but i wasn’t able to find anything that helped :frowning:

help would be appreciated! :blush:

Without more information, I would assume that you need to remove the 's from ng-if statements.
But im just guessing here.

so change

ng-if="itemValue('config.auto_item') !='ON'" 

to

 ng-if="itemValue(config.auto_item) !='ON'"
2 Likes

oh, that was easy…
thank you very much!

Great to hear