ebaauw / homebridge-rpi

Homebridge plugin for Raspberry Pi.
Apache License 2.0
305 stars 18 forks source link

Support for more GPIO ports via MCP23017 #149

Closed henningpeter closed 1 year ago

henningpeter commented 1 year ago

Your plugin is awesome!

An idea to make it even better would be to add support for GPIO multiplication chips like the MCP23017 (connected via i2c) to be able to use more of the devices you already support.

Otherwise there is just a limited number of GPIO to use.

ebaauw commented 1 year ago

I don't support any I2C nor SPI device at the moment. I think the real-time clock on the RaspBee II uses I2C, but other than that I have no I2C devices. I know pigpio supports I2C, but I have no experience developing against it. Unless there's a really cool device that I just have to investigate, I won't be looking into it - too many other interesting things to pursue.

Otherwise there is just a limited number of GPIO to use.

Recent Raspberry Pi models expose 27 GPIO pins (GPIO 2 through 27) on the 40-pin header, available for user-defined purposes. If you have a need for more than that, I would look at getting another Raspberry Pi Zero 2, before messing with port extenders. If you have a specific device with an embedded port extender, it's a different story, of course. But then it's really about supporting that device.

I started Homebridge RPi because I wanted to monitor the Pi's hardware, to figure out the right cooling solution. Hence the early support for the FanSHIM. That's still my main usage, even though I've switched to passive cooling.

Once I got the FanSHIM's button and fan supported through pigpio, it was easy enough to expose other simple devices connected to a single GPIO input or GPIO output pin. I'm happy to add more of those binary sensors and actuators, using whatever HomeKit services available. I'm hesitant to expose more complex devices, especially when I won't be using them myself. I won't be exposing custom-built devices, using multiple GPIO pins. I simply don't have the bandwidth to maintain and support these.

I played a bit with PWM for a dimmable LED and servo, but don't like that I need to poll them for the current state. The FanSHIM includes a chainable LED (even through it doesn't expose the pins to chain another LED), and the Blinkt! uses the same. The P9813 has a very similar protocol, and I could add support in a couple of hours, earlier today. I don't partially like them either, as they don't report their current state at all. The DHTxx temperature/humidity sensor was fun, but about the limit of what I can support. I still have some NeoPixel LEDs lying around, but I doubt I can support them without root privileges.

Olivierbkk commented 1 year ago

I started Homebridge RPi because I wanted to monitor the Pi's hardware, to figure out the right cooling solution. Hence the early support for the FanSHIM. That's still my main usage, even though I've switched to passive cooling.

OK now I think I understand why you have so much log entries about temperature and CPU load... Actually as I use it in my house to activate lights and monitor sensors and switches, I would be happy to have the temperature and load logged less frequently. Would you be ok to allow the heartbeat in Eve be set to up to an hour? this way the events happening in the night would still appear in the morning instead of being over written in the log file.

Still love the plugin though. I have ordered a new Pi 3 with more GPIO as mine is an old one with 26 pins only...