Closed robosmith closed 1 year ago
Someone else has done some digging into the sling.service that I whipped together many moons ago. Apparently the "needs" was not sufficient and the server was getting started before the network was fully up. Grab the latest from the repository and give it a go. You may not need this code change. I can't test this myself, my Pi is a thousand miles away.
If it really is a PI, I know it's possible to install netifaces. When you run pip does it download the netifaces source and try to compile it? If so, try installing "wheel" first. You may also need to clear out the cache that pip uses to force it to not use the source it has already downloaded.
You could have also just changed the timeout from 2 to 20. The underlying TCP protocol will automatically do the retrying.
It really is a new Pi 4. I will try the new delay = 20. Since I have no need for netifaces, I prefer not to mess with trying to install it again. BTW, the Pi I'm using is 3000 miles away, but it's setup with DDNS and port forwarded it so I can WinSCP and Putty into it to make changes and reboot it.
Please give the new sling.service file a try. My Pi, in a box in a closet. :-(
Ok, I tried the settimeout delay of 20 and 200, but it fails on reboot. Used the new check_ip and it succeeds on iter 3.
Did you try the new sling,service file?
I've got a test version for you to try. Add this line to your config.ini in the [SLINGBOX] section.
Retries=n
where n is the number of retries you want before the code gives up. -1 means try forever
Each retry takes two seconds.
slingbox_server_bob.zip
This code will be in the next release.
@GerryDazoo We have not been able to make this new test version work yet.
Send me the copy of your config.ini and your server output. Other people have tested this and have it working.
I ran it with your test version, which fails to connect to either Pro-HD, and then with 308f with my check_ip function to show the slingboxes still accept a connection. I put Retries=10 in each name section of the config.ini for the test code and verified that is read for both slingboxes.
sling_308fwithmycheckip.log sling_newcheckiptest.log config.txt
My apologies. There was a bug in the version I sent you that I had subsequently had fixed and I forgot to inform you. Please use this one. There is one minor change Replace Retries with ConnectRetries in your ini file
Still having a problem with neither box connecting with g. When I substitute my check_ip, one box connects, but the other never tries.
Can you grab the server output for me. This "should" work. For debugging purposes you can change line 544 from if not cnt % 10 : print( name, 'Waiting for', sling_net_address ) to print( name, 'Waiting for', sling_net_address ) and you should see a log every ten seconds while it is trying to connect.
You did remember to changes Retries to ConnectRetries?
Also, in the latest code checkip is called with a second parameter, retry_count. Not sure how your "checkip" would even work without making that change.
If you still have issues maybe we can setup a zoom so we can have a short real-time consult.
Yes, I did insert ConnectRetries, and modified my check_ip function to incorporate and use the 2nd parameter. I also experimented with the print on every try, but not for g. I will try that again with g.
Testing g again, it seems that even though there are ConnectRetries entries in both box [name] sections, it's only picking up one. I added a [SLINGBOX] section with ConnectRetries, but that didn't work, either. Apparently the ConnectRetries for Bob being 0 keeps it from connecting. Not sure why the Rick box fails to connect.
Thanks for the logs. You config file looks OK but please delete the [SLINGBOX] section. THe is the line in the logs that is interesting Checking for slingbox at ('192.168.0.26', 5001) 0 Firstly it should say Bob just like it says Rick in the line above and the last zero as you notices should say 10. Also, the code is supposed to scan your network looking for slingboxes to use if it fails to connect. It's not doing that. Are the slingboxes turned on in this case? Can you confirm these logs are from the Pi reboot? Let me take your config out for a test drive. We'll get this working, sorry about how much time this is costing you.
Yes, I know the 0 should be a 10. That's why I put the [SLINGBOX} section in. The Bob is in there, but the multi-threading causes the text to be out of order. Yeah, the netifaces should take over after check_ip fails, but IDK why it's not except maybe cause the FINDER #is commented out. Yes the boxes are both on. After I ran that test, I immediately installed 308e with my check_ip and it worked as usual. Yes, complete reboot log.
Here's something we both missed in your config for [bob] ConnnectRetries=10
ConnectRetries does not have three "n"s.
So other than that, yes I think there a bug in the code. The software was only expecting one type of exception (timeout) when it was trrying to connect but in your case it's getting something else because your network isn't up. This causes it to run through all the iterations in a few milliseconds, well before the network comes up. I'll send some new code soon. I hope, our power is out and the generator is running. I expect the Internet connection to die soon.
try this slingbox_server_3.08g.zip
Still not getting connection. But it is trying for Bob. Sorry about that typo. sling308gTest3.log
I added a time.sleep(1) in the exception for check_ip and it connects. Yay! sling308gTest4.log
Good news. can you send me that code segment?
Here is g with modified (also print every cycle) check_ip: slingbox_server_308g2.py.txt
Not Funny thing. I'm in the middle of moving all my stuff to a new laptop. I had fixed this on my other laptop (where my email was still working) but forgot to update it on my new one. So I basically sent you the same file. Turns out your little sleep(1) was a much simpler solution than I had. THX,
When the Pi reboots, it can take some time before it finds the Slingbox at the IP in the Config.ini. Since I had trouble installing netifaces, I wrote a different check_ip function which tries to connect N times before giving up. It seems to always work from my testing, sometimes taking 4-5 trials before success.