I would like to have a template with the number of lamps switched on.
I already have the Group:Contact item:
Group:Switch:OR(ON,OFF) Lamps “Lamps [(%d)]”
How Can include in a template?
If I use the ItemValue(‘Lamps’) just show ON or OFF.
I copied and pasted this code into my template widget and change the name of the items, but it seems this code doesn’t work ! My template is totally black!
Any help?
<p>Value of Hue_Bureau: {{itemValue('Hue_Bureau')}}</p>
<div ng-if="itemValue('Hue_Bureau').split(',')[2]!='0'">
<button class="btn btn-lg" style="background: red; color: white"
ng-click="sendCmd('Hue_Bureau_Toggle', 'OFF')">
It's on! Switch off
</button>
</div>
<div ng-if="itemValue('Hue_Bureau').split(',')[2]=='0'">
<button class="btn btn-lg" style="background: green; color: black"
ng-click="sendCmd('Hue_Bureau_Toggle', 'ON')">
It's off! Switch on
</button>
</div>
I have shared the widget I made; It is available here. I actually have done some updates since then, making the slider work better, etc. I am still working on some formatting stuff, but I should have a ‘final’ widget done soon. When I get everything working I will update that thread again with a more final version.
Is there any option to use a autoscale?
Means: I have multiple cameras with different resolutions and I would like to scale them down to stay in the frame (e.g. autoscale height) ??
Any suggestion is greatly appreciated.
There is a small problem for the dropdown (in this case) or any other elements like div if they extend outside the parent template widget.
These elements will cover (lay above) early defined widgets, but under widgets defined later.
I had this same problem @Foxejoe. Hopefully someone will add a more correct way of doing this, but I found the following worked.
If you do a subtraction operation, it treats the value as a number. If you just do an addition, it treats it like a string. So what I did was:
{{itemValue('myItem')-1+2}}
instead of just doing
{{itemValue('myItem')+1}}
When I subtracted 1, then added 2, the value was incremented by 1; If I just added 1, I got what you did, a string with a 1 appended. I know this is a complete hack, but it did work for me.