Hi,
it bothered me for years already that carefully adjusted volume differences between Sonos speakers in a group are only retained if I use the Sonos controller app. In this case, the group volume can be changed and the initially adjusted difference between speaker volumes of the group stays the same. However, as soon as somebody changes the volume directly on the buttons of a speaker (as my family tends to do ), only that speaker changes its volume and everything is mis-adjusted again. (I filed two requests with Sonos on making speaker changes optionally apply to the whole group, but seemingly this wasnāt considered important so farā¦)
I found that I could use OpenHAB to get better control about that, and it works so far most of the time with two rules that observe changes on the zone members and then actively set the desired delta for the others. I thought that I took measures against endless loops by checking against the actual values of the speakers and not initiating another change if not required, however sometimes the whole system gets into an oscillation state where the volume is going up and down due to OpenHAB rules. The only way to get this stopped is restarting the Raspberry then. Changing the scripts on the fly is also no longer considered thenā¦
Has anyone a clue under what conditions this setup is going crazy, and might have a solution? I am honestly an OpenHAB newbie for now and maybe missed something crucial for such a scenarioā¦
These are my two rules:
var Number volumeDelta = 5
rule "Sonos volume delta kitchen"
when
Item VolumeSonosKitchen changed
then
var Number volKitchen = VolumeSonosKitchen.state as DecimalType
var Number volLivingroom = VolumeSonosLivingroom.state as DecimalType
var Number newVolLivingroom = volKitchen + volumeDelta
if (newVolLivingroom > 100) newVolLivingroom = 100
if (newVolLivingroom != volLivingroom) {
sendCommand(VolumeSonosLivingroom, newVolLivingroom)
}
end
rule "Sonos volume delta living room"
when
Item VolumeSonosLivingroom changed
then
var Number volKitchen = VolumeSonosKitchen.state as DecimalType
var Number volLivingroom = VolumeSonosLivingroom.state as DecimalType
var Number newVolKitchen = volLivingroom - volumeDelta
if (newVolKitchen < 0) newVolKitchen = 0
if (newVolKitchen != volKitchen) {
sendCommand(VolumeSonosKitchen, newVolKitchen)
}
end