Newbi with ALS

Community i need some help getting started. 2 years ago i was diagnosed with als. i cannot walk and cannot type. i use my eyes. Automation is a life line for me. Right now i want to control my direct tv and tv. i know the http commands but not sure how that works with http binding. i also have some items that i need irc. i have an iguana works usb device. any help is welcome.

Harold in Houston

What is the type and format of the HTTP commands? For example, are they simple HTTP GET requests to control things or do you need to do an HTTP POST with a body (e.g. JSON encoded text)? The answer is important as it will dictate how/whether the HTTP binding will work.

The options include:

  • the HTTP binding and lots of switches for each button/command that can be sent
  • the sendHttpGetRequest and sendHttpPostRequest actions called from a rule
  • calling curl or some other script using the Exec binding or executeCommandLine action

Are you on Windows, Linux, or Mac? If on Linux I found this posting about how to get OH to talk to LIRC. I also see a WinLIRC program which might work the same way and I’m sure someone has it working on Mac as well, though the article I linked to only addresses Linux.

You also might be able to talk to the USB device directly using the Serial Binding.

i am on windows.

here is a sample command that brings up the guide. if i paste in browser it works and returns a string of data.

i have been trying to get winlirc to work but no luck yet.

Getting closer.

OK I’m pretty sure the HTTP binding will work just fine. Now the devil will be in the details.

What does the string look like that comes back? Do you just need the string as is, parse the string to populate some Items with values, or just throw away the returned string?

Since it looks like you are primarily simulating remote button presses I suspect the answer will be you don’t care about the return. If that is the case:


Switch GuideKey "Guide" <television> { http:">[*:GET:"] }

This creates a Switch with the label “Guide” and a TV icon which when triggered (ON or OFF) it sends an HTTP GET command to that URL.


Switch item=GuideKey mappings=[ON=Guide]

This creates a line on the sitemap with a single button labeled “Guide” which will always send an ON command. It doesn’t make much sense to have a toggle for something like this.

I am presuming you would need to create a separate Item for each of the remote buttons you want to be able to simulate.

in the case of emulating the remote buttons the string return is thrown away.

dumb question. some of the buttons on the remote like channel up are not on/off. are they still called switches? also the demo did not have a good example of something resembling a remote. how easy is that easy develp?

i created new sitemap and item files. when i run i have a guide key with a lightbulb icon. there is a switch. however when i toggle it nothing happens. i pasted the html in the browser and it works. what should i try next.

Good. My example should work just fine then.

As for the buttons, as far as OH is concerned they are switches. The ON and OFF signals are just a way for us to activate the call to the URL.

Search the forum for “remote” ideas on how to do something like a remote on the sitemap. It can be done but it requires some misdirection.

Instead of using the HTTP binding directly in the sitemap create Number Item for each row of buttons on the remote. Use the mapping as illustrated above to map button names to a number. Some have been clever and found the unicode symbols for common remote symbols (e.g. the triangle for play). Then create a rule that triggers on any of those Items and use a switch statement and sendHttpGetRequests with the commands.


Number NumbersRow1
Number NumberRow2
Number NumberRow3
Number NumberRow4
Number ChannelRow
Number VolumeRow


Text item="NumberRow1" mappings=[1=1, 2=2, 3=3]
Text item "NumberRow2" mappings=[4=4, 5=5, 6=6]
Text item="NumberRow3" mappings=[7=7, 8=8, 9=9]
Text item="NumberRow4" mappings=[Guide=10, 0=0, Enter=11]
Text item="ChannelRow" mappings=[Up=12, Down=13]
Text item="VolumeRow" mappings="[Up=14, Down=14]


rule "Remote buttons"
    Item NumberRow1 received command or
    Item NumberRow2 received command or
    Item NumberRow3 received command or
    Item NumberRow4 received command or
    Item ChannelRow received command or
    Item VolumeRow received command
    switch(receivedCommand as DecimalType){
        case 0: sendHttpGetRequest("url for 0")
        case 1: sendHttpGetRequest("url for 1")
        case 10: sendHttpGetRequest("url for guide")

The lightbulb and the switch indicates you don’t have the mappings correct. It should look like Switch item=GuideKey mappings=[ON=Guide]

The nothings happens may mean you need to run a POST instead of a GET. It is hard to say given how much of the details browsers hide from you. That is easy enough to test. Change your existing Item by replacing the GET with POST.

i changed get to post and no luck.

here is what i have in sitemap file:

sitemap demo label=“Main Menu”
Switch item=GuideKey mappings=[ON=Guide]

here is item:

Switch GuideKey “Guide” { http:">[*:post:"] }

At this point our ability to debug is limited. I recommend downloading curl for Windows or installing something like cygwin to get at curl and see what is coming back when you GET and POST to that URL. If you can get it to work through curl then we should be able to get it to work with the HTTP binding. And if not you can write BAT scripts that use curl executed through the Exec binding.