IHC and Home Assistant tips

In this post I will give some tips about the most asked questions I get for IHC and home assistant, and include examples I have used in my own setup. Basically it is about how the get something from IHC into HA or the other way.

How to turn on Philips hue light (or some other Home Assistant light) using an IHC push button.

The question is often: how do I get my IHC push button into HA? and the short answer is you don’t because HA does not have push buttons – only switches, and that is not what you want. What you want is something that can show the on/off state of the button and trigger an automation when the state changes. For this we have the binary sensor in HA.

First step is to make a binary_sensor for the push button. You do this by manually adding it to the configuration.yaml

  - id: 2382609
    name: mybutton

Name the “mybutton” button whatever you like. You can now see the button in HA as binary_sensor.mybutton. We want to have the button turn on a light called “mylight”. You add an automation to trigger when the button is pressed:

alias: MyLightOn
 - platform: state
   entity_id: binary_sensor.mybutton
   from: 'off'
   to: 'on'
   - service: light.turn_on
       entity_id: light.mylight
       brightness: 175

To configure another ihc button to turn off the light is almost the same, you just replace the light.turn_on with a light.turn_off. Note the “brightness” here is if you have a dimmable light. If the light is a simple on/off your can remove it.

Use a sensor from HA in IHC

IHC does not have wireless sensors like temperature or motion. I have temperature from my heating system (MaxCube) and also some zigbee temperature/humidity and pir sensors.

In this example I want to have a temperature sensor from HA and use it inside IHC. The following automation will trigger when the temperature changes and set the temperature on a float resourse in IHC

- alias: RoomTemperature
  - platform: event
    event_type: state_changed
      entity_id: climate.termostat
  - alias: CopyTemperature
    service: ihc.set_runtime_value_float
      ihc_id: 2210580
      value: '{{ states.climate.termostat.attributes.current_temperature }}'

In this case is the temperature from a climate entity and I use:

 {{ states.climate.termostat.attributes.current_temperature }}

If is was a temperature sensor called “mysensor” it would be

 {{ states.sensor.mysensor.attributes.temperature }}

I HA use the “Developer tools”, States to see the specific attribute for your sensor, it may not be the same.

I use ihc.set_runtime_value_float because temperatures i IHC are float values. The resource id can by any input or output resource on a functionblock in IHC. The type must match the service function, so if you have a pir on/off you use the ihc.set_runtime_value_bool (and the IHC resource should also be a boolean on/off)

The same pattern can be used when you want to use something else from HA inside your IHC function blocks.

How to get an enum from IHC into HA

You can get the enum as is current value in text (a string) to a sensor. So you can say it is a of unsupported hack, because the enum is not really supported in HA. In HA is will just be a string. You insert the IHC resource of the enum manually in your configuration.yaml file under the ihc section.

      - id: 12345
        name: myihcenum
        unit_of_measurement: "enum"

The HA state of the myihcenum will then be the text value of the IHC enum. Note if you don’t specify a unit_of_measurement it will default to °C – it can be anything you like. It is just a text in the UI.


When working with templates it can often end in a lot of restarting of HA until the template expression is right. It is a good idea to use the “Template” under “Developer tools” to check your template – then at least you know the syntax is correct before you try it.

38 responses to “IHC and Home Assistant tips”

  1. Christian says:

    Hi, thanks for some great tips and tricks. I don’t know, if this is the right place for this comments – if not, I apologize. Do other also have the issue, that IHC entities show up with: “This identity does not have a unique ID” under setting for the identity? Any solution for this?

    • Jens says:

      I already replied to you on this comment: https://www.dingus.dk/home-assistant-ihc-integration/#comment-408
      Because that was in danish, I will write it here again for others to read. The unique id functionality was not available at the time when the IHC integration was made, it is a newer thing added lately. I currently don’t plan to add it because as far is I know the only thing you get is the ability to hide the entities. The unique id’s are part of the new integration configuration i HA. It would be nice to have that for IHC (could allow you to configure the connection the IHC controller from the UI), but it is more a nice to have, than a need to have (and I currently don’t have to time to do it)

  2. Ejvind Hald says:

    Hi Jens, thank you very much for this great integration and tips for using it.
    It is cool and I assume you have spend a lot of time on it.
    I like that you added the on and off pulse option, so function blocks can be activated inside IHC.

    Clearly, as this something done when you are off work, your time is limited. If you some day get time, I would also like to vote for the unique id. It seems that some mqtt functionality is now connected to unique id – see https://www.home-assistant.io/integrations/switch.mqtt/

    Thanks again.

    • Jens says:

      Yes – this is a spare time project for me, (and I have a lot) so I need to prioritize. The unique id is not on in the top of my list. The mqtt integration use the unique id like some other integrations do, but that has nothing to do with the IHC integration. The unique id is for integrations that has a configuration flow (User interface), and where the integration can discover new devices automatically. It allows the integration to register devices and the user can choose to ignore a device. https://developers.home-assistant.io/docs/config_entries_config_flow_handler/#unique-ids

  3. Pilfos says:

    Hi Jens,

    My question is not related to this post. I’m using the Blinds and Shutters functionblock to control my blinds. Do you know if we can know from HA the “blind state”? I don’t see this property in the “IHC Viewer” in HA, but I don’t know if it could be easy to do, and If so, and you could give me some tips, I can try it myself.


  4. Pilfos says:

    Hi Jens,

    About my question to know the blinds status I was playing with your PythonIhcSdk, and using the sample.py and I was able to get the “blind state” like this:

    Authenticate succeeded

    Project downloaded successfully
    Runtime value: True
    Runtime value: True
    Resource change 1632271->Blinds are stopped time: 0:00:02.613724
    Resource change 1632271->Blind on its way down time: 0:00:30.252840
    Resource change 1632271->Blinds are down time: 0:01:30.308892

    But any idea how can I get this info and show it in the Home Assistant UI?

    BTW, instead of getting automatically all the switches from IHC I used this code (based on your sample) that generates the code for the configuration.yaml so I can customize the names or add any other attribute.

    project_xml = ElementTree.fromstring(project)
    groups = project_xml.findall(“.//group”)
    for group in groups:
    groupname = group.attrib[“name”]
    products = group.findall(‘.//product_dataline[@product_identifier=”_0x2702″]’)
    for product in products:
    nodes = product.findall(“dataline_output”)
    for node in nodes:
    nodename = node.attrib[“id”]
    print(” – id: ” + str(ast.literal_eval(nodename[1:])))
    print(” name: ” + groupname + “_” + product.get(“name”))


  5. Rune says:

    Thank you very much for your IHC HA integration. I have had my IHc installation for about a year a HA even less so I am still new to it.

    I have mapped a push-button to a binary sensor which allows me to toggle an IKEA bulb on and off. Works great. Is it possible to register a push-button being pushed continuously and thus dim the IKEA bulb?


    • Jens says:

      I tried doing exactly the same with a Ikea led dimmer, by using the service function to adjust the light up or down while you keep the button pressed. It did not work properly because the Ikea light is too slow to adjust. I only think this can work using the “transition” attribute, and if you can stop the transition. The “transision” attribute is a “parameter” for the light.turn_on and turn_off service functions that will change the light over time. This way you could start a transition from 0% to 100% light over 5 sec when you push the on button, and when you release the button you will stop the transition at the current light level. When I tried it the Ikea integration did not support the “transition” attribute, so it did not work. I think there has been some improvement to this, so it maybe possible to do it that way today.

  6. Jesper says:

    Please give input for the returning notifikation for this one:
    Component error: trigger – Integration ‘trigger’ not found.
    Component error: action – Integration ‘action’ not found.

    My code:
    id: 491868
    name: IHC_Tryk_Jonathan_Right

    # Manuel indtastning af funktioner/events
    alias: MyLightOn
    – platform: state
    entity_id: binary_sensor.IHC_Tryk_Jonathan_Right
    from: ‘off’
    to: ‘on’
    – service: light.turn_on
    entity_id: light.hue_color_spot_1
    brightness: 175

    • Jens says:

      It looks like you have put the automation part directly into the configuration.
      It need to be in the “automation:” section. In a default setup that included from the automation.yaml file.

  7. Kim Sejer says:


    Is there any way to invert binary sensors like smoke detector, twilight relay and so on.

    I’m running with an auto setup. Really hope you can help.

    • Jens says:

      You can insert a “inverting: true” in manual setup – see here:
      HA IHC
      If you have your own ihc_auto_setup.yaml you can also use “inverting: true” (see the first binary sensor as an example).

  8. Rasmus Nielsen says:

    Hi Jens,

    Do you know if there is any way of bringing timestamps from IHC into HA?
    I have some function block outputs of the type timestamp (called resource_time in the xml file).
    I have tried both with manual and auto configuration but I cant find any way that the IHC integration accepts the timestamps.

    Thanks for your great work btw.

  9. Martin says:


    Managed to add my IHC push buttons to HA and turn my a Hue light on/off and set brightness. Wuhuu. However, I’m struggling to replicate the smooth dimming from IHC. I followed a HA tutorial, but that implemented a step-wise dimming with a embedded delay in the automation.

    Is there a way to achieve this smoothing dimming? – I’m quite noob on IHC

    Thanks for great work!

    • Jens says:

      There is no way to do as smooth as the native IHC dimming. Doing it is steps is currently the only. Some lights supports a “transition” attribute that can help making is more smooth. I don’t know if Hue light supports it.

  10. Anton says:


    Is there a way to change a enum from Home Assistant without making a funktionsblok with multiple inputs that then changes the enum?

    And also thanks for this integration in HA – it is very nice!

    • Jens says:

      As I understand your question you are asking for a service function in HA like for integers: ihc.set_runtime_value_int, but for enum “ihc.set_runtime_value_enum”. It is not something I have implemented yet, but I will make a note of it. HA does not have “native” enums so it would be just a text in HA.

      • Anton says:

        Yes sorry for being a little cryptic with my question, I think it could be nice to have that control over funktionsblokke in HA. And yeah I could imagen it would be some non native way to make it work, but if it is possible it would be awesome!

      • Anton says:

        And also, does the set_runtime_float work for setting time values?

        • Jens says:

          I don’t think it works currently because the type are not converted. You can read timer values if your add it as a sensor in HA – it will be show as miliseconds. A “time of day” in a sensor will be shown as hours:minutes:seconds
          (Note the timer values as sensors are not present in the current HA version, but will be when I make a new update)

  11. Andreas says:

    Håber det okay jeg skriver på dansk. Er det muligt og kalde et IHC tryk via Home Assistant. Har forsøgt med Service IHC Pulse og det Rescource ID mit tryk har.

    • Jens says:

      Ja det er muligt – du kan teste i HA Udviklerværktøj|Tjenster – vælg ihc.pulse i dropdown – tryk udfuld eksempeldata – erstat 123456 med dit resource id for knappen og tryk kald tjenste.
      (Bemærk at hvis du har flere IHC controllere så virker service funktionerne i nuværende version kun på den sidste controller du har i din opsætning)

      • Andreas says:

        Tak for svaret.Det virket. Du har ved tilfældigvis ikke om der kommer en løsning i forhold til at kunne styer ihc dimmer 350 lr ?

        • Jens says:

          Problemet med dimmer 350lr (og unidimmer 350/400) er at der ikke er noget “feedback” til ihc controlleren så den kender ikke status for dimmeren (tændt/slukket, lysniveau). Du kan stadigvæk tænde/slukke ved at sende en puls til din funktionsblok i IHC der styrer din dimmer, men du kan ikke styre lysniveau. Bemærk du skal ikke sende puls direkte til din dimmer – fordi længden kan variere og så blive opfatte som et langt tryk. Og hvis din funktionsblok har et lysindekerings output ON/OFF kan du bruge det til at angive om lyset er tænd/slukket. (Det kan så ske at det ikke viser rigtigt hvis din IHC controller kommer ud af sync med din dimmer)

          • Andreas says:

            Hvilke dimmer vil du anbefale jeg udskifter mine gamle dimmere til. Hvis det er dimmer som stadig skal side ude i tavlen ?

          • Jens says:

            Jeg har selv kun wireless dimmere. De gamle wireless har det ikke godt sammem med led – skal have en belastning på min 20W (så vidt jeg husker).
            Jeg tror den enste tavle dimmer med “feedback” er den nye 2 kanals led dimmer, som sidder på RS485. Den virer kun dog med den nyeste Visual 3 controller. Så hvis du har den nye controller er det nok den jeg vil vælge.

  12. Andreas says:

    Jeg har desvære en ældre controler. Er der nogen løsning på jeg kan undlade at bruge dimmer funktionen i mit IHC uden jeg skal afmontere dimmerne i tavlen. Så de vil fremgå i HA som et almindeligt lampeudtag on/off.

  13. Kenneth A. says:

    Hvad er syntaksen til ihc.pulse?
    Vil gerne sende et on efterfulgt af et off tryk til IHC.
    Kan ikke få ihc.pulse til at virke.

    • Jens says:

      Hvis du i Home Assistant går til “Udviklerværktøjer|Tjenster” – vælger ihc.pulse i “Tjenste” så vises parameter i bunden.
      Der er kun en parameter “ihc_id”.
      Bemærk at det ikke virker hvis du har mere en en IHC controller – jeg har et pull request til HA som gerne snart skulle komme med. Der er også opdateret HA dokumentation her: HA IHC integration

  14. Martin Munch says:

    Lækker tutorial.
    jeg fulgte den for noget tid tiden og fik fint sat target temperatur på min varmestyring for noget tid siden, med en jinja2 formel lignende din {{ states..}} .

    Jeg har lige opdaget af det ikke virker længere med ihc.set_runtime_value_float.
    når jeg skyder service-kaldet af i udviklerværktøjer->Tjeneste skriver den expected float in dict @ data[‘value’]
    Hvis jeg skriver et tal direkte ind, så virker det.
    Er der noget med implementeringen af data_template?


    • Jens says:

      Det kan være fordi “value” ikke er en float – du kan konverter ved at skrive |float bagefter dit template udtryk.

      • Martin M says:

        Tak for buddet.

        Min formel ser sådan ud:
        {{ states.climate.vaerelse1.attributes.temperature | float }}
        Jeg har prøver med approstrof på leder og kanter. Det der undre mig er at det har virket. Er dit kald defineret med data eller data_template? Mit climate control er en ‘generisk template’, som måske kunne spille ind?


        • Jens says:

          Jeg tænker at det er noget der er lavet om i template koden. Hvis det virker for dig fra Udviklerværktøjer|Tjenster – så er problemet ikke i IHC integrationen. IHC inetgrationen definere en funktion set_runtime_value_float der tager et ihc id og en float værdi – resten ligger udenfor i Home Assistant. (d.v.s IHC integrationen har ikke noget med om det er data eller data_template)
          Jeg bruger set_runtime_value_float til kopiere en temperatur fra en termostat til IHC og det virke stadigvæk.

Leave a Reply to Pilfos Cancel reply

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