Convert Homematic filling state percent to knx Datpoint 5.005

  • Platform information: openhab 2.5.3

Hi there,

i need to convert the output of a homematic filling sensor witch is in percent to an knx Group with datapoint 5.005 and can’t bring it up. The simple rule always is going to write the percent to the knx object which is going to ignore it, because expecting a simple decimal instead - any Ideas?

The items are definde in Paper UI an each one for itself working fine. Here is the rule:
Latest change tried to get rid of the % was to multiplie with hundred but this changes to something like xx.x - Datapont 5.005 in KNX expects an integer between 0 and 100 in my case

rule “Füllstand Zisterne”
when
Item HM_Zisterne_1_FillingLevel changed
then
KNX_Zisterne_Fuellstand_1680.sendCommand((HM_Zisterne_1_FillingLevel.state as Number) * 100)
end

Any Ideas - Thanks so far Michael

Here’s a short rule example for rounding a number:

rule “Round Temperature Livingroom Sensor”
when
Item HT_Temperature_LR received update
then
if (HT_Temperature_LR.state != NULL){
val roundedNumber = (Math::round((HT_Temperature_LR.state as DecimalType).floatValue()* 10)).floatValue() /10
sendCommand(HT_Temperature_LR_rounded,roundedNumber)
}
end