Categories

Keywords

Customizing Home Assistent IHC auto setup

I have had some questions about the auto setup of IHC in Home Assistant, and since this is not described on the Home Assistant documentation pages, this post will be about how you can customize the auto setup.

How does the auto setup work?

The auto setup is done by searching in the IHC project for patterns of predefined component. The IHC project file is a XML file. The search is done using xpath (this is a standard expression for selecting nodes in XML). I will not describe it further here, you can do a search for xpath tutorial in google and you can find plenty of information about it. The home assistant IHC integration has a predefined ihc_auto_setup.yaml file in the homeassistant/components/ihc folder. This file already has setup for the most commonly used products. The file has a section for binary_sensor, sensor, light and switch. All have the 2 variables:

xpath
The xpath expression to find the product

node
The name of the xml node containing the resource to map into home assistant

Below is the platform specific variables for binary_sensor, sensor, light and switch.

binary_sensor

The IHC resource (refereed to by node) most be a boolean resource (on/off)

Inverting
Boolean (True/False)

type
The binary sensor type in home assistant. Look in Home Assistant Binary Sensor for a list of build in types. (device classes)

sensor

The IHC resource referred be the node can be a integer of float resource.

unit_of_measurement
The unit of measurement to be used in Home Assistant

light

dimmable
Boolean (True/False). Set to True if the light is a dimmer. If you do not set this and the type of the resource is a integer (light level in the IHC project) the light will also be a dimmable.

switch

Has no additional variable, The resource should be a boolean (on/off)

Customizing the auto setup

The first step is to copy the ihc_auto_setup.yaml into your configuration folder. If the configuration folder contains a ihc_auto_setup.yaml file this will replace the build in file. If you can not file the file (or have a docker installation where the file is more difficult to access), you can get is directly for the home assistant github page

Open the ihc_auto_setup.yaml file in whatever editor you use for yaml files.

Removing products from the auto setup
Find the product you don’t want and delete all the lines from “- xpath” under the product. Each product has a comment describing what it is. After making change to the auto setup you have to restart home assistant.

Adding a new product to the auto setup
Create a new IHC project only containing the product you want to used for auto setup. This makes is easier to identify in the project file. Save the project file and open it on a text editor, preferable one that can show xml syntax (or a browser)

I will give and example adding the an actuator ( “telestat” in danish – my ihc applications are in danish – and screen dumps will be in danish)

Looking in the saved ihc project we can find the “Telestat”:

Now we need to write an xpath expression to select the product_dataline node. It is a good idea to have some kind of xpath tester when doing this. You can use an online tool like this xpath tester In the XML section paste the complete IHC project. In the xpath field write an xpath expression:

_.//product_dataline[@product_identifier=”0x220a”]

If you look at the above xpath you can see it is similar to some of the other xpath expressions from the auto setup. The only difference is that it has another product_identifier. Clicking the “test” button in the xpath tester we can see it will find the xml node we are looking for. We can also see the child node for the resource is the “dataline_output”, so that will be the “node” in the auto setup.
If you want to make sure the xpath expression does not find too many nodes (nodes you don’t want), it is a good idea to also test with a full IHC project in the xpath tester.
If we want to add this as a binary_sensor we will have:

We could also have added the actuator as a switch is case we want to control it from home assistant. To do this you just move it to the “switch” section of the auto setup file, and remove the “type” variable.

Notes on editing yaml

When I stated using Home Assistant the most frustrating thing was the yaml files (I am still not a big fan, but I can live with it). To make it less frustrating make sure you have an yaml editor that can validate it and have syntax highlighting (Like Visual Studio Code with a yaml extension)

Secondly use the “Config validation” in home assistant before you restart home assistant

Comments

The comments below has been imported from the old website. Currently comments are readonly, meaning you can not make new comments. You will be able to do that when it is ready. For now if you want to get in touch, you can send me an email. If you have problems with something that has a github repository, please make a github issue.

Hi ! Great info. Thank you. A side note - I have a fresh docker installation of Hassio. For some reason, no dimmers shows up, only switches Should I manually do an own config update somewhere?What kind of dimmers do you have? All the wireless dimmers should be found by the auto setup. The dataline dimmers are not in the auto setup. I did not include any of these because I don't have any to test it. And it looks to me like they do not have feedback so the IHC controller does not know the current lightlevel. If you are missing something you can add it like described in this post.This matches the new RS485 dimmers: # 2 channel RS485 dimmer - xpath: './/product_rs485_led_dimmer[@product_identifier="_0x4409"]/rs485_led_dimmer_channel[@product_identifier="_0x4410"]' node: "airlink_dimming" dimmable: trueWould it be possible for you to post your complete ihc_auto_setup.yaml file? I cant get it to work here thanksI already did that in another answer - here it is again: [ihc_auto_setup.yaml](https://raw.githubusercontent.com/dingusdk/home-assistant/dev/homeassistant/components/ihc/ihc_auto_setup.yaml) Note: I have also made a PR for Home Assistant where this is included so it will be included in a future HA update.Hi, They are wireless. From my .vis file: <product_airlink id="_0x4b854" product_identifier="_0x4305" device_type="_0x80a"This is the product http://www.elko.se/getfile.php/1349091/produkter/doc/3/3/4252/FDVdok4252.pdfThis product is not available in the danish LK Visual! I downloaded the Elko Visual software and can see it has more products than the LK version. If you look the folder where you have installed the visual program, you can find a .def file for each product - the dimmer is in this "Products\02#Trådlösa (WL) produkter\03#WL Mottagare - dimmer" folder. The Elko version has product4301 to 4308. The LK version only 4303, 4304 and 4306. I will update the default auto setup file in HA when I have something else to update. Until then you can edit the auto setup as I write about in my post above. It should be easy - you can use one of the existing wireless dimmers as a template and replace the product id with _0x4305Hi, updated and it works ! Thanks alot :-)Hi ! Is there any plan to update with the swedish product ?The plan was to do it when I have some other changes. But just so I don't forget, I have made the changes to my github fork of HA so it will be include the next time I make a pull request to HA. Can you try it to see if it works: [ihc_auto_setup-yaml](https://raw.githubusercontent.com/dingusdk/home-assistant/dev/homeassistant/components/ihc/ihc_auto_setup.yaml) Download the file and place it in your HA config folder and restart HA. NOTE this also includes the new RS485 bus dual dimmer - so if someone has this dimmer - please test.Works perfectly!Hi ! Seems to be a problem with your updated ihc_auto_setup.yaml. Several Switches are missing after reboot..Nothing was changed to the switches in ihc_auto_setup.yaml - only new dimmers addedHi, I am new to this HA, but I tried adding support for the new dimmers with your line of code with no luck. I get a "bad indentation of a mapping entry" when I add the ihc_auto_setup.yaml to the config folder of HA. Any ideas?Hi Jens, From the "ihc_auto_setup.yaml" I can see that "Opus 4-tryk" are not auto discovered. From my IHC project file I have the following configuration: [product_dataline id="_0x9b53" product_identifier="_0x2102" name="LK OPUS Tryk 4 tast" locked="yes" enduser_report="yes" icon="_0x85" note="Tryk med 4 SL" position="Ved dør"] [dataline_input id="_0x9c5a" name="Tryk (øverst venstre)" address_dataline="_0x1a" cable_colour="Rød"] [link_from_resource id="_0xe752d" name="Følg Link" icon="_0x47" link="_0xe762c"/] [/dataline_input] [dataline_input id="_0x9d5a" name="Tryk (øverst højre)" address_dataline="_0x1a" cable_colour="Rød"] [link_from_resource id="_0xe772d" name="Følg Link" icon="_0x47" link="_0xe782c"/] [/dataline_input] [dataline_input id="_0x9e5a" name="Tryk (nederst venstre)" address_dataline="_0x1b" cable_colour="Brun"] [link_from_resource id="_0xe792d" name="Følg Link" icon="_0x47" link="_0xe7a2c"/] [/dataline_input] [dataline_input id="_0x9f5a" name="Tryk (nederst højre)" address_dataline="_0x1b" cable_colour="Brun"] [link_from_resource id="_0xe7b2d" name="Følg Link" icon="_0x47" link="_0xe7c2c"/] [/dataline_input] [/product_dataline] Replaced with ] otherwise it didn’t show Any ideas how to add auto-setup of those buttons? (0x210e) since they contain up to 4 buttons in one (this example has two datalines mapped to two buttons each) Regards, /LasseJust replacing the product_identifier should work: ``` binary_sensor: - xpath: './/product_dataline[@product_identifier="_0x2102"]' node: 'dataline_input' ``` The node is referring to child nodes of the xpath expression. And you can have more than one (have not tried this but looked at the code and it can be more one)When it comes to autosetup it would be fantastic if the IHC project was (almost) the only source of data for HA. Thus I have a number of questions. Is there a way to specify the display name in HA from the autosetup file? Is there a way to specify the HE-position of the IHC entities? IHC has a position attribute in the XML file. Is there a way to group HA-entities? HA has a grouping concept that seems similar to rooms in IHC? Is there a way to specify the Icon used?I don't think it is possible to make an autosetup that will setup everything as everyone wants it. Just as an example, some people has asked to have all ihc buttons as binary sensors so you can use it for automations, but that would be very confusing to most other people. The default autosetup is supposed to setup all products that has a one to one from IHC to HA. Like light dimmers, you know that a dimmer in IHC should be a dimmer in HA. To answers your questions: * There is currently no way to specify the display name from autosetup - the name from the product is stored in an attribute ihc_name. Maybe this is a good idea, I am not sure if users has setup these name in IHC. Personal i mostly have the default names in my IHC project like "Combi dimmer 4 buttons". * Not sure what you mean by using the position from IHC? * HA now has the areas that could be used similar to rooms in IHC - I will look into this. It will probably requre you already have create the areas in HA with the same names. * The icons from IHC can not be used directly in HA, but if your want the change one single entity from the default you can always do that in the customizations in HA. Goto Configuration|Customizations - choose the Entity - select icon in "pick an attribute to override". Or you can edit the customize.yaml file manually. [See here: Customizing entities](https://www.home-assistant.io/docs/configuration/customizing-devices/)I agree that it is not possible to make an autosetup that works for everyone and everything. However, I was hoping that individual users would be able to customize ihc_auto_setup.yaml so that everything is setup there and only a few things would need to change. - With regards to names, then pretty much any display name would be better than “Badeværelse_4706654”. As it is now, you need to look up almost every name manually as there is no indication what it is aside from “Badeværelse”. - Position: In the IHC project file, every item has a “position” attribute. It seems that it only shows up for dimmers. At least it does not show for switches. - Rooms/Areas: It would be fantastic if it was possible to have that mapped automatically - Icons: Example: every magnet sensor in my house should have a door icon. However I cannot specify an icon for the xpath that matches magnet sensor. Same thing for a number of other things. Being able to specify icons in ihc_auto_setup.yaml would make life a lot easier. As it is right now, I am torn between further tweaking for ihc_auto_setup and ditching autosetup completely and going completely manual (perhaps creating my own XSLT that manually creates the necessary config files). Anyway, thank you for all of your work! It is greatly appreciated.Hej, Tak for en god integration :-) Jeg har i mit IHC projekt lavet min egen FB hvor jeg logger dato og tid på magnetkontakter og PIR sensorer (én fb pr. sensor). Disse er af typen Dato og Tidspunkt. Derudover har jeg en enum (Tekst) der beskriver hvor sensoren er. Det ligger udelukkende i funktions blokken da jeg ikke har et produkt under lokaliteter der kan modtage disse 3 info. Hvis jeg i Home Assistant opretter Dato, Tidspunkt og Tekst som en sensor, er der kun Tekst der kan vises - de andre står som unknown. Er der nogen måde jeg kan vise Datoen og tidspunktet der er logget (med systemtiden)? Pft.I den [nye version her](https://www.dingus.dk/help-testing-the-new-home-assistant-ihc-integration/) kan du lave sensor med "timertid" (millisekunder) og "tidspunkt" (som streng med formatet hh:mm:ss).
(c) 2010-2023 dingus.dk