I now it has something to do with the breaking change of 3.4.0 (just upgraded…), but don’t know how to fix it.
The items which are used to do some calculations are
Number:Power mqtt_sofar_pv1Power "PV1 Power" (sofarsolar) ["Status","Energy"] {channel="mqtt:topic:mosquitto2:sofar:pv1Power"}
Number:Power mqtt_sofar_pv2Power "PV2 Power" (sofarsolar) ["Status","Energy"] {channel="mqtt:topic:mosquitto2:sofar:pv2Power"}
and in the rule I always used started with this:
var Number pv1Power = mqtt_sofar_pv1Power.state as DecimalType
var Number pv2Power = mqtt_sofar_pv2Power.state as DecimalType
But this gives the error: Script execution of rule with UID 'xxxxxxx' failed: Could not cast 10 W to org.openhab.core.library.types.DecimalType; line 1, column 23, length 40
loginfo of item: mqtt_sofar_pv1Power (Type=NumberItem, State=10 W, Label=PV1 Power, Category=null, Tags=[Status, Energy], Groups=[sofarsolar])
output of API
{
"link": "https://xxxxxxxxx.com/rest/items/mqtt_sofar_pv1Power",
"state": "0 W",
"stateDescription": {
"step": 1,
"pattern": "%s %unit%",
"readOnly": true,
"options": []
},
"editable": true,
"type": "Number:Power",
"name": "mqtt_sofar_pv1Power",
"label": "PV1 Power",
"tags": [
"Status",
"Energy"
],
"groupNames": [
"sofarsolar"
]
}