Hello,
I’m new to openHAB and trying to implement some rule to close my roller shutter using a shelly 2.5.
I use shelly binding and created a thing. I also created an open-close item that works manually.
My test rule looks like this:
rule "Roller Close"
when
Time cron "0 0/1 * 1/1 * ? *"
then
Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed.sendCommand(100)
end
When the rule is triggered I get the following error:
An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.shelly.internal.handler.ShellyRelayHandler@20dd2c': null
java.lang.NullPointerException: null
at org.openhab.binding.shelly.internal.handler.ShellyBaseHandler.authorizationFailed(ShellyBaseHandler.java:616) ~[?:?]
at org.openhab.binding.shelly.internal.handler.ShellyBaseHandler.handleCommand(ShellyBaseHandler.java:306) ~[?:?]
I would be very grateful if someone could give me a hint…
Is Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed the item name? Did you link the correct channel to an item?
EDIT:
Try:
rule "Roller Close"
when
Time cron "0 0/1 * 1/1 * ? *"
then
Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed.sendCommand("100")
end
Or
rule "Roller Close"
when
Time cron "0 0/1 * 1/1 * ? *"
then
var closed = Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed.state as Number
Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed.sendCommand(closed)
end
The stack trace contained authorizationFailed (ShellyBaseHandler.java:616) which made me think that it wasn’t the sendCommand parameter but some other configuration problem. I think instead of a NullPointerException an IllegalArgumentException should be thrown with a corresponding error message.
The automatically generated name of the item led me to use a numerical value.