IHC MQTT Gateway

As an example to the IHC SDK for .NET I have made a IHC to MQTT gateway. It is actually some old code I made long time ago to interface to a specific home automation system (I think it was domoticz). I have now made it mode general so you can configure the MQTT topics for each IHC resource.

Many home automation system have support for MQTT today, so the MQTT gateway will allow you to connect IHC to these systems. The gateway will also be able to run on a raspberry pi with mono.

If you do not already have a MQTT broker running, look at “mosquitto” it is also available for raspberry pi.

Download

You can download the code for the example from github here:

https://github.com/dingusdk/ihcmqttgateway

If you do not want to compile the program yourself, you can download download it here:

Compiled Ihc MQTT gateway

Configuration

The configuration of the gateway is located in the ihcmqttgateway.conf file. It is a simple text file you can edit in notepad or whatever you like. There are comments in the file explaining what to do. You can define a mqtt topic to map the a IHC resource id and  you can have separate topics for in and out.

By default the programs will look for the ihcmqttgateway.conf file but you can also specify a path to the configuration file as an argument to the program. Syntax:

IhcMqttGateway.exe [-v] pathtoconffile

The -v option will log changes from both IHC and MQTT to the output.

Limitations  note

This program is not tested in “production” – I have never used it myself to anything but playing around. There are know limitations like if you send data to an ihc resoruce and the type does not match. Maybe I will improve on it later, or you can do it yourself – you have to code on githut (Just remember to share if you do so)

IHC Resources ids

You can find ihc resource ids by looking in the IHC project file – it is a XML file.
An easier way is to use my IHC Alternative Service View application

In this application you can see a tree view of you your installation, expand and click the resource and get the id.

License

See the license page

 

5 responses to “IHC MQTT Gateway”

  1. Martin says:

    Super – thanks for sharing.

  2. Martin Mogensen says:

    Looks promising 🙂 what’s the delay from an IHC wireless switch is pressed, until a message is sent on MQTT?

    • Jens says:

      It is hard to tell the delay, but my guess it is only a few milliseconds because it is barely noticeable.
      (Add the -v parameter when you start the program – then you will see on the screen when something changes)

  3. Anders Gregersen says:

    Have you tried it on Linux (Raspberry)?

Leave a Reply

Your email address will not be published. Required fields are marked *