-
Notifications
You must be signed in to change notification settings - Fork 464
connection dissapears?? #550
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
Comments
How did you start it the first time? You need to setup some sort of bootup script that starts it, and probably something that restarts it if there is some error with it. The easiest solution is by using pm2 which is a process manager, see #539 for an example. Or search "pm2" among closed issues. |
Hi Jishi thank you for your reply. I already did the pm2 but I keep getting the error. Everytime I need to manually give the command "pm2 startup" as super user. Otherwise the API isn't working, very strange.. ??? This is what I did this morning and now is everything back on: [Service] ExecStart=/usr/local/lib/node_modules/pm2/bin/pm2 resurrect [Install] Target path
sep 09 11:13:52 raspberrypi pm2[8984]: [PM2] Resurrecting [PM2] Remove init script via: |
I think I know what the problem is. I've a wallplug behind my stereo set, which kills the energy of sonos AMP when I don't use it for X hours. So the Sonos AMP is all turned off and not connected anymore to my network. After I turn on the wallplug Sonos AMP will connect again to the network through a network cable. But I think the API doesn't recognize the Sonos anymore. The reason I kill of my sonos AMP is it's uses much power in standby mode. Anyone had similar issues or knows a solution for this? |
It's unclear to me what the actual issue is? Is the One issue in the output you've pasted was that you started pm2 with the But if you could explain more in detail, what you actually observe (and what you expect to happen), I could be of more assistance. |
Hi Jishi, I just found out for sure what the problem is. Like I mentioned in my previous post the API/pm2 will turn off after my AMP is completely killed off. I mean that if I turn off the wallplug switch (so no electricity input anymore to the AMP) the pi wont recognize the AMP when the switch is turned on again. The pi isn't connected to the same wallplug switch, so the pi is always turned on but the AMP isn't. If I start again pm2 and keep my switch on, I don't have any problem. But due power usage I don't want the sonos "always on". Do you've any solution to auto-recognize the sonos amp after I turned it off? |
Where is your raspberry pi connected? I mean, the network cable? The API is supposed to survive loosing all of the players, it would fall back to start searching for them, indefinitely. I can't seem to reproduce the behavior you are seeing, so I need detailed information how everything is connected to figure out why it's behaving the way it does. When the AMP is powered on, does a reboot of your pi bring the API back up again? You should probably make sure that your auto startup actually works as you'd expect it to work. |
Hi Jishi, the amp aswell as the pi are connected by network cable through the same network switch to the router. The only difference is that the amp will turn off by the wallplug switch and the pi is always turned on.
This is what the PM2 is for right? I checked it out this morning see down under. +++++ I just checked the status of pm2 this morning after the wallplug is turned on again:
After I rebooted the pi it seems to be online again, check this out:
┌──────────┬──────┬────────┬───┬─────┬───────────┐
|
Okay, so it seems that PM2 is resurrecting the process correctly. It's not super-straightforward how to actually wire up PM2, hence the question. It sounds to me that pm2 is actually crashing/stopping when the process can't communicate with the AMP. My code actually deals with that (I tested it), but it do spam a lot of noise to the logs. It might be exhausted, and I can probably make it more silent. I'll see what I can do. |
The strange thing is that I'm almost sure it worked 2 weeks straight forward. I know for sure that the AMP is turned on/off with the wallplug and still worked. Do you know how to remove cleanly both the API and the pm2? I want to reinstall it as Superuser and see if anything will change. |
One explanation might be the excessive logging issue, where pm2 crashes because it can't log anything more (filled up disk space, basically). It might make sense to disable logging completely, to save your SD-card, see Unitech/pm2#2997 Removing the api is just deleting the folder you created for it (where you unzipped or git cloned).
(since you have started it both as pi user and root user, it has created one folder in each $HOME directory) |
Actually, that is basically the issue, I see this in your first post: Should have read more carefully! 😄 |
You were right! I checked the data usage by "NCDU" and the dump folder of the pm2 logs was 1.8GB, now I deleted it and everything is working fine for now. Tonight I will turn off the wallplug and check if the API is still working tomorrow. Keep you updated! |
Crashed again this morning, unless I reboot the pi the ha-bridge isn't working. If i check the logs i get this: pi@raspberrypi:~ $ tail -f /var/log/syslog Are you familiar with this @jishi? |
That log doesn't contain anything of interest. I don't think pm2 logs
anything to syslog, it would be in /root/.pm2/logs if you run pm2 as root
…On Oct 22, 2017 13:32, "pnutp0wer" ***@***.***> wrote:
Crashed again this morning, unless I reboot the pi the ha-bridge isn't
working. If i check the logs i get this:
***@***.***:~ $ tail -f /var/log/syslog
Oct 22 08:17:01 raspberrypi CRON[24758]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 09:17:01 raspberrypi CRON[24781]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 10:17:01 raspberrypi CRON[24799]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 11:17:01 raspberrypi CRON[24823]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 12:17:01 raspberrypi CRON[24847]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 12:35:52 raspberrypi systemd[1]: Starting Cleanup of Temporary
Directories...
Oct 22 12:35:52 raspberrypi systemd[1]: Started Cleanup of Temporary
Directories.
Oct 22 13:17:01 raspberrypi CRON[24871]: (root) CMD ( cd / && run-parts
--report /etc/cron.hourly)
Oct 22 13:26:03 raspberrypi systemd[1]: Started Session c4 of user pi.
Oct 22 13:27:42 raspberrypi systemd[1]: Started Session c5 of user pi.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#550 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADBNI7gD6fbBdJisHa2aV8QorUE2kJq3ks5suyfmgaJpZM4PJU7A>
.
|
I think it's the memory again, if I check upon this..
|
I also can't access the Pi anymore on it's own screen? Normally I do everything by using terminal (mac) but if I attach my keyboard and mouse to the pi and reboot it, I only get the rainbow screen and then nothing anymore..... |
Hi all,
I am using since 2 weeks the api through my RPi. But since yesterday the api isn't working properly.
If I check on the http://IP-ADRESS:5005/living/play I get a blank page.
Then if I login the pi through ssh and give the command "npm start" i get the following:
pi@raspberrypi:~ $ npm start
npm ERR! Error: ENOENT: no such file or directory, open '/home/pi/package.json'
npm ERR! at Error (native)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues
npm ERR! System Linux 4.9.43-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /home/pi
npm ERR! node -v v4.8.2
npm ERR! npm -v 1.4.21
npm ERR! path /home/pi/package.json
npm ERR! syscall open
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! nospc ENOSPC: no space left on device, write
npm ERR! nospc This is most likely not a problem with npm itself
npm ERR! nospc and is related to insufficient space on your system.
npm ERR! System Linux 4.9.43-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /home/pi
npm ERR! node -v v4.8.2
npm ERR! npm -v 1.4.21
npm ERR! syscall write
npm ERR! code ENOSPC
npm ERR! errno -28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/npm-debug.log
npm ERR! not ok code 0
I saw this issue #112.
When I first do: cd node-sonos-http-api and then do npm start I get the following:
pi@raspberrypi:~ $ cd node-sonos-http-api
pi@raspberrypi:~/node-sonos-http-api $ npm start
2017-08-31T19:51:57.387Z INFO Could not find file /home/pi/node-sonos-http-api/settings.json
2017-08-31T19:51:59.433Z INFO Presets loaded: { example:
{ players:
[ { roomName: 'Bathroom', volume: 10 },
{ roomName: 'Kitchen', volume: 10 },
{ roomName: 'Office', volume: 10 },
{ roomName: 'Bedroom', volume: 10 },
{ roomName: 'TV Room', volume: 15 } ],
playMode: { shuffle: true, repeat: 'all', crossfade: false },
pauseOthers: false,
favorite: 'My example favorite' } }
2017-08-31T19:52:00.606Z INFO http server listening on port 5005
Now the API is working, but if I close the terminal the API isn't working anymore after several minutes th and I get a blank page?!
I checked the other issues but couldn't find anything similar..
The text was updated successfully, but these errors were encountered: