Hi All,
I am a new user waiting for my first set of hardware to arrive including a few plug-ins, motion detector, and an Osram bulb. In preparation for receiving it, I am trying to write a few basic programs. I have written one that seems to be simple, but I get an error when I run it in the simulator. I have two questions. 1) Does anyone see my problem? (the error message and code is below) 2) Is there a better way to debug code?
Error Message: "grails.validation.ValidationException: Validation Error(s) occurred during save():
- Field error in object ‘physicalgraph.device.Device’ on field ‘name’: rejected value [null]; codes [physicalgraph.device.Device.name.nullable.error.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.error.name,physicalgraph.device.Device.name.nullable.error.java.lang.String,physicalgraph.device.Device.name.nullable.error,device.name.nullable.error.physicalgraph.device.Device.name,device.name.nullable.error.name,device.name.nullable.error.java.lang.String,device.name.nullable.error,physicalgraph.device.Device.name.nullable.physicalgraph.device.Device.name,physicalgraph.device.Device.name.nullable.name,physicalgraph.device.Device.name.nullable.java.lang.String,physicalgraph.device.Device.name.nullable,device.name.nullable.physicalgraph.device.Device.name,device.name.nullable.name,device.name.nullable.java.lang.String,device.name.nullable,nullable.physicalgraph.device.Device.name,nullable.name,nullable.java.lang.String,nullable]; arguments [name,class physicalgraph.device.Device]; default message [{0} cannot be null]"
Code:
definition(
name: “Office Light”,
namespace: “jcdeaton”,
author: “John Deaton”,
description: “Controls my office light”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)
preferences {
section(“Turn on when motion is detected:”) {
input “mymotionsensor”, “capability.motionSensor”, required: true, title: “Where?”
}
section("Turn on this bulb") {
input "mylightbulb", "capability.colorTemperature", required: true, title: "bulb"
}
/*section("At this color temperature") {
input "colortemperature", "number", required: true, title: "color temperature", range: "2700..6500"
}*/
}
def installed() {
log.debug “Installed with settings: ${settings}”
initialize()
}
def updated() {
log.debug “Updated with settings: ${settings}”
unsubscribe()
initialize()
}
def initialize() {
subscribe(mymotionsensor, “motion.active”, motionActiveHandler)
}
def motionActiveHandler(evt) {
mylightbulb.setColorTemperature(2700)
mylightbulb.on()
}