Using GPIO of a second Raspberry Pi in HA

Hi Guys

New here so hope some one can help

I have a question but first a little of my setup and and vision.

We moved into our house around 4 years ago and from then I have started to prepare everything to get ready to automate everything, as I’m used to home automation - Installing control4 ( I helped installed the biggest C4 site in SA, it took 3 years to complete and I just loved every second of it… I hooked ) - I want my house to be a wow factor in my life but C4 are an outrages price and just not affordable to me. I have then started to play with WebIOPi on a Pi1 and all went smooth. Planned to make my own CSS file to get the look correct for me, But in the process I upgrade to Pi2’s and Pi3’s got a few of them on my network, great little hardware’s. Needless to say WebIOPi does not work correctly on the B+ boards so I ventured towards your channel and decided HA are the new route.

Now my house lights are already rewired to a 12V system and every switch in light switch and light wires in the house comes into one point. From that point I can basically do anything with them. The madness behind this were the idea of running them on the Pi GPIO, I switched to 12V as we have so many power failures in SA, all my lights and essentials like internet etc are running from a battery and solar panel, It’s great to be the only one in the neighborhood that have lights when the power are down. But now the issue…

With WebIOPi I could use two or three Pi GPIO’s to achieve my goal as I could point to another IP in the HTML. But in HA I’m not sure how to achieve this. With only 25GPIO ports on a Pi I would most likely need to use 3 Pi’s to achieve my Goal.

For my light Switches I need around 16 Inputs
For my lights I need another 16 Outputs with an extra 6 to open my Doors, Garage Doors, and gates.
And then I need another 14 Inputs to interface with the alarm system and use the existing PIR’s, Door sensors, Beams etc for motion detecting in the automation’s.
And then always You need more to expand as you go along.

If you have any suggestion or know how I can use another Pi Please let me know.

You can put HA on the Pi and just run home assistant. Then changes can be visible in your main home assistant using the API.

I pull the states for a number of switches (that need the PI to operate) from a Pi to my main instance. See the bottom of the link below.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/switches.yaml

Okay so let me see if I got the idea correct…

Lets take HA_Main as Pi1 and HA_Inside as Pi2 and HA_Outside as Pi3 all three running its own HA instant
For Pi2 and Pi3 its just to setup the GPIO’s as


 - platform: rpi_gpio
    ports:
      11: Front Beam
      12: Back Beam

switch:
  - platform: rpi_gpio
    ports:
      20: Front Spot Light
      12: Back Spot Light

Then on HA_Main I pull in the API codes of HA_Inside and HA_Outside and do the automation from the HA_Main unit.

This will allow me to get the input state and trigger the relay from HA_Main?

Plus it will give me the advantage of an easy user face on all the pi’s if something goes wrong for trouble shooting

yeah, you setup the remote instances as normal with HA like they are stand alone.

You can then pull those states into your main instance. I believe you could push the state to your main instance also but don’t have any experience with that. That may be a better option if you need instant updates. If its a temp sensor or other slow moving items pulling it periodically may work better.

MQTT is another option that would work either with or without home assistant. Without you would need some phython code to read the sensor/switch and publish the status. I am no MQTT expert so someone else would need to chime in with the ins and outs of that setup.