Check if a logic variable is / is not NULL?

How can I check if a variable/tag is / is not NULL/empty with a logic condition card?


Can it be NULL/empty??
When you create a variable you have to fill the default.
When you restart homey that value is set.

In my case a homescript returns ‘’, so the tag is empty (of course I could return something else).

And yes, your answer is the reason for my question :wink:

Null is hard, but setting it to an Empty string (“”) is very easy, because an empty string validates correctly when setting capabilities or tokens.


  • Create a text variable (set it with a space).
  • run a homeyscript with return “” (just 2 double quotes)
  • place the HS token in the variable.

Now you have an Empty text variable which you can use to see if a text-token or whatever is also empty.

As far as i know there is no way to set a capability/token-value to null.

You and @FKey are right.

It is even not possible to return null in a token with homeyscript or use it as a variable value out of the box.

Your advise works fine. And with the new inline homescripit it is not even necessary to use a global variable. Just for fun:



Indeed, the global variable is handy tho, if you check it much: you just reference the existing gloval variable called Empty :wink:
Saves flowcards :wink:

Also, reading Result equals Empty is imho somewhat nicer then Result equals Result.

I agree!

Nice weekend