Thats working, thank you!
Just FYI: I’m working on weather widget in my spare time Weather forecast is also on my roadmap. Let me know in the issue’s comments section what features you’d like to see there.
Cheers
This is probably a silly question, but angular is totally new to me. Is there a way of using ng-repeat with the results of an itemValue? ie I have a string item that I want to populate with a JSON object that I can then use to build a table of data in the template widget.
I have tried the following but it didn’t work, I also tried with itemValue directly in the ng-repeat line but that didn’t work either.
<div ng-init="json=itemValue('house_temp_dashboard')"> <div class="row" ng-repeat="i in json"> <div class="col-xs-8 text-right">{{i.temperature}}</div> </div>
You should use separate items, put them in an openHAB group, then go:
<div class="row" ng-repeat="item in itemsInGroup('Group')">
<div class="col-xs-8 text-right">{{itemValue(item.name)}}</div>
</div>
Or use a comma-separated value and use split() but the above is cleaner.
Thanks ysc, I generally would use separate items. But in this particular case I really just want to display some additional information on my Dashboards around the house (recently downloaded items) and I don’t know how long the list is on any given day, it could be 1 item or 10 so my thinking was to just push it to a string item as JSON and then use the template widget to format it.
Looks like $eval
could work.
Try:
<div class="row" ng-repeat="i in $eval(json)">
<div class="col-xs-8 text-right">{{i}}</div>
</div>
Oh that’s great! I can use it with my BloomSky JSON API. Got to give it a try!
Great Stuff !!! do you have a snipset for a chart ?
Thanks in advance!
Why would you want it in a template and not in its own widget?
i would like to have the possibility to style it my way … fixed y-axis my be you may provide a function to retrieve the data series and an user may have the possibility to show different series with different layouts, temeratures, power etc…
i know you can set an item value (that isn’t bound to external data feed) with a slider because i tried it, can someone please write us a template with text field that edit items (numbers and strings)and solve the dilemma of Basic & Classic UI ?
i just suck at web stuff, i don’t know what kind of code i can write in a template / widget to start with …
iḿ still thinking about top have my own chart widget, or at least to play around with.
can you give me a hint as startpoint ? what can be used in habpanel from angular framework ? is it possible to include addional functions in an widget ?
i tried:
it does not work, where do i have to place the files ?thanks in advcance
Sorry, i’m not using this code anymore. Changed to the weather template from this forum!
Alright, Thanks - I will give that a try as well
Is there a way to add a slider inside a template widget? I looked at the Angular UI Bootstrap stuff, and the examples here, but I don’t see how to do that. (I am just starting to learn all of this, so if I missed something obvious, I appologize )
Update:
After searching for quite a while and making no progress, I posted the above question. Within 5 minutes, I found rzslider, and had a slider on my page. This got me almost the whole way to what I want, but I am now trying to figure out how to tie the slider to a variable. For example, I have the following code:
<div ng-init="slider = {
minValue: {{'%.0f' | sprintf:itemValue('low_setting')}},
maxValue: {{'%.0f' | sprintf:itemValue('high_setting')}},
options: {
floor: 0,
ceil: 100,
stem: 1
}
};"></div>
<rzslider rz-slider-model="slider.minValue" rz-slider-high="slider.maxValue" rz-slider-options="slider.options"></rzslider>
This creates a slider, but with NaN for both the low and high values. (If I put in just numbers in ng-init, it works as expected)
So my question is now, how can I tie an item value, that can be read and set, to a slider so that I can display the slider, and then send the update to the item when the slider moves? I can do this with a slider widget, so I imagine it is possible, but I am at a complete loss as to how to do it.
What is the weather binding that give you icon ?
Slider -> Variable
In my case works next code:
<div ng-init="slider = {
value: 19,
options: {
floor: 18,
ceil: 25,
step: 1
}
};"></div>
<rzslider
rz-slider-model="slider.value"
rz-slider-options="slider.options"
ng-click="sendCmd('Heating_Comfort', slider.value)">
</rzslider>
But variable changing have no affect to slider.
Thanks. The ng-click binding is probably what I want, but I still can’t set or update the value based on a variable. I was working on a template based widget to control my ecobee thermostat. What I have is shown below, and it displays the mode (heat, cool. auto, etc), the humidity, current temperature, settings, remote sensor, etc.
I was planning on doing a slider that would let me change the temperature controls, but it looks like it will take me a while to get there. Apparently, to change the values I have to set up a sitemap, which I haven’t done. (There isn’t a simple item binding that lets me change it.) I just started using openhab about a week ago, so I’m still trying to figure out how to set all of this up, and most of the instructions are based on openhab, while I am using openhab2. (Things still work, but it’s taking me a while to understand where to put files, etc) I think I’m going to try to start with just doing the sitemap stuff, and then see if I can bind a simple slider widget to that, and once all of that is done, maybe circle back around to this.
Anyway, below is what I have so far. Thanks for the response, and a big thank you to all the information here on this site, it has been really helpful in getting most of my home automation stuff set up and controlled.
Could you please share your template details for ecobee ?