Unexpected null on status request thing

  • Platform information:

    • Hardware: _RPI 3
    • OS: _Rasbian
    • Java Runtime Environment: openhab 2.5version
    • openHAB version: 2.5
  • Issue of the topic:
    I have 4 GU10 lightbulbs from IKEA working though deconz II USB stick. 3 op them are Dimmable onlt one however the whitecolor can be changed to.
    All 4 GU10s are seen as ONLINE in the paperUI.
    When however I request the things status with { getThingStatusInfo(“hue:0220:00212E04F655:7”).getStatus } in a Rule an error is generated { 2020-03-28 13:33:00.330 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘LB2 connections’: cannot invoke method public org.eclipse.smarthome.core.thing.ThingStatus org.eclipse.smarthome.core.thing.ThingStatusInfo.getStatus() on null } for the GU10 with whitecolor adaption.This does not happen to the other 3 GU10s. Can anyone help me with this

Rule part that goes wrong:
//- GUI_03

if (GU10_3_ConnectionState.state != NULL ){

            logInfo("LB2", "GU10-3 Not Null")

    if (getThingStatusInfo("hue:0220:00212E04F655:7").getStatus != GU10_3_ConnectionState.state){                                                                                                                                                                                                     

         GU10_3_ConnectionState.postUpdate( getThingStatusInfo("hue:0220:00212E04F655:7:brightness").getStatus.toString)

    }

} else { GU10_3_ConnectionState.sendCommand("NULL") }

As said before in the paper UI all 4 GUIs show as ONLINE. The GU10 is taking commands onthe dimmer and the white color so it functions as you would expect.

Thank you for your help
Frank

what do you get if you add logInfo("ThingStatus",getThingStatusInfo("hue:0220:00212E04F655:7").toString) to your rule?

1 Like

2020-03-28 14:44:22.277 [INFO ] [e.smarthome.model.script.ThingStatus] - ONLINE

As i would expect since the paer UI gives them all ONLINE

I change the rule to

getThingStatusInfo("hue:0220:00212E04F655:7").toString

same error

The same error?

Then there is somewhere else in your rule that you use getStatus

The point here though is that getStatus should work. If it works for some Things and not others, there might be a binding bug in how itssetting status. Seems unlikely, but lets understand what is going on.

Try a comparison

logInfo("test", "Working thing {}", getThingStatusInfo("some: working:hue:UID")
logInfo("test", "Non working thing {}", getThingStatusInfo("hue:0220:00212E04F655:7")

I changed the rule to
//- GUI_03

if (GU10_3_ConnectionState.state != NULL ){

            logInfo("LB2", "GU10-3 Not Null")

    logInfo("ThingStatus",getThingStatusInfo("hue:0220:00212E04F655:7").toString) 

    if (getThingStatusInfo("hue:0220:00212E04F655:7").toString != GU10_3_ConnectionState.state.toString){                                                                                                                                                                                                     

         GU10_3_ConnectionState.postUpdate( getThingStatusInfo("hue:0220:00212E04F655:7:brightness").toString)

    }

} else { GU10_3_ConnectionState.sendCommand("NULL") }

And I get the error

2020-03-28 15:01:22.375 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘LB2 connections’: cannot invoke method public java.lang.String org.eclipse.smarthome.core.thing.ThingStatusInfo.toString() on null

The first to logifo statments are in the log file so the error occures now on
if (getThingStatusInfo(“hue:0220:00212E04F655:7”).toString

Frank

That’s exactly the same line you previously reported working.
Make sure all your rules - in all files - have unique “names”.
Make sure you get a clean loading rules message in openhab.log after each edit.

  1. Make sure all your rules - in all files - have unique “names”.
    –> Chacked it Rule is unique
  2. Make sure you get a clean loading rules message in openhab.log after each edit.
    –> I see the following in the log file.
    2020-03-28 15:12:33.676 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘LB2_C_GU10_DXX.rules’

NO errors ( the rule mentioned is part of this file)

@rossko57 on your remark “That’s exactly the same line you previously reported working.” is not true, I added ```
logInfo(“ThingStatus”,getThingStatusInfo(“hue:0220:00212E04F655:7”).toString)

thats supplies "ONLINE" in the log file  but 
if (getThingStatusInfo("hue:0220:00212E04F655:7").toString ....

gives the error...

I think you’re copy-pasting an invisible character around in your UID.

I retypes all the UUIDs in the rule and yes now it works , so there was as you said an invisible character, thanks so much for the help…
Best regards,
Frank

1 Like

Sometimes weird things explain weird behaviour ! Well found.

1 Like