I’d appreciate any help that I can get with an error in the Simulator. The error occurs when I add the following line in the preferences section in my SA skeleton. This is my first app (and groovy code) so bear with me if the problem is obvious.
input “motion1”,“capability.motion”, title:“Motion one”
In the emulator, the input for “Motion One” appears but I get the following error when I click on the install button.
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]
I can’t say for sure but the problem may have started when I changed the value of the first parameter from “tmotion1” to “motion1”.
Here’s the full source code:
/**
- LightArt
- Copyright 2017 Massis Isagholian
- Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
- in compliance with the License. You may obtain a copy of the License at:
-
http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
- on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
- for the specific language governing permissions and limitations under the License.
*/
definition(
name: “LightArt”,
namespace: “com.sagestream.signart2”,
author: “Massis Isagholian”,
description: “none”,
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(“Motion Sensors”) {
input “motion1”,“capability.motion”, title:“Motion one”
}
section("Outlets") {
input "outlet1","capability.switch", title:"Outlet one"
input "outlet2","capability.switch", title:"Outlet two"
input "outlet3","capability.switch", title:"Outlet three"
input "outlet4","capability.switch", title:"Outlet four"
input "outlet5","capability.switch", title:"Outlet five"
}
}
def installed() {
log.debug “Installed with settings: ${settings}”
initialize()
}
def updated() {
log.debug “Updated with settings: ${settings}”
unsubscribe()
initialize()
}
def initialize() {
// subscribe(motion1, “motion.active”, motion1ActiveHandler)
// TODO: subscribe to attributes, devices, locations, etc.
}
// TODO: implement event handlers
def motion1ActiveHandler(evt) {
log.debug “Motion1 event: ${evt.value}”
}