Home Assistant IHC integration

Home Assistant is an opensource home automation system which can integrate with a lot of different kind of systems, but it has no IHC support yet. You can integrate IHC with Home assistant using mqtt and the ihc mqtt gateway. But it is nice to have a more “native” integration where lights, sensors e.t.c are found automatically. This is what this post is about.

Installation

Before you can use the home assistant IHC integration you need to install the python ihc soap client

From release 1.0.1 the python ihcsdk is now in PyPi and will be download automatically by home assistant.

The ihc integration for home assistant can be downloaded from github:

https://github.com/dingusdk/haihc

In the HA configuration folder (the folder containing configuration.yaml), you place the IHC integration in a subfolder called “custom_components”.

If you want to be able to update from the git repository see the description on github.

Configuration

I have made support for the HA components: light, switch and binary sensor. but before you can use these you need to configure the main IHC component.

First step is to insert the configuration for your ihc controller in the configuration.yaml file:

ihc:
  url: 'http://192.168.1.3'
  username: your-ihc-username
  password: your-ihc-password
  info: True

url,username and password are the connection for your ihc controller.

When “info” if True each device will have 3 properties: ihcid, ihcname and ihcnote, these are the value from the ihc project. You can see the properties at the bottom when you click the device in Home Assistant – see image.

This makes it easier to identify each device when you are setting up the system, so it is a good idea to leave this on in the beginning.

Light

To configure light insert this section:

light:
  - platform: ihc
    autosetup: True

autosetup: True will scan the ihc project and insert all products recognized as lights. If you want to manually add ihc resources – add the ids like this:

light:
  - platform: ihc
    autosetup: True
    ids:
      12345: tablelight
      12346: anotherlight
      ...

In this example 12345 is ihc resource id and “tablelight” is the name it will have in HA. The ihc resource id can be a light level for dimmers or an boolean output of a relay.

Switch

To configure switches insert this section:

switch:
  - platform: ihc
    autosetup: True

To manually add ihc resources do:

switch:
  - platform: ihc
    autosetup: True
    ids:
      12345: myswitch
      ....

The resource id should be a boolean resource.

Binary sensor

To configure binary sensors insert this section:

binary_sensor:
  - platform: ihc
    autosetup: True

The autosetuo should find Pit sensors and magnet contacts. if you want to add something manually do it like this:

binary_sensor:
  - platform: ihc
    autosetup: True
    ids:
      12345: 
        name: mysensor
        type: opening
        inverting: True
      12346:
        ...

The resource id should be a boolean resource. You can skip the inverting if you do not want to invert it (or set it to False). The different kind of sensor types can be found here at the HA site:

Home Assistant Binary Sensor

If you only want to specify the name – you can like do the other components id: name

Notes

For troubleshooting look in the ha log.

The component names should only contain a-z 0-9 and _ (Any national characters will be stripped). If you want to change the friendly display name do it in the customization in HA.

 

22 responses to “Home Assistant IHC integration”

  1. Christian says:

    This is awesome! I’ll try this very soon – this makes me able to get rid of my BeoLink Gateway, where I have to make double-commands to control my IHC stuffn from Home-assistant. Thanks!

  2. Morten says:

    Awesome indeed!! The integration works great and I have spend the past days adding automation and conditions to my IHC system. This is SO much more flexible and versatile than the native IHC interface and have truely revitalized my IHC installation. And not least made it fun and relevant! Now it starts to feel like what I intended back in the days getting it installed. HUGE thanks to Jens, the author!
    On my wish (dream) list is support for multiple controllers (I have two in my installation) and additional non-binary sensors (like temperature). One can only hope that dreams may come true 😉 Being able run Home Assistant with this integration script is definitely a must have for anyone with IHC. Highly recommended to try out!

  3. Christian says:

    Would it be possible to get all the presses (tryk, danish) in Home Assistant as well? So you could configure the presses to turn on for example Philips Hue bulbs.

    • Jens says:

      You can do it this way: You connect a binary sensor to a button (the ihc resource id for the button).You must do this by specifying the resource id manually. Then make an automation script to turn on the Philips Hue when the binary sensor change from off to on. Similar with another button to turn off the light. There are probably other ways to do it – I am still learning how Home Assistant works.
      (LK use the name “Control switch button” in English.)

      • Christian Klit says:

        Great, thanks a lot 🙂

      • Torben says:

        I am not sure I understand this 100 %

        I am able to type in an ID for the 4 Tryk Tast switch, but not able to define each of the 4 buttons. How can I then get the separate buttons into HA?

        Great work on this! Just bought a house with IHC, and still very noobish.

        • Jens says:

          Each button has an id. You can make a binary sensor for each button.

          • Torben says:

            I am using the Visual Controller 2 with HW 6.1 along with the Fuga switches. Could the old controller and thereby the old software be the reason, I am not able to see IDs for the seperate buttons but only for entire switch-component?

            Or maybe I am looking the wrong place. (I right-click the component, to enter the properties, where I can also define the datalines and inputs.

            Sorry if its a stupid question 😛

          • Jens says:

            I am using the same controller HW 6.1
            The software that comes with the controller does not show the resource ids. You can use my Alternative Service View Application. When you select an in- or output you will see the resource id in the bottom right window. Or you can open the IHC project in a text/xml editor and find it manually – but this is a bit more complicated.

          • Torben says:

            I will have a look at that tonight.

            Thanks for your help. It was the last thing I needed before editing my hass setup from my previous home.

            Great work

  4. Håkan Axelsson says:

    Super!!!

    Just a smalltypo custom_components. >>
    IHC integration in a subfolder called “custom_compoments”.

  5. Martin says:

    Hi Jens, a couple of questions.
    1) Will it be possible to extend the integration, so that e.g. a “Wireless Combi relay 4 buttons” will show up as a light component, but also auto insert all the integrated buttons as binary sensors.

    2) How do you do the actual development/debug of the component? What IDE are you using, and how do debug the source?

    3) Do you plan to have the component added as an official component?

    • Jens says:

      1) I think I would add the buttons manually, but you can add this to PRODUCTAUTOSETUP:
      {‘xpath’: ‘.//product_airlink[@product_identifier=”_0x4404″]’,
      ‘node’: ‘airlink_input[@address_channel=”_0x1″]’,
      ‘type’: ‘None’,
      ‘inverting’: False},
      for first button, then copy the same and do address_channel=”_0x2″ for second button e.t.c.
      2) I use visual studio for development, you can debug, but I have not found a way to attach to home assistant yet. (I use the installed home-assistant, and will probably need to download the source from github to do it). This is on my todo list.
      The PythonIhcSdk has the solution and project file included – you can open it in visual studio and try the example.
      3) Maybe I will add it as an official component, I have not decided yet.

  6. Martin says:

    1) Will look into it – if I get it sorted I might suggest a pull request.

    2) The PythonIhcSdk I get can be debugged by itself. I was looking for some tips/pointers/hints how you did the development and debug of the component for Home Assistant.

    Nice work by the way!!

    • Jens says:

      I think the autosetup configuration should be moved out to a separate yaml configuration file, because having all the buttons as binary sensors is probably not something most users will want. (I guess you only want this for buttons you will be using to control something in hass. This is why I wrote I would add the buttons manually)

      The perfect way to do this I think would be to have a UI for IHC setup with the complete ihc project tree and then you could just click a ressource and bind it to a hass component – no manually yaml configuration. (A lot of work, and I am not sure if I will go all the way)

      If I find a way to attach the Visual Studio debugger to home assistent I will let you know.

      • Martin says:

        Your thoughts make sense – I’m retrofitting an old home, and only have a few buttons that are all used in HA, so for me the auto discover would be nice.

        Instead of a complete setup tool, a nice “yaml auto generator” where you just click the IHC ressource and then the corrossponding yaml files are created could be nice.

        Personally I’m not doing the bindings/automations in HA’s yaml, but instead I’m using the HA Appdaemon.

        Thanks for letting me know about your findings.

        • Jens says:

          For debugging in Visual studio you need to start the main() function in the __main__ file.
          You can make a py file containing these 2 lines:

          from homeassistant.__main__ import main
          main()

          Then set this py file as your startup, and on the debug properties for the project add the script argument –runner
          You can also add a -c path-to-config-dir if you want to use a specific home assistant configuration

  7. Karsten says:

    Hello Jens

    Big Thanks for your work, it works great.

    Is it possible for HA to registrate if IHC reboots – at the moment HA looses integration when IHC reboots.

    • Jens says:

      I have made an update to the ihcsdk that should improve on the re-connect if the ihc controller is reset or the connection is lost from HA
      It has not yet been included in HA, but you want to try it out you can update the ihcsdk manually to version 2.2.0:

      pip3 install –upgrade ihcsdk

      And you need to do this is the same context as HA – in case you are using a virtual python environment. You should have HA stopped while you do this

Leave a Reply

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