Need to multiply number from item

I think I need to multiply this item
Number barometer_inHg_acurite “Pressure inHg [Pressure inHg %.2f]” (acurite) {mqtt="<[mosquitto:weather/weewx/barometer_inHg:state:default::]" }

but can not seem to get this line right

barometer_inHg_acurite = (barometer_inHg_acurite)*100

my display needs a 4 digit number like "2950"
and I get this from the sensor 29.50000000000


rule “Send Presure to wall display"
Time cron “45 0/10 * * * ?” // on minutes
// var Proxy_barometer_inHg_acurite = (barometer_inHg_acurite.state).intValue()*100
// logInfo(” Wall_guage_Proxy “,” Proxy before mult" + Proxy_barometer_inHg_acurite)
// Proxy_Wall_guage_Pressure = (Proxy_Wall_guage_Pressure)*100

// barometer_inHg_acurite = (barometer_inHg_acurite)*100

var int Proxy_Wall_guage_Pressure = (barometer_inHg_acurite.state as DecimalType).intValue()*100
         logInfo("  Wall_guage_Proxy "," Proxy after convert" + Proxy_Wall_guage_Pressure)

sendCommand(Wall_guage_Pressure, Proxy_Wall_guage_Pressure)

         logInfo("  Wall_guage_Pres "," Org Presure " + barometer_inHg_acurite.state)
         logInfo("  Wall_guage_Proxy "," sending wall _Proxy " + Proxy_Wall_guage_Pressure)

// Wall_guage_Pressure_Proxy = (new NumberItem(barometer_inHg_acurite.state))
// Wall_guage_Pressure.sendCommand(new DecimalType(Proxy_Wall_guage_Pressure))
// logInfo(" Wall_guage_Proxy “,” sending wall _Proxy " + Proxy_Wall_guage_Pressure.state)

Maybe you have to set the var as long, not int

For logInfo maybe better use
logInfo(" Wall_guage_Proxy "," Proxy after convert {}", Proxy_Wall_guage_Pressure)

logInfo("  Wall_guage_Proxy "," Proxy after convert " + Proxy_Wall_guage_Pressure.toString)

Could your item instead be this:

Number barometer_inHg_acurite "Pressure inHg [%.0f]" (acurite) {mqtt="<[mosquitto:weather/weewx/barometer_inHg:state:JS(mult100.js)]" }


(function(inHg) {
  return inHg * 100;

No need for proxy items or rules.

1 Like

It’s a pity that the transformation service isn’t documented so clear. All examples are for http, so no one can guess how to use it at other bindings.

True—if you see a spot in the wiki where this could be improved, many would surely benefit!

That worked good, thank you. Like Udo_Hartmann said I did not think of using a transform I was stuck on using a rule