Update state of channel without updating device (Amazon Echo Control volume)

I opted for the simpe approach of setting the volume when the speak command is issued, with a rule that is triggered by the speak command. The script is much simpler because it does not need a timer, and I assume the risk of interference is lower, simply because it is unlikely that somebody is changing volume just at the same time a voice announcement is played.

New devices just have to be added to the rule and need to comply to the naming convention for the points, otherwise I can just use the speak command anywhere in my other scripts and rules, without having to care about this issue. This will also make it easy to remove the workaround in case the issue gets fixed in a future release.

Here is the rule and script:

/*
 * For Echo Control things/items for Sonos devices, the volume does not get
 * properly updated when the volume is changed via the Sonos app, on the device
 * or any other means.
 * This is an issue when playing a voice command, because after that the volume
 * of the music played gets set to the volume of the Echo Control thing.
 * This rule therefore aligns the Echo Control volume with the Sonos
 * before a voice command is issued, and also set the volume for the voice command.
 */
var nameSeparator = "_";
var sonosVolumeNamePrefix = "Sonos_";
var sonosVolumeNameSuffix = "_Volume";
var echoVolumeNamePrefix = "Echo_Control_Sonos_";
var echoVolumeNameSuffix = "_Volume";
var echoSpeakVolumeNamePrefix = "Echo_Control_Sonos_";
var echoSpeakVolumeNameSuffix = "_Speak_Volume";

// Parse the name and get items as per the naming convention
var speakName = event.itemName;
var room = speakName.split( nameSeparator )[3];
var sonosVolume = items.getItem( sonosVolumeNamePrefix + room + sonosVolumeNameSuffix );
var echoVolume = items.getItem( echoVolumeNamePrefix + room + echoVolumeNameSuffix );
var echoSpeakVolume = items.getItem( echoSpeakVolumeNamePrefix + room + echoSpeakVolumeNameSuffix );

var logMsg = "Echo Volume: '" + sonosVolume.name + "'=" + sonosVolume.state + ", '" + echoVolume.name + "'=" + echoVolume.state + ", '" + echoSpeakVolume.name + "'=" + echoSpeakVolume.state;

// Set the volumes
if( echoVolume.state != sonosVolume.state )
  {
    logMsg += ", setting Echo volume to " + sonosVolume.state;

    echoVolume.sendCommand( sonosVolume.state );
  }

if( echoSpeakVolume.state != sonosVolume.state )
  {
    logMsg += ", setting Echo speak volume to " + sonosVolume.state;

    echoSpeakVolume.sendCommand( sonosVolume.state );
  }

console.debug( logMsg );