Sonos volume increase/decrease rule? [SOLVED]

I need a rule which can increase or decrease the volume of a Sonos device when a button is pressed.
I have tried everything that i can think off, but nothing works

Any help?

Can you be a little more specific about what you want to do and what you’ve tried? Do you want to set a specific volume when a UI switch widget is ON and another volume when it’s OFF? Or do you want incrementally increase/decrease volume based on some type of UI widget change? Or something else?

I’ll try to explain.
What i want is a rule that can get the current volume from the Sonos Device (Possibly from item “Number sonos_bad_volume “volume [%s]” {sonos=”[bad:volume]"}") and then incrementally increase/decrease the volume when an item recives a command/change.

Could you please post your efforts so far? Perhaps it’s getting a bit clearer, what you’re trying to do.

I think that i figured it out.

rule "Sonos volume op/ned bad"
        Item sonos_bad_volume_op received command ON
	var Number V = sonos_bad_volume.state as DecimalType
	var Number H = V + 1
	if (H>65) H = 65
	postUpdate(sonos_bad_volume_v, H)
	sendCommand(sonos_bad_volume, H)

My items:
Dimmer sonos_bad_volume "volume [%s]" {sonos="[bad:volume]"}
Switch sonos_bad_volume_op "Volume op"

1 Like