How to setup GC100IR binding in OH2

I just updated my OH2 install to the latest snapshot (and of course broke it in the process). During the process of fixing it, I deleted the “black box” mapdb database - and the GC binding stopped working (although it still showed as “online”).

The problem was the ir-codes.map file. Once I manually discovered the “thing” through the Paper UI and added the ir-codes.map file - which was blank - (and saved back to the mapdb), we were good again. So I have to conclude that the binding is not picking up the name of the code mapping file from the text file definition of the “thing” I have.

So either my syntax is wrong (and it is copied from the Wiki), or the binding is not reading the “thing” file properly.

Just FYI.

@Nicholas_Waterton

Hmm, that’s odd. Your things file should look like this for a Flex (changing the values below for your specific configuration).

globalcache:itachFlex:000C1AA09F4B [ ipAddress="192.168.8.15", mapFilename="ir-codes.map", activeCable="FLEX_INFRARED"]

BTW, you might want to pick up the latest jar from here. I made a change to be a little smarter about which network interface to listen on for auto discovery and for sending commands. Make a backup of your current jar just in case. :sweat:

https://github.com/mhilbush/org.openhab.binding.globalcache/blob/master/target/org.openhab.binding.globalcache-2.0.0-SNAPSHOT.jar

I also made a change to enable serial commands to be sent directly from within a rule (avoiding the MAP file transformation), but I think you’re using IR, not serial. I needed to be able to construct serial commands on the fly for my Russound CAA66.

I’ll try the new binding, I have to say it’s probably my configuration, every time I update OH2 it breaks, and the “Things” are so confusing that it’s hard to know where to start. plus the “back box” database is difficult to manage.

The latest SNAFU I ran into is where you define in addons.cfg which binding to include. If you want the version 1 binding, you add a 1 to the end (eg, zwave vs zwave1). Well if there is only a V1 binding supported, you just use the name (eg astro) - right up to the point that a V2 binding becomes available, then OH2 loads the V2 binding (because you didn’t have the “1” at the end), and your whole set up crashes and burns…

OK enough whining, as I say it’s probably me, just to let you know it’s still working great though.

Well, there have been a few breaking changes lately. Regarding the “black box” mapdb database, that was recently replaced by a JSON-based database. :smiley:

I have recently received GC-100-12 and would much appreciate if someone could clarify me whether this binding (the one that is currently under review) covers the functionality of GC-100-12. I was planning to use ir ports (use them as input and output) as well as serial port and dry contacts.

Thank you in advance for your reply!

I’ve tested it with a GC-100-6, but not with a GC-100-12. From your list above, here’s what I think currently will work/not work.

  • dry contacts: haven’t tested on GC-100-12, but should work (works with an iTach CC)
  • IR outputs: haven’t tested on GC-100-12, but should work
  • IR inputs: not currently supported, but on my todo list (although it’s pretty far down the list)
  • serial: first serial port should work; not sure about second port (note serial is only one-way from GC-100 to device; 2-way is on my todo list)

Note that automatic device discovery will not work with GC-100’s running firmware earlier than v3.0 as those versions do not emit announcement beacons on the multicast address. GC-100’s running firmware earlier than v3.0 must be configured manually, either through Paper UI or using a .things file.

If you want to try it out, I can work through any issues you might have with the contacts, IR outputs, or serial ports.

The latest jar file is located here:
https://github.com/mhilbush/org.openhab.binding.globalcache/blob/master/target/org.openhab.binding.globalcache-2.0.0-SNAPSHOT.jar

Edit: I also should note that the binding doesn’t work in OH1.

Thank you for your proposal to help me in investigation of issues I may face when setting up GC adaptor!
Buying GC device I was was ready to develop binding from the very beginning since I needed serial port and dry contacts and I was pleasantly surprised when found your post yesterday. Since I am new to openhab framework and java language It will definitely would take much more for me time learning how to program it. May be some time pass and I will be able to suggest an input - I believe that I will manage to set the logic for my media system without serial port feedback (although, to my mind, feedback will let to have better control when setting up rules) but really need IR input functionality.
Probably will need to contact you soon when testing IR outputs and serial port.
Thank you in advance!

If you don’t mind, can you share how you intend to use IR input? I don’t have any use cases for IR input, so your intended use would be helpful as I think about how best to implement it. Thanks!

I agree that serial port input would be useful. I would be able to use it immediately with my Russound CAA66 to interrogate the status of the zones.

The case is described below. Your suggestion how to make it in the most efficient way are welcome, probably I missed smth.

Devices I would like to control:

  • TV (located in sitting room). Interfaces: unfortunately IR only
  • Media player (remote location). Interfaces: IR, Serial port
  • Hand-made valve amplifier (remote location) with speakers (located in sitting room). Interfaces: dry contacts to turn it on/off

Tools for control:

  • programmable IR remote controller

What rules I would like set up:

  1. Basic rule as an example:
    push the turn on button on the remote controller, IR signal goes to GC100, that sends
  • IR signal back to TV to turn it on
  • signal to dry contacts to turn on amplifier
  • command through serial port to turn on media player
  • command signal through serial port to turn on ARC channel on media player to circle sound from TV through media player and amplifier finally to speakers.
  1. Other rules shall allow to
  • have basic control of TV and Media player like change channels, increase/decrease volume etc using IR remote controller (IR signal shall be sent to GC100 first)
  • select the respective HDMI input on a TV when selecting a film to play from NAS

I understand that it is possible to have a control through smartphone over openhab app and in this case you do not need IR input, but the problem is that the all the family got used to IR remote controller.

This all looks pretty straightforward, @Offboard. A couple thoughts:

  • assuming the GC-100-12 is colocated with the TV & amp, if you want to use serial for the media player, you will need to be mindful of the RS-232 maximum cable length (generally 50 feet or 15 meters)

  • You might want to take a look at LIRC and the LIRC binding for openhab. That might be a better way to get the IR commands from the remote controller into openHAB. You could use that to trigger your rules, which in turn would issue the proper IR, CC, and serial commands through the GC-100-12. Here’s the pull request for the LIRC binding. I’ve not used LIRC or the LIRC binding, so I can’t offer much additional help.
    https://github.com/eclipse/smarthome/pull/2537

  • from what I can see, everything else you want to do should work through the GlobalCache binding.

Mark, thank you for advices.

  • I need RS-232 cable only of 8 meters long
  • Shall have a closer look at LIRC, as for now it it is not clear for how the infrared signal would be received. To be rendered by LIRC binding it shall be received by some device like GC100, but it is not an option for now.

A few comments on GC binding. I connected CG100-12 to the network and put the jar file to addons openhab folder. Current firmware of GC100-12 is 3.2. Unfortunately it was not automatically detected, I waited 2-3 minutes and finally added it manually in “Configuration” - “Things” filling the ip address of GC adaptor. Now it is in online status, so everything seems to be ok.

I would much appreciate if you could clarify for me the following two points:

  • I added thing “GlobalCache GC-100-12” in Paper UI. Shall the file with extension .things be created in folder openhab/conf/things? I do not see any but I was expecting that it will be created there,

  • Is Eclipse openhab edition. the most efficient way to code rules, set up .things and .items. If yes, shall I import the whole folder conf as a project or just separate files. Will it allow to debug rules?

Sorry for this basic questions. I am new to openhab and honestly tried to find the answers to these questions on the opehab portal, but sometimes it is difficult for me to differentiate what works for openhab 1.0 and what works for 2.0. For example, as I understand Openhab Designer was applicable only for openhab 1.0.

Thank you in advance.

You need an IR receiver to connect to the host that runs the LIRC daemon. Have a look here:

Hmm. That’s odd. My GC-100-6 is running version 3.2, so I know that version emits the discovery beacon. At some point I might want you to put the binding into debug or trace mode to see what’s being broadcast by the GC-100.

Nevertheless, I’m glad you got it set up in PaperUI. The fact that it’s showing ONLINE means that the binding was able to establish a connection with the GC-100. That’s good.

Assuming you are using a recent build (like beta 5 or a recent snapshot), when you add a thing through PaperUI, the thing is created in the openHAB internal database, which lives in userdata/jsondb. Those JSON files are human readable. When you add a thing using PaperUI, it will not show up in a .things file. The .things file is an alternate way of defining things.

The documentation is still evolving, but this would provide a pretty good starting point.
http://docs.openhab.org/introduction.html

I tend to use separate .items and .rules files for areas of my system that are functionally related. Personally, I find rules very difficult to debug. openHAB Designer does help, but later versions weren’t working so well. There is a working version somewhere; I just haven’t taken the time to get it.

Hello Mark and thanks in advance,
I am interested in using your binding however, I have not been able to make it work. Could you help me please?

Below I describes my config:

I have an GlobalCache iTach WF2IR.

  1. Today I installed the OpenHAB 2.0.0-SNAPSHOT Build #678.

  2. Using the Paper UI I installed the “Map Transformation” (i don’t know if your binding need another add-on).

  3. I copied the org.openhab.binding.globalcache-2.0.0-SNAPSHOT.jar file to folder …/openhab/addons/

  4. I made the file …/conf/items/globalcache.items that looks like this:
    Switch SAMSUNG_TV “Samsung TV” { channel=“globalcache:itachIR:000C1E031BBA:m1c1” }

  5. I added at the end of file …/conf/services/runtime.cfg the following:
    org.openhab.binding.globalcache.discovery.GlobalCacheDiscoveryService:backgroundDiscovery.enabled=false

  6. My …/conf/sitemaps/default.sitemap includes the following:
    Frame label=“Samsung TV” {
    Switch item=SAMSUNG_TV label=“Power” mappings=[SAMSUNG_TV_POWER_ON=“On”,SAMSUNG_TV_POWER_OFF=“Off”]
    }

  7. I made the file …/conf/things/globalcache.things that looks like this:
    globalcache:itachIR:000C1E031BBA [ ipAddress=“192.168.10.10”, mapFilename=“ircodes.map” ]

  8. And finally I made the file …/conf/transform/ircodes.map that looks like this:
    SAMSUNG_TV_POWER_ON=38000,1,1,172,172,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,21,22,1820
    SAMSUNG_TV_POWER_OFF=38000,1,1,173,173,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,65,21,21,21,1832

Now, when I run the default sitemap from my browser and I click on the “tv power on button”, I get the following on the OpenHAB LOG:

22:13:08.442 [WARN ] [.classic.internal.servlet.CmdServlet] - Received unknown command ‘SAMSUNG_TV_POWER_ON’ for item ‘SAMSUNG_TV’

I’ve not seen that warning message before. It’s not generated by the globalcache binding.

Your configuration looks correct to me. A couple questions:

  • In Paper UI, what is it showing for the GlobalCache thing? Is it ONLINE? If so, that would suggest the binding is running and has made a connection to the iTach WF2IR.

  • Are you using Basic UI or Classic UI? The warning message looks like it’s coming from the Classic UI.

  • Have you restarted OH2 since adding the items and sitemap? If not, can you try that?

Ok. I think I found it. You need to define the item as a String, not a Switch. Try this.

String SAMSUNG_TV  "Samsung TV" { channel="globalcache:itachIR:000C1E031BBA:m1c1" }
1 Like

Mark, thanks a lot for your answer.

You are right!!, I swaped Switch by String on my item file and now i got a diferent LOG. It look like this:

10:58:33.286 [INFO ] [ng.globalcache.command.CommandSendir] - Execute 'sendir' succeeded for command SAMSUNG_TV_POWER_ON on thing 000C1E031BBA at 192.168.10.10
10:58:33.289 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'SAMSUNG_TV' received command SAMSUNG_TV_POWER_ON
10:58:33.300 [INFO ] [marthome.event.ItemStateChangedEvent] - SAMSUNG_TV changed from SAMSUN to SAMSUNG_TV_POWER_ON

The answer to your questions are:
In Paper UI, what is it showing for the GlobalCache thing? Is it ONLINE? If so, that would suggest the binding is running and has made a connection to the iTach WF2IR.
The GlobalCache thing is ONLINE on my Paper UI.

Are you using Basic UI or Classic UI? The warning message looks like it’s coming from the Classic UI.
Yes, I’m using Classic UI.

Have you restarted OH2 since adding the items and sitemap? If not, can you try that?
Yes, I restarted the openHab2.

At this moment I’m not close to the TV to see the result, however I will see this night and then I’ll tell you.
Again Thanks for your help!

This looks good! It should be working now.

Great!!, confirmed, everithing works ok. Now i can see my TV and another devices working with my iTach WF2IR.
Mark, thank you very much for your time and help.

Glad to hear it is working well.

Out of curiosity, was the iTach WF2IR auto discovered? I’m still wondering why the GC-100-12 was not auto discovered.

Yes, once i put your .jar file on addons folder, set the IP address on WF2IR and i navegate to paper UI, my device was discovered automatically.