[SOLVED] Shelly Binding 2.5 Relay control

Hello there,

I installed the Shelly Binding and tried to control the Relay1

I followed the official binding examples.

.items

Switch Shelly_XXXXX1_Relay “Büro Licht” {channel=“shelly:shelly1:XXXXX1:relay1#output”}

.things

Thing shelly:shelly25-relay:XXXXX1 “Shelly 25 Relay XXXXX1” @ “Büro” [deviceIp=“192.168.178.39”, userId=“”, password=“”]

.rules

rule “Shelly”
when
Item Shelly_XXXXX1_Relay changed
then
if (receivedCommand == ON){
Shelly_XXXXX1_Relay.sendCommand(ON)
}
else if (receivedCommand == OFF){
Shelly_XXXXX1_Relay.sendCommand(OFF)
}
end

.sitemap

Switch item=Shelly_XXXXX1_Relay icon=“light”

the item is correctly created and the binding is active and online.
I can see in the openhab paperui the current firmware and how far the object is located.
So this must work I think

Log when i try to change the switch

2020-01-16 20:27:03.594 [ome.event.ItemCommandEvent] - Item ‘Shelly_XXXXX1_Relay’ received command ON
2020-01-16 20:27:03.600 [nt.ItemStatePredictedEvent] - Shelly_XXXXX1_Relay predicted to become NULL
2020-01-16 20:27:07.481 [ome.event.ItemCommandEvent] - Item ‘Shelly_XXXXX1_Relay’ received command OFF
2020-01-16 20:27:07.485 [nt.ItemStatePredictedEvent] - Shelly_XXXXX1_Relay predicted to become NULL

I don’t know, why the relay1 is not controlled by the switch.
Does someone know what I am doing wrong?
I think the binding is “newly” so I don’t find any useful stuff at google :o

probably the send command “on” is wrong, I cant find in the binding example what i need to send to power off or power on the relay1…

Greetings
Kahzia

Your item is configured to a Shelly 1 thing, but not your Shelly 2.5 thing…

I found randomly the fault…
i dont need a rule, only to link the switch to the output channel in the paperui configuration… :open_mouth:

But, i dont think that this is the final solution, is there no chance to control it with “if” operators ?

Oh okay, i thought thats been written in the example of the binding and must be set like this :smiley: . I will try it, thank u

Easy way: Open your Shelly thing in PaperUI and copy the channel definition you see.

mhhh,

doenst work for me

if (receivedCommand == ON){
shelly:shelly25-relay:XXXXX1:relay1#output.sendCommand(ON)

seems not correct to me :smiley:

i know only that way

else if (receivedCommand == OFF){
Shelly_XXXXX1_Relay.sendCommand(OFF)

but both doesnt work, so i dont know :slight_smile:

still trying with my first configuration, but with the changed 2.5 at the item:)
The question is, how can i trigger the relay to turn on
is “on” enough or did i need something else

if (receivedCommand == ON){
Shelly_XXXXX1_Relay.sendCommand(ON)
}
else if (receivedCommand == OFF){
Shelly_XXXXX1_Relay.sendCommand(OFF)

You have to send the command to an Item, but your Item is not configured to your Shelly Thing.

that my item.

Switch Shelly_XXXXX1_Relay “Büro Licht” {channel=“shelly:shelly25:XXXXX1:relay1#output”}

and my thing

Thing shelly:shelly25-relay:XXXXX1 “Shelly 25 Relay XXXXX1” @ “Büro” [deviceIp=“192.168.178.39”, userId=“”, password=“”]

it configures automatically right?
i don’t need to manually link the item in the configuration

Thats not the item from your first post, better but still a typo
It has to be shelly25-relay in your Items channel definition.

1 Like

u are completely right! :slight_smile:

I also saw I use it as switch is that “correct”
Do you think String is better for this?
My Code works and looks like this

.items

String Shelly_XXXXX1_Relay “Licht” {channel=“shelly:shelly25-relay:XXXXX1:relay1#output”}
Switch Lichtschalter “Büro Licht”

is this okay? cause I got 2 items now which receives a value.

Thanks anyway @hmerk :slight_smile:

Don’t know or understand why you have a String Item, Only need the Switch with the correct channel definition. Evend don’t understand your rule in the first post, it is superfluent.

Please mark this thread as solved if it is working now.

yes, it has no real sense.
It’s only for me, for a better understanding with openhab and the syntax :slight_smile:

In some weeks, I want to control a roller shutter with this shelly.
And now I just try some cases like turning on a lamp with a switch on the sitemap
then with an if argument and so on.

I think i will have enough questions soon :stuck_out_tongue: