very new to all this including the Pi.
I have home assistant running on my Pi 3 and so far I am getting my head round it and have got MQTT woring with flashed sonoffs these are a great solution to switch my lights etc on and off.
I am now looking to read the state of all my light switches in the house - this is in theory easy as they all come back to central point so I thought I can expand the I/O of the Pi with the following board/s as I will need c.100 inputs https://www.abelectronics.co.uk/p/54/IO-Pi-Plus
There are libraries for the board to allow you to program in Python etc but I do not know what to do with them to link them to the Pi.
If anybody could help me I would be grateful as these boards are so cheap for getting real world into the Pi.
If it can not go directly into Home Assistant is there a way I could run a program on the same Pi or even a different one and MQTT the Home assistant to let it know what has changed?
I canβt answer the rest of your question as I donβt have one of those boards, but as for this part, yes, you could absolutely make a program that runs in the background on the same pi.
First you need to figure out how to use the libraries with the board. Once you got a script that works, you want to look into how to make it into a service that runs in the background.
File - Home Assistant could also be useful, but as you mention in your first post, sending data to HA via mqtt is probably easier (Install mosquitto and check man mosquitto_pub if you havent already).
I have moquitto running - the advantage of solving it via MQTT is I can have a number of Pi picking up the real world i.e. garage and summer house as these are not integrated with the house. but I need to learn how to get these boards working - there are some very good demos however my poor knowledge of how to install and run programs in Pi is the blocker I think
I wish I knew an expert nearby me as I would soon pick it up if explained
I will be attempting to figure this out over he next few days. If I have any luck Iβll post here. Unfortunately Iβm not much of a programmer. If you find a solution please also post.
I completely agree with you every experience Iβve had with abelectronics has been excellent. Great product and a great price.
I copied over their files last night and it showed up as badges for their current state. I was not able to clone it from GitHub so I had to make each file manually.
Shortly after I ran into some bugs (noob errors on my behalf) and am currently working them out.
Appreciate the offer for help, Either way I think it would be beneficial for others that may be attempting similar setup if one of us or someone posted a brief explanation on how to set it up.
As you can see I have only used complete sets of 16 I/O as either inputs or outputs but it is possible to mix them - I would not as I think it is neater to keep it as all one or the other and the boards are so cheap why would you limit yourself for future expansion.
My next project is to use a second Pi and a set of boards to make a MQTT version that I can have in the separate buildings - Garage and Log Cabin so as to only have one instance of HA running on the property.
Come back if more help is needed - I am sure it will work once set up right
I am not and I am still struggling to get this to work on hassio. Iβve reached out to Abelectronics and was given little to no help. Hopefully you guys have better luck than me.
I have a small python program running on a separate Pi which send mqtt message direct to a sonoff and that then updates the state in hassio. Works quick and leaves the Pi to work hassio and automations
I think these can be used to expand IO-PIs indefinately if you also add multiplexer so that the I2C addresses do not mix up.
I noticed that using HTTP to deliver messages was slow (like 100 ms - 400 ms), instead of direct I2C bus data. So I had small but annoying delay after pushing light switch until the light turned on or off.
Nope, I have Virtualenv installation currently so I can run custom Python scripts. Not sure if they can be run yet on hass.io.
So as Pete69, I also have custom Python script running that is checking what is happening in I2C bus. My setup uses HASS Python API to interface with the system and it will change switch states when I2C data changes.
I think I will redo my setup at some point. I think could also open source the setup, but it is bit of a βugly hackβ currently so it should be reviewed by someone with better Python knowledge before using by larger audience
I am also using this I/O pin expander with my pi, I didnβt like having to make a bunch of template sensor to get the binary sensors state so I ended up writing my own custom component (binary sensor). I am planning on writing also a switch component.
My understanding is that Abelelectronics didnβt do a Pull Request for their components because HA would required them to have the module to interface with the board hosted in PyPi, Iβm using adafruit-circuitpython-mcp230xx in my component which is already in PyPi so I believe I could make a PR later on but havenβt got around reading the requirements for it.
In the mean time, if you want to give my custom component a try here is the link:
Whoa! The new life after The Great Migration and without homeassistant.remote truly feels painful.
As earlierly stated, I also have several IO Pi Plusβ hooked up to RPi and theyβre used to monitor light switches around the house. Compared to the setup of @Jardiamj, I do not have the possibility to put direct GPIO to RPi to detect interrupts. Because of this, I have to poll the IO Pi Plus status.
Earlier I was able to use homeassistant.remote.set_state() to change the button (sensor) state when changes were detected. Iβve been trying to get the new custom_component solution to work for 20+ hours, without success.
Could anyone point me to proper guide or tutorial, where setting states has been pointed out in quite straight forward manner?
Question about the custom_component scripts. Is it possible to run heavy script with the new custom_components (scanning a lot of pins via I2C bus), if the script will still be making only few updates to Home Assistant states? Iβm asking this because Iβm not quite sure how often Home Assistant runs these custom_scripts or can they be running constantly?
Also, does anyone have knowledge how often Home Assistant states can be updated with the new custom_components so that it does not overwhelm the event bus?
P.S. Using this script locally still allows one to use homeassistant.remote, thank god for this, atleast until Iβll figure out how the new custom_components work
Hi @Jayden,
I am curious of what your setup looks like and why you canβt make use of the mcp23017 hardware interrupt.
As far as I can tell, the things that changed in the custom_components is the directory structure and the addition of a manifest.json file. You still update the platformβs state by defining def update(self):, if thatβs what you were referring to.