first of all I would like to gratulate allof you for building such a great project like OpenHAB !!
We have started last week and installed among others the OpenWeather (“OneCall”) and the Mail binding. Both do work properly, so we get data like forecasted temperature etc… and can display it in the UI (sorry to be proud )
However, when writing the variables in the email text using a rule: "<br><b>Temperatur morgens</b> OneCallAPIweatherandforecast_ForecastToday_Morningtemperature
we expect to get somnething like -1,0°C, but it writes **Temperatur morgens** OneCallAPIweatherandforecast_ForecastToday_Morningtemperature (Type=NumberItem, State=-1.02 °C, Label=Morning Temperature, Category=Temperature, Tags=[Point], Groups=[Vorhersage_Heute])
I imagine we have to display only the State and format the variable using something like [%.0f°] however don’t know where…
Thanks for any clue, for sure it’s easy!
thanks to you in advance!!
Platform information:
Hardware: Raspberry
OS: _Raspbian / Ubuntu
Java Runtime Environment: which java platform is used and what version
openHAB version: 3
Issue of the topic: please be detailed explaining your issue
Please post configurations (if applicable):
Items configuration related to the issue
Sitemap configuration related to the issue
Rules code related to the issue
Services configuration related to the issue
If logs where generated please post these here using code fences:
We all know this feeling - no shame feeling proud here, even if it’s only the beginning
Just add a .state.toString after your item-name and you should be good to go. Currently it outputs all the available data of your item as you’ve not defined what exactly you want to see.
You are on the right track with the string formatting. As long as you define your items in a textual file, you would do that in an items file. I cannot guide you with defining items via GUI as I do not use that yet.
For all possible formatting options you may want to look here.
I could finaly come to the same result using the following :
val Datum = OneCallAPIweatherandforecast_ForecastToday_Timestamp.state.toString
val Jahr = Datum.substring(0,4)
val Monat = Datum.substring(5,7)
val Tag = Datum.substring(8,10)
val email_Text = "<u><b>Vorhersage für heute</b></u> "
+ Tag + "." + Monat + "." + Jahr