Hi all, I opened a topic into hardware section but no one have suggested anything yet, I hope to be more lucky here. I promise to publish in this thread the result of my tests.
I want realize direct hardware (based on I2C protocol) to control those things, starting from GPIO. How I can merge the HA with a C routines that will manage the relay from the switches? For example I would activate the heat system by wall switch (low power cables already installed till raspberry) but switch it off by phone HA app.
SOmeone can kindly teach me what addons I should use and how to export variables from HA to the program written in C, thank you!
thank you for your kind answer.
I’ve checked it. Since I’m new to HA and Linux I’m having more difficulties to understand, but soon I will.
Before I would start with writing that program in C and compile it, which IDE you would suggest?
Which distro I have to upload to the Raspberry? The HA one is ok too?
Thank you
personally I have a server with Ubuntu and HA installed on a docker container.
If you have a Pi, you can try hass.io to get started as it’s probably the easiest, especially if you don’t know linux.
Once you get familiar, you can try a different installation method (I’d recommend docker again)
Thank you,
I’ve just checked deep the shell, it looks like to activate something from HA when an event occurs, y situation is different, I have hardware to manage with a proper sequence, and maybe it is possible to create this flow into HA somehow, for example:
I have one ventilation to switch on (output I2C relay board connected to GPIO) if the button is pressed (input by I2C driver connected to GPIO), if the button again is pressed it switches off, if no one wiill press to switch off it will switch off itself after 10 minutes. And yes by HA mobile app I can also switch on or off. How can I do this?
How also can I manage the I2C LCD connected to GPIO?
Thank you
I think for all this you will need to create your own scripts and call them via a shell_command.
Alternatively you could build support for mqtt in your script and call it this way (that’s one of the approaches I’ve taken)
Thank you!
Unfortunately I don’t see any I2C input and I2C output component, also not Analog I2C, RTC I2C and LCD I2C which I need to complete the project.
SHould I wait these components to be added? Or there is another way?
For example using a C written program that supports Mqtt and mqtt in HA and point on it by 127.0.0.1
I really didnt get what are you trying to do… Do you already have the “C” code to control your I2C devices? How do you use it without home-assistant? It’s easy to use the command line sensor/switch component to write “virtual” switches and sensors which calls your C app.
Sorry for my lack of experience here, soon I’ll start developing and I’ll know better, as soon I’ll finish cabling tha the hardware, which is needed to finish as soon as possibile.
I have to control curtains, shutters, air fans and some lights. ALl of them are controllable by physical switches in the house walls, they are buttons for low voltage. These buttons drive relays, and relays outputs will be connected to I2C I/O boards, the I2C bus is connected to Raspberry, and also in the same I2C bus there are relay boards (that turn on fun, lights, curtains, etc.). For example when the user push the button the air fan is turned on by raspberry via I2C, when push the same button switches off the fan, it will switch off automatically after some time. This is an example of automation I have to import to home assistant, so either physical switches or HA domotic switches on the phone can turn on and off the same fan.
I need to create with some programming language int HA the desidered behaviour, so to read the physical button status, to calculate a delay to switch off automatically if the user forgot to switch off, and so on, while I can change the status also by the phone app.
In partucular I need info how to import the I2C libraries for inputing and outputing, how to exchange RAM variables from HA to/from the program I have to build (where the logic of functioning is written)
May you kindly indicate me exactly how to do? Maybe there is already a page with some examples, thank you.
PS: I also have I2C analog inputs for light sensors and temperatures, an I2C RTC