Name 'NULL' cannot be resolved to an item or state

  • Platform information:
    • Hardware: raspberry pi
    • OS: openhabian 2.4
    • Java Runtime Environment: the on in bundle with oh 2.4
    • openHAB version: 2.4
  • Issue of the topic: in the log I get this error: [ntime.internal.engine.RuleEngineImpl] - Rule ‘Accendi/Spegni Luce Camera’: The name ‘NULL’ cannot be resolved to an item or type; line 10, column 44, length 4
    I use this rule to set the state when the Philips Hue light (0100) is unreachable:

rule “Accendi/Spegni Luce Camera”

when

Thing "hue:0100:00178829d4e7:3" changed
then
var status = getThingStatusInfo("hue:0100:00178829d4e7:3").getStatus()
if (status.toString() == 'OFFLINE')
            {
postUpdate(Luce_Camera_Switch, NULL)
                  logDebug("logTest", "Stato OFFLINE")
            }
else {
                  logDebug("logTest", "Stato ONLINE")
            }
end

related item:

Dimmer   Luce_Camera_Brightness   "Luminosità Luce Camera"      <slider>   {channel="hue:0100:00178829d4e7:3:brightness"}
String   Luce_Camera_Alert        "Alert"              {channel="hue:0100:00178829d4e7:3:alert"}
Switch   Luce_Camera_Switch        "Luce Camera"            {channel="hue:0100:00178829d4e7:3:brightness"}

is there an other way to recognize when a light is not on or off but it’s unreachable without getting errors?

Try this instead:

Luce_Camera_Switch.postUpdate(NULL)

But I am not sure if you can post a NULL update. If that throws an error you’ll have to use UNDEF instead.

I’m pretty sure you can postUpdate to NULL. You cannot sendCommand to NULL. But UNDEF is the more correct state to use anyway.

In those rare cases where the postUpdate Action is appropriate to use (e.g Associate Item DP) postUpadate("NameOfMyItem", "NULL") should work.