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

Ping results in switch state stuck "on" #19

Open
patrickhpan opened this issue Sep 28, 2020 · 3 comments
Open

Ping results in switch state stuck "on" #19

patrickhpan opened this issue Sep 28, 2020 · 3 comments
Labels
question Further information is requested

Comments

@patrickhpan
Copy link

The ping method updates the internal state to !error each time the device pings, resulting in the state being constantly set to "on". Thus, when HomeKit gets the device state, it always sees "on", even if the device is switched off. Due to internal checks on only setting device state if the new state is different, only attempting to turn off the device will work at that point, even if the device is already off.

this.updateState(!error);

@zizi4n5
Copy link
Owner

zizi4n5 commented Oct 3, 2020

The ping option will not work properly for devices that ping successfully when the device is powered off.
Therefore, do not set the ping option in such a case.

If the ping succeeds, !error is true, so state will be on.
If the ping is fails, !error is false, so state will be off.

@joslau
Copy link

joslau commented Oct 27, 2020

I have same issue using bot w/o hub,
but i ping 192.168.0.1 (non-existent IP) to get the state to off.

@zizi4n5
Copy link
Owner

zizi4n5 commented Nov 21, 2020

Could it be the same problem as the following?
#20

The ping option is only available if you can use ping to determine whether a device is on or off.
Set the ipAddress of the target device, not "127.0.0.1".

Otherwise, remove the ping option.

@zizi4n5 zizi4n5 added the question Further information is requested label Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants