MikeDL
(Michael)
January 29, 2016, 1:42am
1
How come the if is true in the statement for a blank variable ‘msg’? I would like it not enter the if, if i get a reply of ping, empty and null. Here is the dubug output.
7:42:15 PM: debug Parse got ‘’
def parse(String description) {
def msg = zigbee.parse(description)?.text
log.debug “Parse got ${msg}”
if (msg != ‘ping’ && msg != “” && msg != null){
MikeDL
(Michael)
January 29, 2016, 2:07am
3
Didn’t work and yes I think I want AND. I want everything but ping and nothing.
Even groovier is:
if (["", "ping"].contains(msg)) {
// contains
} else {
// does not contain
}
And the above works fine too (you can test it the groovy web console or from your favorite groovyc http://groovyconsole.appspot.com/ )
1 Like
MikeDL
(Michael)
January 29, 2016, 3:12am
6
That worked Josh. Thanks. Anybody know why my code didn’t work?