Hi folks,
I’ve two number items, Charge and Capacity.
I would like to have BatteryLevel (%) = Charge / Capacity
The following rule:
Rule "Roomba Battery Level (%)"
when
Item RooWifi_Roomba871_Charge received update or
Item RooWifi_Roomba871_Capacity received update
then
val DecimalType batterylevel = new DecimalType(((RooWifi_Roomba871_Charge as DecimalType) / (RooWifi_Roomba871_Capacity as DecimalType)) * 100)
RooWifi_Roomba871_BatteryLevel.postUpdate(batterylevel)
end
is generating this ERROR:
2018-06-20 14:11:34.876 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Roomba Battery Level (%)': Could not cast RooWifi_Roomba871_Charge (Type=NumberItem, State=2657, Label=Roomba 871 Charge, Category=null, Groups=[gHouse, gBatteries]) to org.eclipse.smarthome.core.library.types.DecimalType; line 28, column 54, length 39
What I’m missing?
thanks
Andrea