Audio.notification & door open warning

Hi All,

I’m sure there a number of apps like this one but in an aid to learn, i’m writing an app that sends an audio message to a selected speaker. (DNLA).

The idea being that the user selects a door, then a speaker, duration & finally a message.

Any help would be greatly appreciated!

Unfortunately when this runs in the simulator an error message is given:

" grails.validation.ValidationException: Validation Error(s) occurred during save():
- Field error in object ‘physicalgraph.device.Device’ on field ‘name’: rejected value [null]; codes

There’s more to it but it’s just repetitive

Here’s my code below:

preferences {
//Request the door to be watched.
section(“Door Chimer”) {
input “doorwatched”,“capability.contactSensor”,required: true, title: “Which Door?”
//Request the Device to be notified.
section(“Notifies What Device?”) {
input (“devicenotified”,“capability.audioNotification”,requried: true, title: “Which Device?”)
//Request the duration for the timer.
section(“After How Long?”) {
input(“duration”,“number”, title: “Duration?”)
//What message would you like to play?
section(“What’s the message?”){
input(“usermessage”,“text”, title: “Message?”)

def installed() {
log.debug “Installed with settings: ${settings}”



def updated() {
log.debug “Updated with settings: ${settings}”



def initialize() {

//Create and event handler for the door opening.
subscribe (doorwatched,, openDetectedHandler)

def openDetectedHandler(evt){
log.debug "openDetectedHandler called: $evt"
runOnce(duration, sendnotice)

def sendnotice(){