Hello, sorry but after a week of trying code i have surrended to the sad truth that my coding skill are insufficient to do my idea.
I have a Nest Thermostat that have 5 operation mode (heat, off, cooling ecc)
I would like to have a button list menu with the choices le the one that is in the Spotify Widget of the matrix theme from the user @pmpkk. (classic drop down menu, nothing fancy with icons)
The item i want to use is: Thermostat_Mode
First Try: adapting the code from pmpkk matrix theme: failure
<!--
<div class="widget" ng-init="modes=$eval(itemsGroup('config.Thermostat_Mode'))">
<div ng-repeat="label in modes"></div>
<div class="icon off" ng-click="sendCmd('Thermostat_Mode', 'ON'); modes=$eval(itemsGroup('config.Thermostat_Mode'))"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/squidink.svg#double-arrow"></use></svg></div>
<div class="nameGroup"><div class="name">Modalità termostato:</div></div>
<div class="btn-group" dropdown-append-to-body="true" uib-dropdown >
<button id="single-button" type="button" class="btn btn-primary" uib-dropdown-toggle ng-click="modes=$eval(itemsGroup('config.Thermostat_Mode'))" ng-mouseover="modes=$eval(itemsGroup('config.Thermostat_Mode'))">
{{itemValue('Thermostat_Mode')}} <span class="caret"></span>
</button>
<ul class="mydropdown-menu" uib-dropdown-menu role="menu" style="overflow: auto; max-height:300px; overflow-x:hidden" aria-labelledby="single-button" >
<div ng-repeat="option in itemsGroup(config.Thermostat_Mode)" >
<li role="menuitem"><a ng-click='sendCmd("Thermostat_Mode")'>{{StateOption.value}}</a></li>
</div>
</ul>
</div>
</div>
</div>
-->
Second try: i’ve found a widget from user @marcel_verpaalen (link)
It work if i use it importing the json in habpanel and use it as a “object”. But if i copy the code and replace the variable with the item it doesn’t work.
<div class="section">
<div class="sectionIconContainer"><div class="sectionIcon"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/squidink.svg#wind"></use></svg></div></div>
<div class="title"><div class="name">TEST</div></div>
<div class="btn-group btn-group-justified" btn-checkbox-true ng-repeat="option in itemGroup(config.Thermostat_Mode)">
<label class="btn btn-primary" ng-model="itemValue(config.Thermostat_Mode)" uib-btn-radio="option.value" ng-click="sendCmd(config.Thermostat_Mode, option.value)" ng-repeat="option in getItem(config.Thermostat_Mode).stateDescription.options"> {{option.label}}</label>
</div>
Any clue?