Pi I/O intergration

Hi,

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

I thought that all I would need to do is power down plug the board in power up and install Home assistant install https://home-assistant.io/components/binary_sensor.rpi_gpio/ and away I would go - but sadly not that easy.

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?

Many thanks in advance.

Pete

1 Like

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.

http://www.diegoacuna.me/how-to-run-a-script-as-a-service-in-raspberry-pi-raspbian-jessie/ might be a good starting point. There are lot of other tutorials out there. Just google something like β€œmaking a linux service on raspberry” and you should find something close to your needs.

thanks will start reading

thanks got the example working now for modifying the IO library

cheers

However if anybody knows how these boards could be integrated with HASS that would be great

Using Shell Command - Home Assistant and mqtt should get you part of the way.

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

Pete

Pete,

I am running into the same issue, I am also running Rpi 3 with 2 io pi plus. I did see abelectronic released some info for home assistant @ https://github.com/abelectronicsuk/abelectronics-home-assistant-custom-components

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.

1 Like

Hi

I have 4 AB Electronis io boards fully working now direct into HA. Excellent company and a great product shout if you need more info.

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.

Yes they actually wrote the code on my request for help - I needed to get 100+ digital inputs into HA and their boards looked like the ideal solution.

Their first code had a minor bug which they have since removed so I wonder if you do not have the latest version?

All I had to do was copy down the files - which I did by cloning them.

I then copied the custom_components into the homeassistant directory - I am using Hassbian it does I am told work on HASS.io

I then copied the relevant config files well cut and pasted them into my existing and all was good.

Config.yaml

binary_sensor: !include binary_sensors.yaml
switch: !include switches.yaml
group: !include groups.yaml
automation: !include automations.yaml

binary_sensor.yaml

  • platform: iopiinputssensor
    name: IOPiInputs20
    i2c_address: 0x20
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs21
    i2c_address: 0x21
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs22
    i2c_address: 0x22
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs23
    i2c_address: 0x23
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs24
    i2c_address: 0x24
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs25
    i2c_address: 0x25
    pullup: 1
    scan_interval: -50

  • platform: iopiinputssensor
    name: IOPiInputs26
    i2c_address: 0x26
    pullup: 1
    scan_interval: -50

  • platform: template
    sensors:
    iopi_in1:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 1’
    iopi_in2:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 2’
    iopi_in3:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 3’
    iopi_in4:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 4’
    iopi_in5:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 5’
    iopi_in6:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 6’
    iopi_in7:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 7’
    iopi_in8:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 8’
    iopi_in9:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 9’
    iopi_in10:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 10’
    iopi_in11:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 11’
    iopi_in12:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 12’
    iopi_in13:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 13’
    iopi_in14:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 14’
    iopi_in15:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 15’
    iopi_in16:
    value_template: β€˜{{states.binary_sensor.IOPiInputs20.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 16’

    iopi_in21:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 2 1’
    iopi_in22:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 2 2’
    iopi_in23:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 2 3’
    iopi_in24:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 2 4’
    iopi_in25:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 2 5’
    iopi_in26:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 2 6’
    iopi_in27:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 2 7’
    iopi_in28:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 2 8’
    iopi_in29:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 2 9’
    iopi_in210:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 2 10’
    iopi_in211:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 2 11’
    iopi_in212:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 2 12’
    iopi_in213:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 2 13’
    iopi_in214:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 2 14’
    iopi_in215:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 2 15’
    iopi_in216:
    value_template: β€˜{{states.binary_sensor.IOPiInputs21.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 2 16’

    iopi_in31:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 3 1’
    iopi_in32:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 3 2’
    iopi_in33:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 3 3’
    iopi_in34:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 3 4’
    iopi_in35:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 3 5’
    iopi_in36:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 3 6’
    iopi_in37:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 3 7’
    iopi_in38:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 3 8’
    iopi_in39:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 3 9’
    iopi_in310:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 3 10’
    iopi_in311:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 3 11’
    iopi_in312:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 3 12’
    iopi_in313:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 3 13’
    iopi_in314:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 3 14’
    iopi_in315:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 3 15’
    iopi_in316:
    value_template: β€˜{{states.binary_sensor.IOPiInputs22.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 3 16’

    iopi_in41:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 4 1’
    iopi_in42:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 4 2’
    iopi_in43:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 4 3’
    iopi_in44:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 4 4’
    iopi_in45:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 4 5’
    iopi_in46:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 4 6’
    iopi_in47:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 4 7’
    iopi_in48:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 4 8’
    iopi_in49:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 4 9’
    iopi_in410:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 4 10’
    iopi_in411:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 4 11’
    iopi_in412:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 4 12’
    iopi_in413:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 4 13’
    iopi_in414:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 4 14’
    iopi_in415:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 4 15’
    iopi_in416:
    value_template: β€˜{{states.binary_sensor.IOPiInputs23.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 4 16’

    iopi_in51:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 5 1’
    iopi_in52:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 5 2’
    iopi_in53:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 5 3’
    iopi_in54:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 5 4’
    iopi_in55:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 5 5’
    iopi_in56:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 5 6’
    iopi_in57:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 5 7’
    iopi_in58:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 5 8’
    iopi_in59:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 5 9’
    iopi_in510:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 5 10’
    iopi_in511:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 5 11’
    iopi_in512:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 5 12’
    iopi_in513:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 5 13’
    iopi_in514:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 5 14’
    iopi_in515:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 5 15’
    iopi_in516:
    value_template: β€˜{{states.binary_sensor.IOPiInputs24.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 5 16’

    iopi_in61:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 6 1’
    iopi_in62:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 6 2’
    iopi_in63:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 6 3’
    iopi_in64:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 6 4’
    iopi_in65:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 6 5’
    iopi_in66:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 6 6’
    iopi_in67:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 6 7’
    iopi_in68:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 6 8’
    iopi_in69:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 6 9’
    iopi_in610:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 6 10’
    iopi_in611:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 6 11’
    iopi_in612:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 6 12’
    iopi_in613:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 6 13’
    iopi_in614:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 6 14’
    iopi_in615:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 6 15’
    iopi_in616:
    value_template: β€˜{{states.binary_sensor.IOPiInputs25.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 6 16’

    iopi_in71:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin1 == 1}}’
    friendly_name: β€˜IO input 7 1’
    iopi_in72:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin2 == 1}}’
    friendly_name: β€˜IO input 7 2’
    iopi_in73:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin3 == 1}}’
    friendly_name: β€˜IO input 7 3’
    iopi_in74:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin4 == 1}}’
    friendly_name: β€˜IO input 7 4’
    iopi_in75:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin5 == 1}}’
    friendly_name: β€˜IO input 7 5’
    iopi_in76:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin6 == 1}}’
    friendly_name: β€˜IO input 7 6’
    iopi_in77:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin7 == 1}}’
    friendly_name: β€˜IO input 7 7’
    iopi_in78:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin8 == 1}}’
    friendly_name: β€˜IO input 7 8’
    iopi_in79:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin9 == 1}}’
    friendly_name: β€˜IO input 7 9’
    iopi_in710:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin10 == 1}}’
    friendly_name: β€˜IO input 7 10’
    iopi_in711:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin11 == 1}}’
    friendly_name: β€˜IO input 7 11’
    iopi_in712:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin12 == 1}}’
    friendly_name: β€˜IO input 7 12’
    iopi_in713:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin13 == 1}}’
    friendly_name: β€˜IO input 7 13’
    iopi_in714:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin14 == 1}}’
    friendly_name: β€˜IO input 7 14’
    iopi_in715:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin15 == 1}}’
    friendly_name: β€˜IO input 7 15’
    iopi_in716:
    value_template: β€˜{{states.binary_sensor.IOPiInputs26.attributes.pin16 == 1}}’
    friendly_name: β€˜IO input 7 16’

switches.yaml

  • platform: iopiswitch
    i2c_address: 0x27
    name: IOSwitches
    pins:
    1:
    name: Pin 1
    initial: True
    2:
    name: Pin 2
    initial: True
    3:
    name: Pin 3
    4:
    name: Pin 4
    5:
    name: Pin 5
    6:
    name: Pin 6
    7:
    name: Pin 7
    8:
    name: Pin 8
    9:
    name: Pin 9
    10:
    name: Pin 10
    11:
    name: Pin 11
    12:
    name: Pin 12
    13:
    name: Pin 13
    14:
    name: Pin 14
    15:
    name: Pin 15
    16:
    name: Pin 16

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

Hi there!

I have also few of these boards in I2C bus. I noticed that looping through all 100 pins to check state change takes some time and wastes resources.

Are you guys using the interrupts on the ABElectronics boards to detect the sensor state changes?

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.

Not sure, but I understood hassio does not support custom python components (yet). That might be an issue.

Just an update to my earlier post: I haven’t still implemented interrupts to get faster state checking :slight_smile: Maybe soon…

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 have everything running on single Pi. However, I’ve connected three Abelectronics IO-PI’s with long range I2C bus. I’ve set up the long range I2C with these: https://shop.controleverything.com/products/long-distance-i2c-bus-extender

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.

How is it with MQTT?

Hello Jayden,

Do you use hass.io ? I like to try the Abelectronics io-pi with hass.io.

Grz Ruben

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 :slight_smile:

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:

1 Like

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 :slight_smile:

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.