[SOLVED] Device Http rules Shelly 1

Hi everyone

So I’ll star by saying I’m pretty literate when it comes to most digital things… I dabble in html, css, SQL, jquery, php, all aspects of networking and domains etc and it’s all self taught/google.

I’ve got a decent smart home setup now, 6 x echos, 10 fibaro dimmers, 2 nest protects, harmony hub, hue lights and a few other bits. I’m running openhab as my main controller on a QNAP NAS. So I’ve just bought a load of Shelly 1’s to do all my sockets (didn’t want bulky plugs and they are the only product out there rated above 13amp for the uk.

Now there’s no binding for them, I don’t want to go down the MQTT route as it disables cloud and also another thing to keep running. It has an api and I can successfully turn on/off through the browser url.

I’m struggling to get it working through openhab tho and having read for hours and experimented I can honestly say I’m lost. I’ve tried a dummy switch with a rule to send the http command but it throws an error.

I’ve read an openhab post where someone got working with exec binding and curl but I just can’t find enough information to even know where to start.

If someone could point me in the right direction/help me with the item it would be most appreciated.

Thanks in advance

It should be faily easy using the 1.x HTTP Binding.
Without testing, the switching command should be

Switch MyItem1 { http=">[ON:POST:http://IpOfShellyDevice/relay/0?turn=on] >[OFF:POST:http://IpOfShellyDevice//relay/0?turn=off]" }

That’s what I thought and did, it just doesn’t work. I’ll grab the error and post in a minute.
Do I need to put anything in the http.cfg file. The binding information just wasn’t very clear.

so using this rulewith a switch item

Switch KitchenLight "Kitchen Light" [Switchable]
rule "Kitchen Light" when Item KitchenLight received command then
if (receivedCommand==ON)
{
sendHttpGetRequest(”http://192.168.6.17/relay/0?turn=on”)
}
else if (receivedCommand==OFF)
{
sendHttpGetRequest(“http://192.168.6.17/relay/0?turn=off”)
}

end

i get this error


2019-02-08 16:23:51.418 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Kitchen Light': 1

and using your item it worsk on habpanel and event log, it just doesnt do anything to the light relay

2019-02-08 21:28:53.082 [vent.ItemStateChangedEvent] - MyItem1 changed from OFF to ON

OMFG…

Just thought id try something… Removed Http binding and reinstalled. now working. :frowning: wish id have done that 8 hours ago

didnt think i was going mad

Great, so please mark this as solved.