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

Enable UI Elements when network attaches #44

Open
dadr opened this issue Sep 26, 2023 · 3 comments
Open

Enable UI Elements when network attaches #44

dadr opened this issue Sep 26, 2023 · 3 comments

Comments

@dadr
Copy link

dadr commented Sep 26, 2023

Often, I have to reboot (power cycle) the system several times before it connects to my WiFi and works. I noticed that when there is no network, the functions that depend on the network are greyed out. That makes sense. However, after going to the network configuration and getting it working, those functions are still greyed out. I have to reboot again before they become available, and sometimes this works and sometimes it does not. I think a good enhancement would be to re-enable the functions that rely on network once network is up so that a reboot is not necessary.

Also, I tried to be clever, and ssh to peppy, then do a `systemctl restart peppy'. I was thinking that this would be like a warm boot that would leave networking intact and restart the player. Sadly, that seems to do a shutdown instead.

@project-owner
Copy link
Owner

Right now the player makes 3 attempts (3 seconds each) to connect to the Google DNS server (8.8.8.8). If that fails it doesn't try to check a connection again:

Peppy/peppy.py

Line 335 in c4b5554

def check_internet_connectivity(self):

As far as I understand you are suggesting to continue checking network connection (e.g. every 10 sec, for how long? forever?) and enable modes on the Home screen whenever connection to the Internet appears. I think that should be doable.

The player executes the following command for reboot:

Peppy/peppy.py

Line 2901 in c4b5554

restart_command = "sudo systemctl restart peppy"

I'm not sure why it doesn't work when you run it from a terminal manually.

@dadr
Copy link
Author

dadr commented Sep 29, 2023

I think it would make sense to continue to check for network every few minutes. Also, it might make sense to check after the network config detects a newly administered connection (or cable plug-in).

If I change 8.8.8.8 to the IP on my BB gateway, will the network check also change to that IP? I think that's interesting, b/c having network at home is not the same as having Internet. I'm probably over-thinking it, but it seems that NAS could be available when Internet radio is not. (My BB gateway provides a DNS for the LAN based on the DHCP client IDs.)

@project-owner
Copy link
Owner

project-owner commented Sep 29, 2023

OK, I'll add a thread which will check the Internet connectivity every minute. It will enable/disable the modes in the Home menu accordingly. It will also report status to the log when a connection was dropped or re-enabled..

That connectivity checker depends on the IP which you define in this property:

dns.ip = 8.8.8.8

NAS can be used either for the 'Audio Files' or 'Collection' mode. These modes are enabled even if there is no connection to the Internet:
def get_disabled_modes(self):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants