rule "VolumeUpDown"
when Item LG_TV0_VolDummy received command
then
//LG_TV0_Toast.sendCommand(receivedCommand.toString)
switch receivedCommand{
case 0: LG_TV0_VolumeDown.sendCommand(ON)
case 1: LG_TV0_VolumeUp.sendCommand(ON)
}
var vol = 100*LG_TV0_Volume.state as DecimalType
postUpdate(LG_TV0_VolLevelDummy, vol)
LG_TV0_Toast.sendCommand(vol.toString)//LG_TV0_Volume.state.toString)
end
and a Sitemap with this entry:
Text item=LG_TV0_VolLevelDummy label="Vol [%.0f]"
I can confirm that the vol variable updates but it’s not being updated in the sitemap unless I physically refresh the browser.
I just tested this and it was properly refreshing the UI with the new value. I see you’ve edited your rule… maybe take it a bit further:
rule "VolumeUpDown"
when
Item LG_TV0_VolDummy received command
then
//LG_TV0_Toast.sendCommand(receivedCommand.toString)
switch receivedCommand{
case 0: LG_TV0_VolumeDown.sendCommand(ON)
case 1: LG_TV0_VolumeUp.sendCommand(ON)
}
val vol = 100*(LG_TV0_Volume.state as DecimalType)
LG_TV0_VolLevelDummy.postUpdate(vol)
LG_TV0_Toast.sendCommand(vol)//LG_TV0_Volume.state.toString)
end
postUpdate requires the arguments to be strings, so you could also try postUpdate("LG_TV0_VolLevelDummy",vol.toString). I’m surprised your rule actually worked at all, but you said the item was updating. Did you notice any errors in the log? The postUpdate method is a little more forgiving. Here’s a good thread with more info: