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

Siri wait a configurable amount of time before reporting back on Status? #84

Closed
simonlock opened this issue Jan 3, 2020 · 13 comments
Closed

Comments

@simonlock
Copy link

Backstory

Hi Alex
I'm using your plugin with Homebridge and also Nodered and everything is working well when I press the buttons within the Apple Home App, I can successfully shut down my win10 pc and also wake it up using WoL.

Issue

However, When I use Siri voice commands to turn on and shutdown my win10 pc Siri is far too quick to reply complaining:- "Sorry I didn't hear back from your devices"; this may be because my PC takes approximately 20s to both completely startup and completely shutdown. i.e receive and lose ping replies.
Although everything is working Siri is always complaining because Siri is out of sync.

Environment

  • os & os version: FreeNAS-11.2-U7 in a FreeBSD jail.
  • node version: Node.js v13.3.0
  • homebridge version: Version 0.4.50
  • homebridge-wol version: homebridge-wol v4.0.0

Configuration

My configuration looks like this:

{
            "accessory": "NetworkDevice",
            "name": "simon-pc",
            "mac": "<mac-address>",
            "broadcastAddress": "172.16.28.254",
            "wakeGraceTime": 30,
            "shutdownGraceTime": 45,
            "ip": "172.16.28.6",
            "shutdownCommand": "ssh simon@simon-pc shutdown /s /f /t 0"
        },

Notes

As you can see from my config above, I've been playing with the wakeGraceTime and shutdownGraceTime parameters in the hope that these parameters could fix the problem and slow down Siri from reporting back.; but this didn't work.

Is it possible to make Siri wait a configurable amount of time before reporting back on Status?

@AlexGustafsson
Copy link
Owner

There’s not much I can do about configuring Siri unfortunately. Can you try to set the grace times to zero? If Siri responds correctly, then I there’s a fix I can make in the plugin.

@simonlock
Copy link
Author

Thanks, Alex for your reply. Setting Grace times to zero improved things somewhat. Now Siri responds immediately saying the PC is On or Off. Siri is not replying with true status feedback but it's an improvement on than stating "Sorry I didn't hear back from your devices" every time a command is sent.

@AlexGustafsson
Copy link
Owner

Let's try something else. You'll have to edit the code for this. First, change back the config for the grace times to something reasonable.

In homebridge-wol/lib/network-device.js there's a function called async setOnline(newState, callback).

Remove all mentions to await in that function (should be line 123 and 127) so that they only say this.wake(); and this.shutdown(); respectively.

Then restart Homebridge and test again. This will make grace times work, but Siri may still respond with the incorrect status as the plugins returns the status before the computer has actually been turned on / off.

@dcaccount
Copy link

dcaccount commented Jan 6, 2020

Hello Alex,
I have a similar issue, always with following environment;

Environment
os & os version: Raspian Buster
node version: Node.js v11.15.0
homebridge version: Version 0.4.50
homebridge-wol version: homebridge-wol v4.0.0

Apple Home application is not reporting the status correctly. The plugin wakes and puts the server on sleep. I also tried to play with the parameters but with no luck.

To show the correct status I have to close and reopen Apple Home.

Please also note that Apple Home says that the accessory is not responded.

In the previous version everything was OK and the startup was perfectly reported.

Thanks for your time!
Dan

@AlexGustafsson
Copy link
Owner

@dcaccount Could you try the comment above yours? The one about removing await.

@dcaccount
Copy link

dcaccount commented Jan 7, 2020

@dcaccount Could you try the comment above yours? The one about removing await.

Hello Alex,
I have tried and it seems to have solved, I will try again on the next days and report, thanks!

By the way, how can I contact you for an "off topic" question on a plugin?

@simonlock
Copy link
Author

Hi Alex

I too have tried the changes that you suggested. However, my finding are different. Setting back:
"wakeGraceTime": 20,
"shutdownGraceTime": 20,
and these delays are still ignored and I receive successful status feedback immediately.

@dcaccount
Copy link

and these delays are still ignored and I receive successful status feedback immediately.

I did not try to set
"wakeGraceTime": 20,
"shutdownGraceTime": 20,
and as said by simonlock, I also receive successful status feedback immediately

@AlexGustafsson
Copy link
Owner

AlexGustafsson commented Jan 8, 2020

The grace time is not ignored per say, rather Siri replies immediately with the current status. Internally the times are still respected. Unfortunately we cannot have both since Siri seems to have a time-out of three seconds.

So either we have it the way it works now, with everything setup as intended but Siri replying that it’s not responding (the Home app works as intended). Or we change it to what you’ve tried and Siri replies with the wrong status and the app replies with the wrong status.

@dcaccount
Copy link

dcaccount commented Jan 8, 2020

So either we have it the way it works now, with everything setup as intended but Siri replying that it’s not responding (the Home app works as intended). Or we change it to what you’ve tried and Siri replies with the wrong status and the app replies with the wrong status.

It is not pleasant hearing Siri replying that is not responding. I would change to what we have tried....(at least leave the chance to choose)

@Glynnryan
Copy link

I’ve noticed this after the recent update. Not sure if it’s related, but since the last update, states don’t change to on or off. Logs show “Network device xxxxxxx (xxxxxxxxx) went from status “undefined” to “undefined”

@AlexGustafsson
Copy link
Owner

@Glynnryan That does not seem related. It does however seem as if you're running an old version of Node. The undefined comes from Symbol.description, a feature that was introduced in Node 11. Try to update your Node version and open up an issue if that does not help.

@AlexGustafsson
Copy link
Owner

Closing this. I'm mitigating the issue. Follow progress in #85. Feel free to open new issues if the arise.

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

No branches or pull requests

4 participants