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
The IHC integration is now included in the official Home Assistant – so the code below is not updated anymore.
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:
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.
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!
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!
Temperature, Humidity and light sensors are now supported in the new release 1.0.2 I have just made
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.
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.)
Great, thanks a lot 🙂
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.
Each button has an id. You can make a binary sensor for each button.
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 😛
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.
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
Super!!!
Just a smalltypo custom_components. >>
IHC integration in a subfolder called “custom_compoments”.
Thanks – typo corrected
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?
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.
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!!
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.
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.
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
Super, thanks for getting back.
Will give it a go.
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.
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
Hi,
First off thanks a million for writing this.
Is there a list over supported IHC controllers?
I do not have a list, but it should be working on all since IHC controller visual 2 HW 6.1
I have tested it myself on that controller and the latest IHC visual controller 3.
Other users have reported HW 6.2 to be working also.
The IHC controller is sold under other names too – like “Elko” in sweeden. I know some users have these working too, but I do not have the product versions.
Thanks for your reply. I forgot to ask you if you know if the controller has to be the viewer version or those without the viewer addon work.
I don’t know if you need the viewer version. I don’t have a controller without the viewer.
If you have one without the viewer try it and let us know the result.
I have a problem with my IHC switches (4-button wired Opus buttons/”kip tryk”)
None are automatically discovered or configured. All lights are discovered automatically and working, but none of the switches.
Regardles of manually configuring them as switches or binary sensors, when I then press one of the buttons, _all_ configured switches/sensors triggers as pressed, not just the one I press. I have the individual ressource id’s configured like:
binary_sensor:
– platform: ihc
binary_sensors:
– id: 23866
name: stue_trappe_1
– id: 24122
name: stue_trappe_2
– id: 25146
name: stue_gang_1
– id: 25402
name: stue_gang_2
Any suggestions how to resolve this?
… additional information:
If I use “Alternative Service View” program to see resource id’s I have the possibility to press “click” or “on”/”off” for the specific button. Then only one of the buttons in Home Assistant toggles as pressed, so then it works. Just not when pressing the physical IHC button.
So, I guess there is a problem in the IHC implementation within Home Assistant “reading” the physical button state?
If you look in the log book in Home Assistant do you then also see all buttons change when you press just one button?
Yes
Logbook entries are:
10.12 stue_trappe_1 turned off
10.12 stue_trappe_2 turned off
10.12 stue_gang_1 turned off
10.12 stue_gang_2 turned off
10.12 stue_trappe_1 turned on
10.12 stue_trappe_2 turned on
10.12 stue_gang_1 turned on
10.12 stue_gang_2 turned on
Note the entries are reversed (direct copy paste from logbook)
I only pressed one physical button.
If I press “click” on one of the buttons in IHC Alternative Service View, only that button is pressed, logged and turned on
I cannot reproduce this – so if someone else can let me know.
Nogen idéer til hvordan jeg kan fejlsøge, omkonfigurere, teste? Vil meget gerne kunne aflæse mine kip-tryk i HA.
(Any ideas how to debug or reconfigure?)
Du kan prøve at lave en minimal test opsætning i HA hvor du kun har dine kip-tryk for at se om det er samspil med noget andet som giver problemer. (set auto_setup til False og fjern alle andre manuelle opsætninger i ihc)
Problem løst, var fejl i IHC konfigurationen på visual controlleren hos mig. Nu virker tingene som forventet 🙂
Beklager forstyrrelsen, men tak for hjælpen
Jeg har lign. problemstilling og kan ikke finde batteri tryk. Har defineret dem som en binary sensor og benytte id fra det enkelte tryk. Er dette korrekt?
Jeg har muligvis brug for en venlig sjæl der kan poste et eksempel der virker. Alle mine andre ihc komponenter kommer ind men selve mine wireless battery tryk gør ikke. Jeg skal bruge dem til at kontroller and enheder Zigbee såsom Philips hue og lign.
Hej, Jeg har lign. problem som beskrevet her på tråden men har ikke haft held endnu; muligvis pågrund af evnerne:). Jeg har i dag integreret diverse ihc komponenter som virker i HA. Jeg vil gerne kunne bruge min IHC wireless batteri tryk til at styre andre Zigbee enheder ala Philips hue og ikea tradfri. Jeg kan dog ikke finde disse tryk og jeg har prøvet at oprette dem som binary sensor via deres id men indtil videre uden held. Er der venlig sjæl der kan poste et simpelt eksempel som vekommende ved virker?
Er det muligt at tilføje forbindelse til flere ihc controllere?
Morten Lüneborg har lavet support for mere end en controller, jeg har ikke selv prøvet det. Det kommer først i næste version, eller du kan hente dev branch fra github hvis du ikke kan vente.
er det muligt at kunne styre temperaturen på IHC?? jeg kan PT se den aktuelle rum temperatur, men er der en måde jeg kan justere den på
Du kan bruge service kald. Se under udviklerværktøjer|services. Der er en funktion for hver parameter type bool, float og int. For temperatur er det decimal tal d.v.s. ihc.set_runtime_value_float du skal bruge. Her er et automation eksempel jeg selv bruger til at få temperaturen fra mit badeværelse ind i ihc
- alias: BadTemperatur
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: climate.bad_termostat
action:
- alias: CopyTemperatur
service: ihc.set_runtime_value_float
data_template:
ihc_id: 2210580
value: '{{ states.climate.bad_termostat.attributes.current_temperature }}'
(Bemærk at yaml indrykninger bliver ikke vist korrekt her)
Hej… hvis jeg sætter dit eksempel ind efter alt mit IHC i yaml og skifter ID til mit eget bad vil Hassio ikke starte igen, har du et bud på det??
Det skal stå under automation sektionen (som regel i automation.yaml filen). Når det går galt med yaml det ofte indrykninger det er galt med, og husk ikke at bruge tab. Brug en editor hvor du kan vise whitespace d.v.s. space og tab. (Jeg forstår ikke hvorfor nogen syntes yaml formatet var smart til Home Assistant).
Det er ikke nok kun at udskifte ihc_id – “climate.bad_termostat” er min termostat så der må du vælge noget fra din installation. Når du har rettet i din Home Assistant configuration så brug funktionen “Tjek Konfiguration” under instillinger|Generelt inden du genstarter HA
er det sådan du kunne dele din automation.yaml så man kunne efterligne lidt 🙂 når jeg sætter det nu og retter til efter mit eget for jeg følgende når jeg tjekker config
Invalid config for [automation]: required key not provided @ data[‘action’]. Got None. (See /config/configuration.yaml, line 184). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->platform. (See /config/configuration.yaml, line 184). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [automation]: [service] is an invalid option for [automation]. Check: automation->service. (See /config/configuration.yaml, line 184). Please check the docs at https://home-assistant.io/components/automation/
Hej igen
nu har jeg fået rodet lidt med det, der er bare noget jeg ikke helt forstå, som jeg ser det har du dine IHC temperatur målere inde i HA som Thermostater, men mine ligger der inde som sensore, jeg har oprettet alle min IHC enheder manuel i configurtion.yaml, har jeg sat dem forkert op?
Mine temperature kommer ikke fra IHC. Det er fra Max Cube systemet til trådlåse termostater. (Se e.v.t. min post om der her på dingus.dk). Mit automation eksempel overfører temperature fra Max Cube til IHC. (climate.bad_termostat er en Max termostat)
ja okay… så har jeg misforstået… har alt varme via IHC og troede jeg kunne komme til at justere den via HA øv øv
Hvis jeg nu laver en Generic Thermostat i Hassio og peger den på min bad sensor, så for jeg en Termostat i Hassio der viser temperaturen i badeværelset hvor jeg så kan justere varmen, vil jeg så kunne lave en automation hvor den kopier target temp til mit IHC ID i funktionsblokken (Setpunkt)?
Det kan godt ske at det kan lade sig gøre. Så vidt jeg kan se er Generic Thermostat er tiltænkt som en styring af varmen – der står at “heater” (on/off) skal være sat, men du kan nok pege den på en eller anden “dummy” switch som så ikke bliver brugt. D.v.s. så bruger du den kun til at vise og sætte temperatur med. Så skal du lave en automation der sætter temperaturen i IHC når target_temp ændres i HA – samme pricip som det jeg har i mit script.
Lad mig vide om du får det til at virke – der kan godt være andre som er også interreseret i det.
Alternativt kan du bruge en “input_number” (en slider) component til at sætte temperaturen i IHC med automation.
hej igen
jeg har prøvet at lave en “input_number”
input_number:
heating_temperature:
name: Temperature
min: 5
max: 25
step: 0.5
icon: mdi:thermometer
og så har jeg lavet følgende automation
alias: Badtemp1
trigger:
– platform: event
event_type: state_changed
event_data:
entity_id: input_number.heating_temperature
action:
– service: ihc.set_runtime_value_float
data_template:
ihcid: 2574380
value: ‘{{ states.input_number.heating_temperatur.state }}’
men for denne fejl i loggen
Error while executing automation automation.badtemp1. Invalid data for call_service at pos 1: extra keys not allowed @ data[‘ihcid’]
har du en ide til hvad jeg gør galt?
Du mangler et underscore ihcid skak være ihc_id. Ellers ser det helt rigtigt ud
Undskyld så er vi her igen, har rettet manglende underscore, men nu for jeg følgende
Error while executing automation automation.badtemp1. Invalid data for call_service at pos 1: expected float for dictionary value @ data[‘value’]
prøv at rette linien for value til:
value: “{{ states( ‘input_number.heating_temperature’) | float }}”
Jeg kiggede på et eksempel under input_number – der gør de noget tilvarende med “int”
sådan… tusind tak det virker, er ovenud lykkelig har en komplet IHC installation i min HA 🙂
hej, ville lige dele at jeg også har fået Generic thermostat til at virke med mit IHC, så jeg for det over i homekit og kan stille temperaturen på Hassio og i Homekit… igen tusind tak for hjælpen
Hvis jeg sætter dit eksempel ind i yaml under alt det andet IHC og ændre ID til mit bad, så vil den ikke starte Hassio igen, er det ikke sådan jeg skulle gøre det?
Hi,
My switches dosent show up in HA automatically. I need to create them manually. Should auto_setup not get them automatically?
Thanks
Regard
Claus