I created a widget for displaying weather information like many others.
Now, I integrated the Astro-Binding and like to use it besides other thing, to display different icons for day and night.
Using Openweather and the corresponding Condition_ID, I created this piece:
<div class="row">
<div id="weather-table">
<div class="col-md-3">
<div ng-if="itemValue('Condition_ID') >=200 && itemValue('Condition_ID') <=240">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + '200' + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') >=300 && itemValue('Condition_ID') <=330">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + '300' + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') >=500 && itemValue('Condition_ID') <=540">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + '500' + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') >=600 && itemValue('Condition_ID') <=630">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + '600' + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') >=700 && itemValue('Condition_ID') <=790">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + '700' + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') == 800">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + itemValue('Condition_ID') + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') == 801">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + itemValue('Condition_ID') + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') == 802">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + itemValue('Condition_ID') + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') == 803">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + itemValue('Condition_ID') + '.svg#Layer_1'}}"> </use> </svg> </div>
<div ng-if="itemValue('Condition_ID') == 804">
<svg id="weather-icon" ><use xlink:href="{{'/static/icons/weather/' + itemValue('Condition_ID') + '.svg#Layer_1'}}"> </use> </svg> </div>
</div>
<div class="col-md-2">
<div class="text-left"><span id="weather-temp">{{'%.1f' | sprintf:itemValue('Temperature')}}</span><span id="weather-temp-sign">°C</span></div>
</div>
</div>
</div>
With the Astro Binding, I have the sunset and sunrise times.
Is there a possibility to use the ‘now’ information and compare it with the sunset/sunrise time directly in HABPanel, or do I need to have a special rule created and setting some flag?
Example for my idea:
<div ng-if="now.isAfter(Sunset_time)">
[put code for night icons here]
</div>