HTTP Binding/ REST Interface

457 views
Skip to first unread message

karsten.k...@gmail.com

unread,
Jul 1, 2015, 9:43:00 AM7/1/15
to ope...@googlegroups.com
Hi,

i need to duplicate my openhab to be able to control my Helios HWL.

I could read the items using http binding to REST interface from air ventilation OH.

If i want to change a status on the air ventilation system using the main OH interface - how could i do this using rest?

Challenge is that i need to change the speed using a "Dimmer" item.

Any idea/ suggestion?

Cheers and Thanks
Karsten

dan cunningham

unread,
Jul 1, 2015, 10:05:36 AM7/1/15
to ope...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab/0e79d0ba-224d-4872-8ae8-0ff69b4854e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

watou

unread,
Jul 1, 2015, 10:31:19 AM7/1/15
to ope...@googlegroups.com
The REST API wiki page says you need to use the HTTP PUT verb to update an item's state, but HTTP POST to send a command.  Is the wiki page incorrect or incomplete?

dan cunningham

unread,
Jul 1, 2015, 5:13:23 PM7/1/15
to ope...@googlegroups.com
Sorry, it should be a PUT to change the state directly in the first example, its a POST to send a command to the item (vs changing the /state directly)
 
On Wed, Jul 1, 2015 at 8:31 AM, watou <jo...@cocu.la> wrote:
The REST API wiki page says you need to use the HTTP PUT verb to update an item's state, but HTTP POST to send a command.  Is the wiki page incorrect or imcomplete?

dan cunningham

unread,
Jul 1, 2015, 5:18:08 PM7/1/15
to ope...@googlegroups.com
One last thing ;-)  If the item is bound to something (like zwave, gpio, ect...) you probably want to send a command vs changing the state. 

karsten.k...@gmail.com

unread,
Jul 6, 2015, 12:56:14 PM7/6/15
to ope...@googlegroups.com
Hi

thanks for your help already.

I am advancing further :)

I could send commands and as well grep data from Rest Interface.

Now I have following Scenario - based on a rule i want to send different values towards the rest interface. Tule looks like

rule "Helios Geschwindigkeit setzen"
when
 
Item SetKWLFanStatusgHelper changed  
then
   
if (SetKWLFanStatusHelper.state instanceof DecimalType) {
       
var value = SetKWLFanStatusHelper.state as DecimalType
        logDebug
("heating", "Received HVAC status " + value)
       
if (value == 3) {
            postUpdate
(SetKWLFanStatus, 3)
       
}
       
else if (value == 2) {
            postUpdate
(SetKWLFanStatus, 2)
       
}
       
else if (value == 1) {
            postUpdate
(SetKWLFanStatus, 1)
       
}
   
}
end


I thought something like this should work:

Number SetKWLFanStatus "Ventilation Speed" <vent_ventilation_level_3> { http=">[1:http://192.168.1.16:8080/CMD?kwlFan=1] >[2:http://192.168.1.16:8080/CMD?kwlFan=2] >[3:http://192.168.1.16:8080/CMD?kwlFan=3]" }

Unfortunately it doesnt. How other would that work - to not use 8 different switches.

Thx & Cheers
Karsten

Thomas Eichstädt-Engelen

unread,
Jul 6, 2015, 4:44:19 PM7/6/15
to ope...@googlegroups.com
Hi Karsten,

according to https://github.com/openhab/openhab/wiki/Http-Binding the configured commands are lacking the HTTP VERB. Please try 

Number SetKWLFanStatus "Ventilation Speed"  <vent_ventilation_level_3> { http=">[1:POST:http://192.168.1.16:8080/CMD?kwlFan=1] >[2:POST:http://192.168.1.16:8080/CMD?kwlFan=2] >[3:POST:http://192.168.1.16:8080/CMD?kwlFan=3]" }

and post the according snippets of the openhab.log.

Thanks, Thomas E.-E.


--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
Reply all
Reply to author
Forward
0 new messages