Shubhamjain007 / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Extend HttpBinding to support numeric commands (eg. PercentType for RollerShutter) #86

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1. The HttpBinding currently supports only named commands (ON/OFF/MOVE). It 
also explicitly throws an exception when trying to configure the HttpBinding 
for Dimmer or RollerShutter item.

Could you provide support for numeric commands (like PercentType command) and 
than remove the exception for Dimmer and RollerShutter item?

2. I've build a WiFi board for blinds control (HTTP/REST/XML) and would like to 
control it via openhab: http://wifihomeautomation.blogspot.com.

Tomaz

Original issue reported on code.google.com by tomazh.s...@gmail.com on 4 May 2012 at 7:54

GoogleCodeExporter commented 8 years ago
Thomas, as you are the expert for the HTTP binding, I assign this to you.
Sounds like a valid extension to me, do you see any reason against it?

Original comment by kai.openhab on 4 May 2012 at 8:40

GoogleCodeExporter commented 8 years ago
Hi Tomazh, cool stuff you have built there. Have you already calculated the 
retail prices? I will look into the things by the end of the upcoming week. 
Regards, Thomas E.-E.

Original comment by teichsta on 5 May 2012 at 8:54

GoogleCodeExporter commented 8 years ago
Actually, this is a DIY project for my own house, but I will publish all the 
info on the blog (open hardware, open source).

The material (including the PCB) for 5 blinds should be around 100 EUR.

Thanks, Tomaz

Original comment by tomazh.s...@gmail.com on 5 May 2012 at 2:10

GoogleCodeExporter commented 8 years ago
hi Tomaz,

great job !!!

i´m using the netio module from pollin 

http://www.pollin.de/shop/dt/MTQ5OTgxOTk-/Bausaetze_Module/Bausaetze/Bausatz_AVR
_NET_IO.html

but is not wifi... i control it with an telnet connection and lets say ascii 
protocol, this may be also possible with you module ?

thanks in advnace

Original comment by openhab.lb on 10 May 2012 at 7:17

GoogleCodeExporter commented 8 years ago
It would be possible, the module is capable of receiving binary tcp or even udp 
trafic. You should look on the manufacturer webpage, maybe ask on their forums.

I didn't go that way, I like HTTP/REST/XML combination. For now I have a jquery 
mobile web page to control the module.

With openhab, I intend to automate things (like raise the blinds in winter, 
when the sun is shining to heat up the house and vice versa in the summer, to 
hide the blinds when there is to much wind and so on).

Original comment by tomazh.s...@gmail.com on 11 May 2012 at 11:23

GoogleCodeExporter commented 8 years ago
fyi: the current restriction to certain DataTypes is removed (on default). 
Please build from source or wait until the SNAPSHOT-Build is finished.

Original comment by teichsta on 14 May 2012 at 11:05

GoogleCodeExporter commented 8 years ago

Original comment by teichsta on 14 May 2012 at 11:10

GoogleCodeExporter commented 8 years ago
If this is of any help ... the commands, I am using look like this:

http://192.168.1.201/blinds.cgi?channelNo=1&command=move&position=40

Original comment by tomazh.s...@gmail.com on 14 May 2012 at 2:20

GoogleCodeExporter commented 8 years ago
whereas the "position=40" is the variable part the url, correct?

Original comment by teichsta on 14 May 2012 at 2:23

GoogleCodeExporter commented 8 years ago
You are correct

Original comment by tomazh.s...@gmail.com on 14 May 2012 at 2:38

GoogleCodeExporter commented 8 years ago
i thought about the enhancement again. With the current change (see above) any 
kind of State is accepted by the HTTPBinding as a first step. If you need an 
url with a variable value than you should incorporate a rule instead. A proper 
rule could like:

rule "post a variable within an url"
when
  Item ITEM_WHICH_CONTAINS_VALUE_TO_POST received update
then
  sendHttpPostRequest("http://192.168.1.201/blinds.cgi?channelNo=1&command=move&position=" + receivedCommand)
end

Does that sound like a solution to you?

Original comment by teichsta on 14 May 2012 at 7:47

GoogleCodeExporter commented 8 years ago
That sounds ok.

If I understand correctly, that means I don't have to define the binding when 
defining  an item, instead I just define an item and a rule. Am I correct?

Original comment by tomazh.s...@gmail.com on 14 May 2012 at 7:55

GoogleCodeExporter commented 8 years ago
And another question ... Is it possible to define only one rule for all the 
blinds?

Original comment by tomazh.s...@gmail.com on 14 May 2012 at 7:59

GoogleCodeExporter commented 8 years ago
regarding #12: you are right
regarding #13: it depends :-) what does your UI look like? Which kind of 
control are you going to use?

The rule can only react to a single item, but this item can be a GroupItem. 
When you react to a group item you could iterate over it's members and send the 
position value to each member. This would look like this:

[...]

var members = BlindGroup.allMembers
var channelNo = ""
for (member : members) {
  channelNo = <mapMemberItemSomeHowToChannelNo>
  sendHttpPostRequest("http://192.168.1.201/blinds.cgi?channelNo=" + channelNo + "&command=move&position= + receivedCommand)
}

Original comment by teichsta on 15 May 2012 at 7:38

GoogleCodeExporter commented 8 years ago
Thanks, I think we've cleared most of my questions ...

Regarding #12 ... If I wan't the icon to reflect the state of the blinds, I 
have to define an input binding in the items file?

Original comment by tomazh.s...@gmail.com on 15 May 2012 at 9:10

GoogleCodeExporter commented 8 years ago
Tomazh, are there any news on your rule-Tets. Does it work for now? We could 
then close this issue ...

Original comment by teichsta on 13 Jul 2012 at 9:44

GoogleCodeExporter commented 8 years ago
I've tested the solution and it fits my purpose. Thanks.

Original comment by tomazh.s...@gmail.com on 14 Jul 2012 at 8:52

GoogleCodeExporter commented 8 years ago
perfect! another satisfied customer ;-)

Original comment by teichsta on 16 Jul 2012 at 7:39