Hi All,
Firstly, thanks Patrick for the matrix/pride themes and your and others contributions to the forum. I’d get nowhere if not standing on the shoulders of others.
I’m having some interesting issues with this on IOS (12/12.2 on iPad) using Safari PWA from home screen.
I’ve modified the code to display temps using a smaller font for the decimal component as others have done above (using the main/decimal/sub class). When I do, updates/refresh of the temperature stops working properly. This ONLY occurs on IOS. chrome on OSX for example, works perfectly. Symptoms are the temp fails to update sometimes, and other times, the decimal component appears “overwritten”, like there are multiple digits being drawn on top of one another. It’s most prevalent when the temperature is an integer (ie, more likely to be seen when the openhab number item is updated to 26 and displayed as 26.0, then updated to say 26.1, but this may be a red herring as it does occur on any update. Sometimes it appears the number just doesn’t get updated at all when the item is updated. I’ve tried various ways of splitting the temp but none seem to fix it. The trigger appears to be splitting it in the first place and using the decimal class. As soon as I revert to a single number it all works.
Here are some examples of code that causes the problem:
<div class="main">{{(itemValue('Office_Motion_Temp') | number:1).split('.')[0]}}</div>
<div class="decimals">.{{(itemValue('Office_Motion_Temp') | number:1).split('.')[1]}}</div>
<div class="sub">°C</div>
and this doesn’t work either:
<div class="main">{{('%.1f' | sprintf:itemValue('Office_Motion_Temp')).split('.')[0]}}</div>
<div class="decimals">.{{('%.1f' | sprintf:itemValue('Office_Motion_Temp')).split('.')[1]}}</div>
<div class="sub">°C</div>
nor this:
<div class="main">{{(('%.1f' | sprintf:itemValue('Z_Garage_Temp')) | number:1).split('.')[0].substring(2,0)}}</div>
<div class="decimals">.{{(('%.1f' | sprintf:itemValue('Z_Garage_Temp')) | number:1).split('.')[1].substring(0,1)}}</div>
<div class="sub">°C</div>
but this is fine:
<div class="main">{{itemValue('Office_Motion_Temp') | number:1}}</div>
<div class="sub">°C</div>
Which leads to me conclude either I am missing something (yes, I am fairly new to all this css/angular stuff), or there is a bug somewhere.
The other problem I have is the refresh button on the top right causes the temperature items to refresh to the value items contained when first launched. This occurs no matter what (not related to above). The only way to fix this is clear safari browser history. Makes the refresh button useless on IOS in fullscreen. Again, works fine in chrome on a mac.
I’m not sure if these problems are actually bugs in hapbanel, IOS safari, or in my own implementation.
Any pointers would be appreciated as it sounds like some of you, including Patrick are using this code on IOS, presumably without hiccups?