Hello guys!
I have a netatmo weather-station und now want to use the co2-item of oh2 to change the color (green, orange, red) of the indoor-temp value within habpanel.
I already tried varios approaches, but evrytime 3 indoor-temps are displayed instead of 1…
Here you can see the html-part:
<tr>
<td id="weather-temp" align="CENTER"><font font size="30"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_aussen_temp')}}</b></font></td>
<td id="weather-temp-sign">°C</td>
<td rowspan="2"><img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition0').replace(' ','-') | lowercase }}.png"/></td>
<div ng-if="itemValue('netatmo_phy_innen_co2')<='600'">
<td id="weather-temp" align="RIGHT"><font font size="30" color="green"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<div ng-if="itemValue('netatmo_phy_innen_co2')>'600'&&<='800'">
<td id="weather-temp" align="RIGHT"><font font size="30" color="#FE9A2E"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<div ng-if="itemValue('netatmo_phy_innen_co2')>'800'">
<td id="weather-temp" align="RIGHT"><font font size="30" color="red"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<td id="weather-temp-sign">°C</td>
</tr>
The result is at the bottom of this msg.
At the moment the co2-value is at 506.0 ppm.
This is displayed by following code:
<td class="main-carb-text">
{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_co2')}}
</td>
Maybe someone can help to make ng-if working?
THX!
Foxejoe
(Lorenzo Giordano)
April 12, 2017, 5:27pm
2
if the item is a number just remove ’ from the value as below example
i.e. ng-if=“itemValue(‘netatmo_phy_innen_co2’)>600”
That’s work for me
Regards
Lorenzo
Hi Lorenzo and thx 4 your help.
Yes, in OH2 its a number-item:
Number netatmo_phy_innen_co2 "CO2" <carbondioxide> { channel = "netatmo:NAMain:netatmoBridge:70ee5xxxxxxx:Co2" }
Removing the ’ didnt have any effect…my template looks exactly the same as before:
<tr>
<td id="weather-temp" align="CENTER"><font font size="30"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_aussen_temp')}}</b></font></td>
<td id="weather-temp-sign">°C</td>
<td rowspan="2"><img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition0').replace(' ','-') | lowercase }}.png"/></td>
<div ng-if="itemValue('netatmo_phy_innen_co2')<=600">
<td id="weather-temp" align="RIGHT"><font font size="30" color="green"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<div ng-if="itemValue('netatmo_phy_innen_co2')>600&&<=800">
<td id="weather-temp" align="RIGHT"><font font size="30" color="#FE9A2E"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<div ng-if="itemValue('netatmo_phy_innen_co2')>800">
<td id="weather-temp" align="RIGHT"><font font size="30" color="red"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
</div>
<td id="weather-temp-sign">°C</td>
</tr>
The solution:
<td ng-if="itemValue('netatmo_phy_innen_co2') < 900" id="weather-temp" align="RIGHT"><font font size="30" color="green"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
<td ng-if="itemValue('netatmo_phy_innen_co2')>=900 && itemValue('netatmo_phy_innen_co2')<1400"id="weather-temp" align="RIGHT"><font font size="30" color="#FE9A2E"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
<td ng-if="itemValue('netatmo_phy_innen_co2')>=1400" id="weather-temp" align="RIGHT"><font font size="30" color="red"><b>{{'%.1f' | sprintf:itemValue('netatmo_phy_innen_temp')}}</b></font></td>
thats it…happy eastern!