Hi experts,
I´m struggling with a rule regarding rounded values. I want to calculate a dynamic runtime for my pool pump with my rule:
if (Poolautomatik.state == ON)
{
var temperature = OneCallAPIweatherandforecast_ForecastToday_Maxtemperature.state as Number
var stopPumpTime = if(OneCallAPIweatherandforecast_ForecastToday_Maxtemperature.state > 27 | "°C") now.plusHours(2)
else now.plusHours(Math::round(0.07 * temperature))
My problem is, that the result for the timer (stopPumpTime) is a rounded value and can be 1 hour, 2 hours or 3 hours.
I want my rule to be more precise and calculate absolute values with 1 decimals. So e.g. 1,5 hours runtime.
How to achieve this? I know that the math::rounded function is responsible for the rounded values…but how to replace this?
Thanks and best regards,
Mario