我正在编写一个程序,可以布防/撤防我的家庭,一切都正常执行,但我在执行结束时继续收到以下错误消息。
groovy.lang.MissingMethodException:没有方法签名:groovy.util.slurpersupport.NodeChildren.isArray()适用于参数类型:()值:[] 可能的解决方案:isEmpty(),every()
我的代码是
def disarm() {
log.debug "During disarming. SessionID: ${state.token}"
if(state.token) {
def paramsDisarm = [
uri: "URL",
body: [SessionID: state.token, LocationID: location, DeviceID: deviceID, UserCode: usercode]
]
httpPost(paramsDisarm) { responseDisarm ->
log.debug "Code is ${responseDisarm.data.ResultCode}"
log.debug "Message: ${responseDisarm.data.ResultData}"
sendPush("Home is now Disarmed")
}
log.debug "Is this getting executed?"
logout()
}
else
{
log.debug "Smart Things is not logged in. Need to login"
login()
disarm()
}
}
我的退出电话是
def logout() {
log.debug "During logout - ${state.token}"
def paramsLogout = [
uri: "URL",
body: [SessionID: state.token]
]
httpPost(paramsLogout) { responseLogout ->
log.debug "Smart Things has successfully logged out"
}
}
查看控制台日志,我看到所有内容都执行得很好。这是控制台日志。
8:58:41 PM: error groovy.lang.MissingMethodException: No signature of method: groovy.util.slurpersupport.NodeChildren.isArray() is applicable for argument types: () values: []
Possible solutions: isEmpty(), every()
8:58:41 PM: debug Smart Things has successfully logged out
8:58:40 PM: debug During logout - 65103122-1915-49C2-A021-015871AD7C93
8:58:40 PM: debug Is this getting executed?
8:58:40 PM: debug Message: Session Initiated. Poll for command state update
8:58:40 PM: debug Code is 4500
8:58:36 PM: debug During disarming. 65103122-1915-49C2-A021-015871AD7C93
8:58:36 PM: debug Smart Things has logged In. SessionID: '65103122-1915-49C2-A021-015871AD7C93'
8:58:32 PM: debug Smart Things is not logged in. Need to login
8:58:32 PM: debug During disarming. SessionID: null
8:58:32 PM: debug Mode is set to Home, Performing Disarm
我的代码运行良好并且应该做到了,但错误消息仍然让我感到困扰。