Shelly-Binding: NullPointerException when trying to close roller shutter

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

Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed is the item, created through PaperUI. It is linked to #Control.

Unfortunately your suggested code didn’t work either.

What is the name of the item?

Shellyswitch25UgRolloWc_Roller_RollerControl0Open100Closed is the name, I think.

Will need to know the name if it’s going to work in a rule.

Looking back over the topic:

You can control it manually from where? What do you see in the logs when you control it as that should tell you the name.

FYI: Open/Closed items are Contact items, ON/OFF are Switch items, and percentage items are Dimmer type.

PaperUI, Control

The item name is correct.

Itemtype is Rollershutter

Then you have not named the item and that is the default.

Example of a Shelly item using files.

 Switch Shelly_XXXXX1_Relay “Light” {channel=“shelly:shelly25-relay:XXXXX1:relay1#output”}

I really don’t think I can help more as I’m out of time but here is a link that should.
https://community.openhab.org/search?q=shelly%20roller%20shutter

Read thru a few topics and best of luck. I’ll check back later to see how things are going.

Thank you so much for helping out.

I found the solution:

sendCommand(DOWN)

Please read thru the OH documentation to understand items. I assumed you had done this but I was mistaken.

This could have been resolved much faster with knowledge of how items work in OH.

Check out both links. :wink:

I read the documentation, but I was misled:

  1. 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.
  2. The automatically generated name of the item led me to use a numerical value.

Sorry for the inconvenience