Exec command help

things file

 Thing exec:command:playsound [
            command="play /etc/openhab2/sounds/doorbell.mp3",
            interval=0,
            autorun=true]

items file

Switch TestButton1  "Test button"
Switch SwitchPlaySound "Play the text message sound" {channel="exec:command:playsound:run"}
String PlaySound_Args {channel="exec:command:playsound:input"}
String PlaySound_out {channel="exec:command:playsound:output"}

rules file

when
	Item TestButton1 changed
then
	logInfo("Sound rule", "rule is running")
	setMasterVolume(new PercentType(80))
	//playSound("doorbell.mp3")
	  //PlaySound_Args.sendCommand("/etc/openhab2/sounds/doorbell.mp3")
	  //while(SwitchPlaySound.state != OFF){
         //Thread::sleep(500)
      //}
      SwitchPlaySound.sendCommand(ON)
      
      // Logging of command line result
      logInfo("PlaySound output", "Result:" + PlaySound_out.state )
	//SwitchPlaySound.sendCommand(ON)

end

result

19:18:10.239 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'TestButton1' received command ON
19:18:10.240 [INFO ] [pse.smarthome.model.script.Sound rule] - rule is running
19:18:10.256 [INFO ] [smarthome.event.ItemStateChangedEvent] - TestButton1 changed from OFF to ON
19:18:10.391 [INFO ] [arthome.model.script.PlaySound output] - Result:NULL
19:18:10.391 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'SwitchPlaySound' received command ON
19:18:10.392 [INFO ] [arthome.event.ItemStatePredictedEvent] - SwitchPlaySound predicted to become NULL

and obviously no sound plays
the sound plays on the command line
openhab owns file belongs to audio group file is 777 permissions

What’s in you openhab.log? events.log is only useful to see the state changes if you’re items. Errors and the output of the exec commend will be in openhab.log.

Bear in mind that doesn’t do what you probably expect.
A command is issued to SwitchPlaySound, but the rule does not stop and wait for it to be actioned before moving on to logging. You’ll most likely log the state before any exec action happens.