Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot spawn vcgencmd yet getting temp updates #28

Closed
Jafalex opened this issue May 16, 2020 · 12 comments
Closed

Cannot spawn vcgencmd yet getting temp updates #28

Jafalex opened this issue May 16, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@Jafalex
Copy link

Jafalex commented May 16, 2020

Thanks for this new update, it's very neat!

I'm getting this warning in the server logs and can't figure it out, maybe you have an idea?
pi4: warning: vcgencmd: cannot spawn vcgencmd: ENOENT

Yet, I'm getting the updated temperature in the Home tile, which doesn't make sense?

I also have 2 pis and only one has the issue. I've followed the same update instructions from release 1.1.1 for both pis.

Also, for anyone running Homebridge in Docker, you need to follow the v.1.1.1 update instructions for the remote remote configuration, even if it runs locally. I had a bunch of errors that were resolved once I reinstated Remote GPIO and /opt/pigpio/access

Thanks in advance (also thanks for adding the ability to hide the temp/cpu updates in the logs #20 )

@ebaauw
Copy link
Owner

ebaauw commented May 16, 2020

I'm getting this warning in the server logs and can't figure it out, maybe you have an idea?
pi4: warning: vcgencmd: cannot spawn vcgencmd: ENOENT

ENOENT generally means: "no such file or directory". Are you running Homebridge natively on a Raspberry Pi? What does rpi info report? Note that the user running Homebridge must be in the video group to run vcgencmd.

Yet, I'm getting the updated temperature in the Home tile, which doesn't make sense?

Do you get the warning every 15 seconds (or whatever you've set Heartrate to), or only intermittently? Homebridge RPi will return the previously cached values if it cannot refresh them.

I also have 2 pis and only one has the issue. I've followed the same update instructions from release 1.1.1 for both pis.

What's your setup? Do you run Homebridge on each Pi, or do you access one remotely?

Also, for anyone running Homebridge in Docker, you need to follow the v.1.1.1 update instructions for the remote remote configuration, even if it runs locally.

RTFM:

If you run Homebridge in a container on the Raspberry Pi, let Homebridge RPi connect remotely to (the pigpiod daemon running on) the host. Do not try to run pigpiod in the container.

EDIT I've added this text to the release notes and the Installation section.

@ebaauw
Copy link
Owner

ebaauw commented May 16, 2020

Homebridge RPi detects whether a configured host is the local Pi, by comparing the serial number from the pigpio service against the serial number from /proc/cpuinfo. Does the container provide access to /proc/cpuinfo? That would confuse Homebridge RPi.

Could you try, in the container:

  • rpi -D info
  • rpi -D -H localhost info
  • rpi -D -H host-address info

I have no experience running Docker at home. Do you know how I can detect from Javascript that I'm running in a container?

ebaauw added a commit that referenced this issue May 16, 2020
- Check for empty config.json no longer needed, as Homebridge no longer calls constructor for dynamic platform plugins not listed in config.json.
- Better `localhost` handling, see #28.
ebaauw added a commit that referenced this issue May 16, 2020
Check if `localhost` is running inside a container, see #28.
@ebaauw
Copy link
Owner

ebaauw commented May 16, 2020

Could you try v1.1.2-0? Install through sudo npm -g i homebridge-rpi@beta.

This version should detect whether it's running inside a container. I don't run Docker myself, so cannot test it. Could you run homebridge -D and check for a debug message:

localhost: running inside a container

Also, the localhost message should no longer appear after the Raspberry Pi message.

@Jafalex
Copy link
Author

Jafalex commented May 16, 2020

I first joined this project on v0.0.5 and have had no issues in the past, so I came to the conclusion my set up was OK, but I could be wrong of course.

I have two RPis, one runs Homebridge inside Docker, the other is on the same Lan and has nothing to do with Homebridge, it's solely used as my home vpn, to access home from the outside.

What does rpi info report?

I believe I cannot run that command due to using Docker. So unfortunately I don't think I can run any rpi commands.

Do you get the warning every 15 seconds

Yep, regularly at the heartbeat.

RTFM

I swear I did, but I may have skipped the prerequisites section this time around 😬

Does the container provide access to /proc/cpuinfo?

Well, I can see the updates below in the logs (pivpn is the Raspberry Pi that shows no issue, pi4 is the one with vcgencmd warnings), so I assume it does:

[5/16/2020, 10:47:34 PM] [RPi] pivpn: set Current Temperature from 40.1°C to 39.5°C
[5/16/2020, 10:47:34 PM] [RPi] pivpn: set Load from 0.14 to 0.19
[5/16/2020, 10:47:49 PM] [RPi] pi4: warning: vcgencmd: cannot spawn vcgencmd: ENOENT
[5/16/2020, 10:47:49 PM] [RPi] pivpn: set Current Temperature from 39.5°C to 40.1°C
[5/16/2020, 10:47:49 PM] [RPi] pivpn: set Load from 0.19 to 0.29
[5/16/2020, 10:48:04 PM] [RPi] pi4: warning: vcgencmd: cannot spawn vcgencmd: ENOENT
[5/16/2020, 10:48:04 PM] [RPi] pivpn: set Load from 0.29 to 0.23
[5/16/2020, 10:48:19 PM] [RPi] pi4: warning: vcgencmd: cannot spawn vcgencmd: ENOENT
[5/16/2020, 10:48:19 PM] [RPi] pivpn: set Current Temperature from 40.1°C to 39.5°C
[5/16/2020, 10:48:19 PM] [RPi] pivpn: set Load from 0.23 to 0.18

It's just plain weird that I can see the temperature of pi4 in the Home app though.

Finally fwiw, running pigs -a fr 0 1024 on pi4 returns

243 {"date":"2020-05-16T06:46:35+00:00","boot": "2020-05-16 07:25:08","load":" 18:46:35 up 11:21, 2 users, load average: 0.48, 0.49, 0.71","temp":"temp=37.0'C","freq":"frequency(48)=1500398464","volt":"volt=0.8438V","throttled":"throttled=0x0"}

So everything seems configured as expected...

Do you know how I can detect from Javascript that I'm running in a container?

I'm afraid I'm not going to be able to help here.

I might try and "start fresh" tomorrow. I imagine that deleting the plugin from Homebridge and doing all the installation steps backwards is all I need to clean things up...?

Once again, I really appreciate your time helping here. I'll also try and find a way to run rpi -D from the container.

@Jafalex
Copy link
Author

Jafalex commented May 16, 2020

Could you try v1.1.2-0? Install through sudo npm -g i homebridge-rpi@beta.

You're really going to hate Docker by now, but I promise it's really awesome!

You don't install plugins using the CLI when running Homebridge containerised, but instead only through the GUI, in my case the notorious Homebridge config UI X.

This one might be too hard to try and figure out, it's a shame because I really enjoyed using this great plugin. Maybe someone else will be able to chip in in the future... Thanks Erik.

@Jafalex
Copy link
Author

Jafalex commented May 16, 2020

ps: turns out Home doesn't keep updating the temperature of pi4 it's just stuck to its last known temp, and isn't varying from there.

pigs -a fr 0 1024 shows a different (and updated) temperature every time I run it, differing from what's shown in Home (which is stuck to 34deg).

@ebaauw
Copy link
Owner

ebaauw commented May 16, 2020

Ok, thanks for the info. I think it paints a clear picture:

  • pivpn works as remote Pi, as intended;
  • pi4 is seen as the local Pi, but the vcgencmd isn't available in the container.
  • Looks like you did the correct configuration on the host, but Homebridge RPi simply doesn't connect to it. It doesn't yet realise that it's running inside a container, probably because /proc/cpuinfo reports the regular Raspberry Pi stuff, including the Pi's serial number.

On startup, Homebridge RPi:

  • Reads the local /proc/cpuinfo for the serial number of the local host;
  • Connects to the pigpio server of the host mentioned in config.json;
  • Retrieves the host's /proc/cpuinfo through pigpio;
  • Compares the serial number of the host against the locally obtained serial number. If they match, the host is accessed locally.

I first joined this project on v0.0.5 and have had no issues in the past, so I came to the conclusion my set up was OK, but I could be wrong of course.

Yeah, until I had to introduce some breaking changes...

I believe I cannot run that command due to using Docker. So unfortunately I don't think I can run any rpi commands.

You should be able to run them from the Terminal in Homebridge Config UI X. Same for the manual install command.

I swear I did, but I may have skipped the prerequisites section this time around

I added the text to the release notes and to the Installation section, so it's not so easy to overlook.

Do you know how I can detect from Javascript that I'm running in a container?

I'm afraid I'm not going to be able to help here.

Found something on stackexchange.com, but cannot test this myself. Hence the beta version. It doesn't seem to break my (non-container) installations, so I'll push it as full version, so you can update from Config UI X.

@ebaauw
Copy link
Owner

ebaauw commented May 17, 2020

Could you try v1.1.3?

@ebaauw ebaauw added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels May 17, 2020
@Jafalex
Copy link
Author

Jafalex commented May 17, 2020

Could you try v1.1.3?

Hi. I got straight to v1.1.4 by the time I got your comment. On first reboot this is the output of hb-rpi:

[5/18/2020, 9:20:31 AM] [RPi] pi4: connected to 192.168.8.25:8888
[5/18/2020, 9:20:31 AM] [RPi] pivpn: connected to 192.168.8.23:8888
[5/18/2020, 9:20:31 AM] [RPi] pi4: Raspberry Pi 4B v1.2 (BCM2711, 4GB) - 100009AF01***
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Serial Number to "10009AF01***"
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Manufacturer to "Sony UK"
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Model to "Raspberry Pi 4B"
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Hardware Revision to "1.2"
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Temperature Display Units to 0
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Heartrate to 15 seconds
[5/18/2020, 9:20:31 AM] [RPi] pi4: set Log Level to 2
[5/18/2020, 9:20:31 AM] [RPi] pivpn: Raspberry Pi 2B v1.1 (BCM2836, 1GB) - 0000AD8E4***
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Serial Number to "0000AD8E4***"
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Manufacturer to "Sony UK"
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Model to "Raspberry Pi 2B"
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Hardware Revision to "1.1"
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Temperature Display Units to 0
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Heartrate to 15 seconds
[5/18/2020, 9:20:31 AM] [RPi] pivpn: set Log Level to 2
[5/18/2020, 9:20:31 AM] [RPi] pi4: warning: file handle !== 0
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Current Temperature to 32°C
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Frequency to 1500MHz
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Voltage to 0.8438V
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Throttled to false
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Under Voltage to false
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Load to 0.58
[5/18/2020, 9:20:32 AM] [RPi] pi4: set Last Boot to "Sat May 16 2020 07:25:08"
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Current Temperature to 35.8°C
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Frequency to 600MHz
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Voltage to 1.2V
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Throttled to true
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Under Voltage to true
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Load to 0.14
[5/18/2020, 9:20:32 AM] [RPi] pivpn: set Last Boot to "Tue Apr 28 2020 22:13:53"

Now I don't get the ENOENT warning I used to get but I now get the following regular updates:
[5/18/2020, 9:21:31 AM] [RPi] pi4: warning: file handle !== 0
[5/18/2020, 9:21:31 AM] [RPi] pi4: set Current Temperature from 31°C to 32°C
[5/18/2020, 9:21:31 AM] [RPi] pi4: set Frequency from 750MHz to 1500MHz
[5/18/2020, 9:21:31 AM] [RPi] pi4: set Load from 0.63 to 0.61
[5/18/2020, 9:21:31 AM] [RPi] pivpn: set Current Temperature from 35.8°C to 36.3°C
[5/18/2020, 9:21:31 AM] [RPi] pivpn: set Load from 0.1 to 0.15
[5/18/2020, 9:21:46 AM] [RPi] pi4: warning: file handle !== 0
[5/18/2020, 9:21:46 AM] [RPi] pi4: set Frequency from 1500MHz to 750MHz
[5/18/2020, 9:21:46 AM] [RPi] pi4: set Load from 0.61 to 0.64
[5/18/2020, 9:21:46 AM] [RPi] pivpn: set Load from 0.15 to 0.25
etc.

The Home tile of Pi4 gets its updates again, so that works now, very well done! I'm not sure what the warning indicates, a file left opened maybe?

Edit: Today I found out Sony UK manufactures Raspberry pis.

@ebaauw
Copy link
Owner

ebaauw commented May 18, 2020

I'm not sure what the warning indicates, a file left opened maybe?

I does mean another file handle is open. That could be valid if you have another pigpio client running. It could also indicate a stale handle by Homebridge RPi. You can close all handles through rpi -H pi4 closeHandles. Or also, of course, by restarting the pigpiod service.

@ebaauw ebaauw closed this as completed May 18, 2020
@Jafalex
Copy link
Author

Jafalex commented May 18, 2020

I didn't even have to confirm the issue was fixed, you knew already 😉

restarted pigpiod and we're in happy world.
Impressive work, thanks again, hopefully it will make it easier for others as well.

@ebaauw
Copy link
Owner

ebaauw commented May 18, 2020

I didn't even have to confirm the issue was fixed, you knew already 😉

Sorry, I closed the issue, because the original problem with vcgencmd was solved, as per the log in your post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants