Number:Energy in rules

I strongly recommend setting the unit metadata on these Items to exactly what units you want rather than relying on the system default. There are fewer surprises that way.

Well, yes. You’ve added a value without units to a value with units and explicitly stated you want a Number as the result.

In Rules DSL you are almost always best off if you never force the type of a variable unless you absolutely have to. Half the time it will simply ignore it and half the time it will change stuff behind the scenes to make it work.

When working with units, all the operands should define units.

logInfo("Delivered", "state contains " + mqtt_dsmr_electricityDeliveredDay.state.toString)
var electricityDeliveredDay = (mqtt_dsmr_electricityDeliveredDay.state as QuantityType<Energy>)
logInfo("Delivered", "QuantityType   " + electricityDeliveredDay.toString)
var test123 = electricityDeliveredDay + 1000 | kWh
logInfo("Delivered", "SUM            " + test123.toString)