lwitzani / homebridgeStatusWidget

MIT License
371 stars 143 forks source link

Widget not working /executed any more under iOS 16(.3?) #51

Open DannyBoyKN opened 1 year ago

DannyBoyKN commented 1 year ago

Hi, I just upgraded to iOS 16.3 but Homebridge Status is not working any more on home screens, it just remains empty:

If I run it from the Scriptable App it works. And also, all other Scriptable Widgets still work, well, except another one which also stays empty ... but the majority still work.

Do you know about such a behavior ? It's the same for for the tiny HB widget ...

lwitzani commented 1 year ago

Hi, i don‘t know since i did not update ios yet. My guess is that if it runs inside the scriptable app then it is fine and the problem is not with the script. Guess you need to wait until a scriptable update for 16.3 comes out or another ios update with a fix

DannyBoyKN commented 1 year ago

Mmmmh ... :disappointed: What is your Version ?

lwitzani commented 1 year ago

My version of ios? I‘m still on 16.1.1 😅😂

DannyBoyKN commented 1 year ago

Still, Otters like widget_pi-hole.js or PremiumSim.js or covid-19-7-day-incidence-county.js continue to work as widgets 😕

lwitzani commented 1 year ago

Yeah seems strange, but all i can say is, if the script works fine when executed in the Scriptable app itself, then i can‘t do anything

lwitzani commented 1 year ago

Did you try to remove the widget and readd it? I updated my iphone today to the latest 16.3 and everything works as before

DannyBoyKN commented 1 year ago

Yes, I did lots of removals and readds ...

What I do get is "request timeout" ! So "something" in my local LAN delays the widget script, but not the Scriptable App ? I've setup pihole and DNS crypting in my LAN, but still, the PiHole Status Widget (and others) work perfectly well ... ... and on my iPad with iPadOS 16.3 it works fine as well !?!? Why should it be an iOS 16.3 Problem just for that script ? Can I increase some timeout value in the script ?

lwitzani commented 1 year ago

Yeah you can totally do that, there is this line at around line 30


requestTimeoutInterval = 3; // in seconds; If requests take longer, the script is stopped. Increase it if it doesn't work or you

Increase the time, edit the following line (around line 12) from const overwritePersistedConfig = false; To const overwritePersistedConfig = true;

Then run the script once. If it worked change it back to false again and that should do it.

i also have pihole running in my network and everything works fine

DannyBoyKN commented 1 year ago

I did that but it doesn't help 😞

What I also observed now, while trying this and that, is even through the Scriptable App, right after unlocking the iPhone, I also do get the exception 'request timeout', with the increased timeout value it takes of course even longer until the message pops up ... so I don't believe increasing the timeout helps ... AND It's the same on my iPad with 16.3 ! The next tries through the Scriptable App are all fine, on both iPhone and iPad.

The widget however, on my iPad, works all but the first try after unlocking, too ! On the iPhone the widget just shows request timeout!

There's another observation through the Scriptable App: On the iPad it shows me one plugin (Homebridge-hue) is outdated, but node.js is up to date! On my iPhone however, it shows me the plugin (Homebridge-hue) AND node.js are BOTH outdated !?!

How can that be ? This is all very confusing and I do not really have a clue how to resolve or narrow it down to the cause ....

I really do appreciate your help Many thanks

lwitzani commented 1 year ago

That really seems like a crazy problem 🤣.

So if the devices point to the same homebridge instance then they should not show different states ^^! Please check your local hombridge-config-ui-x webpage directly and check what it says. It also shows the node js version and if there is an update. The widget only shows the data which this server provides.

Do you have some wifi enhancement device which could potentially decrease your network performance?

Just doesn’t make sense that it does not work after unlocking the phone^^. It just could be that it when you unlock the phone the script is maybe currently being executed and additionally you start your manual run. So it runs twice at the same time which could lead to some interference if two instances (on same device) are executed somehow

DannyBoyKN commented 1 year ago

So, I'm back after some testing and results:

I've removed the Scriptable App from my iPhone and reloaded it again from the AppStore. It works .... basically ... but ...

I still have the exception "request timeout" right after unlocking the iPhone. Pressing on the widget it opens the scriptable app and runs the script and everything is fine. With some delay the widget gets also updated correctly.

This I can repeat if I lock the iPhone and unlock again after some time (the widget keeps its state for awhile). Tapping on it it opens back again the scriptable app. The message pops up "exception: request timeout". Tapping again on the widget it works !

PS: There's this purple.json property "pluginsOrSwUpdatesToIgnore" where I set the node.js (NODEJS_UTD) not to be checked on my iPad. You remember ? That explains why the status widget showed up differently between iPhone and iPad. I set that long time ago to suppress notifications and forgot that 😕

lwitzani commented 1 year ago

Ok one more guess:

try to use different configuration files for different devices. E.g. Do not use purple.json at iphone and also at ipad but rather change the name on one device (e.g. at iphone rename it purpleIphone.json)

To achieve this: Edit the line let configurationFileName = 'purple.json' to whatever you want the name to be

then change again overwritePersistedConfig to true and run the script once, if it worked change it back to false

Maybe the timeout comes because the icloud sync of the same configuration across the devices is too slow

DannyBoyKN commented 1 year ago

This is a good point! However, iPhone and iPad don't use the same apple id so not using the same file on iCloud. But the problem must be linked to network sync'ing since it fails only after "first" unlocking iPhone (or iPad). I'll try to unlink the configuration from using iCloud at all. That's the difference to my other widgets which work out of the box...