ebaauw / homebridge-rpi

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

Fan Shim accessories non functional #159

Closed r2shyyou closed 1 year ago

r2shyyou commented 1 year ago

i have a Pimoroni Fanshim and the accessories created by configuring it have never been functional. i've created it and deleted it and recreated it multiple times but it's never worked. am i doing something g wrong? here's my config:

  "devices" : [
    {
      "device" : "blinkt",
      "gpioClock" : 14,
      "gpioData" : 15,
      "name" : "FanShim LED",
      "nLeds" : 1
    },
    {
      "device" : "button",
      "gpio" : 17,
      "name" : "FanShim Button"
    },
    {
      "device" : "switch",
      "gpio" : 18,
      "name" : "FanShim Fan"
    }
  ]

by non-functional, I mean whether the fan is spinning or not, the corresponding accessory does not change state

ebaauw commented 1 year ago

Please capture and attach a debug log file.

r2shyyou commented 1 year ago

Please capture and attach a debug log file.

homebridge.log.gz

ebaauw commented 1 year ago

You tried to run Homebridge for a second time, hence the EADDRINUSE error. Unfortunately that terminates Homebridge before Homebridge RPi has fully initialised, so I cannot see what's going on.

Is it just the fan that isn't updated? What about the button or the LED? Does the Pi's CPU temperature update? Can you control the power LED?

r2shyyou commented 1 year ago

You tried to run Homebridge for a second time, hence the EADDRINUSE error. Unfortunately that terminates Homebridge before Homebridge RPi has fully initialised, so I cannot see what's going on.

Is it just the fan that isn't updated? What about the button or the LED? Does the Pi's CPU temperature update? Can you control the power LED?

sorry for the delayed response. the fan functions but the button doesn't seem to do anything. same for the LED. the Pi's CPU temperature does indeed update but i cannot control the power LED.

i'll try to generate a new log file after rebooting the Pi, as i don't know what happened the last time that made Homebridge try to run a second time.

r2shyyou commented 1 year ago

@ebaauw new log file attached homebridge.log.gz

ebaauw commented 1 year ago

[30/03/2023, 18:28:14] Error: listen EADDRINUSE: address already in use :::51110

Looks like you're still trying to start Homebridge while it's already running. I don't see any interaction with the Fan SHIM. Also, please set Log Level on the RPi accessory to 2.

[30/03/2023, 18:28:30] [RPi] Pi Power LED: On: warning: set: FO (104): no permission to access file (-137)

Looks like the File Access for pigpio is missing, or maybe wrong (see https://github.com/ebaauw/homebridge-rpi/issues/157). On the local Pi, the LED state is read directly from the file, but changed through pigpio, since the file can only be written by root. Note to self: the need to configure access on local Pi is missing from the README.

r2shyyou commented 1 year ago

thanks for the update to the README. i confirm that after running the access command, i can now control the Pi's LED. the FanSHIM accessories, however, are still non-functional.

regarding running Homebridge twice, could the issue be that i’m generating the log file from the terminal within Homebridge? otherwise, i’m stumped.

r2shyyou commented 1 year ago

i'm thinking my problem with the log file might be:

If you're running Homebridge as a service, stop that service; Run Homebridge manually

unfortunately for me, i don't know how to a) tell if it's running as a service, b) stop the service, if it is indeed running as a service, and c) run it manually

ebaauw commented 1 year ago

That really depends on how you installed Homebridge. If you open a Terminal from the Homebridge UI, Homebridge is probably running.

In that case, better set DEBUG mode in the UI Homebridge settings, restart Homebridge and, after interacting with the Fan SHIM, attach the homebridge.log file from the Homebridge storage path (probably the directory where the Terminal window runs from).

r2shyyou commented 1 year ago

@ebaauw hopefully okay this time :)

homebridge.log

ebaauw commented 1 year ago

I don't think you set Log Level to 2? I don't see any interaction with the Fan SHIM? You want to turn on/off the fan and light, and press the button while Homebridge is running in DEBUG mode, and Log Level is set to 2.

r2shyyou commented 1 year ago

indeed i hadn't 🤦 how about now?

homebridge.log

ebaauw commented 1 year ago

[01/04/2023, 10:52:54] [RPi] warning: config.json: hosts[0]: logLevel: invalid key

As I mentioned above: you need to set the Log Level characteristic on the Pi accessory to 2, using Eve, or another decent HomeKit app.

I still don't seen any interaction with the Fan SHIM? Could you also interact with the power LED, just to be sure.

r2shyyou commented 1 year ago

thanks for clarifying. this should be better:

homebridge.log

ebaauw commented 1 year ago

That's much better, indeed.

From what I can tell from the log, the fan and LED should be working. Homebridge RPi sees the changes from HomeKit, sends the corresponding commands to pigpio, pigpio responds with a success status, and a notification of the new GPIO pin state (for the fan; the LED doesn't report back).

I don't see any button presses, but the log claims to have subscribed to the corresponding GPIO pin. Did you actually press the button?

In my experience, the fan of the Fan SHIM is a bit flaky; it's not powerful enough to overcome the friction, and sometimes doesn't start spinning when turned on. You might need to give it a little push to start it. I tried lubricating the fan with WD40 spray, that helped for a little while, but then the issue returned. I ended up using passive cooling. Also note that the LED will only turn on physically at 4% brightness (but that shouldn't be an issue, as the log suggests it is set to full brightness).

If the FanSHIM itself doesn't react to changes from HomeKit, you might want to double-check the physical installation: is it mounted on the correct pins, and does it make good contact? Is the cable connecting the fan to the SHIM inserted properly?

r2shyyou commented 1 year ago

thanks for your responses and especially your patience 😂

i agree that the Fan SHIM is a little flaky, i have indeed already needed to give it a push or two to start it. and no, i didn't press the button. the physical installation is correct, but the LED has never turned on regardless of what i do. maybe it's defective...

in any case, i have what i need for passive cooling but was curious and wanted to play around with the Fan SHIM accessories in HomeKit.

thanks again!

r2shyyou commented 1 year ago

@ebaauw i did some more digging and read about slightly bending the pins used by the Fan Shim and can confirm that after doing so, the LED finally comes on! :D still no interaction with HomeKit though :(

ebaauw commented 1 year ago

The LED is write-only; you cannot read the LED state, so HomeKit reflects the last state set through Homebridge RPi.

r2shyyou commented 1 year ago

nothing with the fan either though. strange, overall...

ebaauw commented 1 year ago

Did the LED come on while bending the pins? Then it's just some random noise that the FanSHIM interpreted as a command signal. Or did you manage to turn it on from HomeKit?

What do you mean "nothing with the fan either"? Did you turn on/off the fan outside of HomeKit and doesn't HomeKit reflect that? In that case, double check the log if Homebridge RPi receives the notification from pigpio, and refresh the Home app, to be sure. Or did you change the fan from HomeKit, and doesn't it turn on or off? We saw earlier in the log that Homebridge RPi sends the correct command to pigpio and that pigpio reported back that the GPIO pin had changed. So the issue is between the GPIO pins and the fan.

r2shyyou commented 1 year ago

indeed, the LED came on while bending the pins. i have not been able to control either the fan or the LED via HomeKit.

when i wrote "nothing with the fan either" i meant that the fan state was not reflected in Home.app, similar to the LED state not being read. i can "set" the fan state and/or LED state via Home.app but it's only visual; it has no effect on the actual device.

and regarding the log, it correctly reports all HomeKit interaction, it's just that nothing actually happens with the actual Fan SHIM.