AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

Switch turns on then back off #53

Closed bobisaperson1 closed 4 years ago

bobisaperson1 commented 5 years ago

Backstory

just playing around with homebridge and had a sudden thought if i could use it for wol so i found this.

Issue

when I "turn on" my computer it turn itself off agian without actualy turning on my computer

Environment

Configuration

My configuration looks like this:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",
    "platforms": [
        {
            "platform": "yeelight",
            "name": "Yeelight",
            "transitions": {
                "power": 400,
                "brightness": 400
            },
            "multicast": {
                "interface": "0.0.0.0"
            }
        }
    ],
    "accessories": [
        {
            "accessory": "NetworkDevice",
            "name": "Computer",
            "mac": "<mac-address>",
            "ip": "10.10.0.52",
            "pingInterval": 45,
            "wakeGraceTime": 1
        },
   {
    "accessory": "WinPC",
    "name": "My Windows PC",
    "http_method": "GET",
    "on_url": "wol://<mac-address>?ip=10.0.0.52",
    "off_url": "http://10.0.0.52:8000/?action=System.hibernate",
    "status_url": "http://10.0.0.52:8000/",
    "sendimmediately": "yes",
    "poll_status_interval": "1",
    "username" : "User",
    "password" : "password",
    "powerstateOnError" : "0",
    "powerstateOnConnect" : "1"             
   }

    ]
}

Log

When I follow these steps:

  1. Run DEBUG=* homebridge
  2. Let it run for five minutes
  3. Tap a switch
  4. Wait one minute
  5. Tap the same switch

I get the following log:

(node:3773) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
HAP Warning: Characteristic 00000054-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway.
  EventedHTTPServer Server listening on port 51826 +0ms
  EventedHTTPServer [::ffff:10.0.0.24] New connection from client +1s
  EventedHTTPServer [::ffff:10.0.0.24] HTTP server listening on port 42155 +2ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP request: /pair-verify +23ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +2ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 1/2 +18ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP Response is finished +55ms
  EventedHTTPServer [::ffff:10.0.0.11] New connection from client +3ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP server listening on port 45415 +1ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /pair-verify +7ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +1ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 1/2 +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +19ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP request: /pair-verify +4ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +0ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 2/2 +4ms
  HAPServer [CC:22:3D:E3:CE:30] Client C681727E-6418-45DB-823C-FC5261D48A88 verification complete +9ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP Response is finished +1ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP request: /accessories +17ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /accessories +1ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP Response is finished +6ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /pair-verify +1ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +0ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 2/2 +1ms
  HAPServer [CC:22:3D:E3:CE:30] Client C681727E-6418-45DB-823C-FC5261D48A88 verification complete +7ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +1ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /accessories +104ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /accessories +1ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +3ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP request: /characteristics +293ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":12,"iid":10,"ev":true}] +7ms
  Accessory [Homebridge] Registering Characteristic "On" for events +5ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP Response is finished +4ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP request: /characteristics +12ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":14,"iid":10,"ev":true}] +2ms
  Accessory [Homebridge] Registering Characteristic "On" for events +1ms
  EventedHTTPServer [::ffff:10.0.0.24] HTTP Response is finished +3ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +130ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +0ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":14,"iid":10,"ev":true}] +2ms
  Accessory [Homebridge] Registering Characteristic "On" for events +0ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +3ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +12ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":12,"iid":10,"ev":true}] +2ms
  Accessory [Homebridge] Registering Characteristic "On" for events +1ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +15ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":12,"iid":10,"ev":true}] +2ms
  Accessory [Homebridge] Registering Characteristic "On" for events +1ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +11ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":14,"iid":10,"ev":true}] +2ms
  Accessory [Homebridge] Registering Characteristic "On" for events +0ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics?id=14.10,12.10 +27s
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /characteristics?id=14.10,12.10 +1ms
  Accessory [Homebridge] Getting value for Characteristic "On" +11ms
  Accessory [Homebridge] Got Characteristic "On" value: false +5ms
  Accessory [Homebridge] Getting value for Characteristic "On" +2ms
  Accessory [Homebridge] Got Characteristic "On" value: false +3s
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +5ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics?id=14.10,12.10 +4m
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /characteristics?id=14.10,12.10 +1ms
  Accessory [Homebridge] Getting value for Characteristic "On" +2ms
  Accessory [Homebridge] Got Characteristic "On" value: false +1ms
  Accessory [Homebridge] Getting value for Characteristic "On" +0ms
  Accessory [Homebridge] Got Characteristic "On" value: false +3s
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +6s
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +0ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":14,"iid":10,"value":1}] +3ms
  Accessory [Homebridge] Setting Characteristic "On" to value 1 +1ms
  EventedHTTPServer [::ffff:10.0.0.24] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":true}]} +18ms
  EventedHTTPServer [::ffff:10.0.0.11] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":true}]} +5ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +17ms
  EventedHTTPServer [::ffff:10.0.0.11] Writing pending HTTP event data +1ms
  EventedHTTPServer [::ffff:10.0.0.24] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":false}]} +2s
  EventedHTTPServer [::ffff:10.0.0.11] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":false}]} +6ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics?id=14.10,12.10 +2m
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /characteristics?id=14.10,12.10 +1ms
  Accessory [Homebridge] Getting value for Characteristic "On" +2ms
  Accessory [Homebridge] Got Characteristic "On" value: false +0ms
  Accessory [Homebridge] Getting value for Characteristic "On" +1ms
  Accessory [Homebridge] Got Characteristic "On" value: false +3s
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP request: /characteristics +921ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":14,"iid":10,"value":1}] +2ms
  Accessory [Homebridge] Setting Characteristic "On" to value 1 +1ms
  EventedHTTPServer [::ffff:10.0.0.24] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":true}]} +6ms
  EventedHTTPServer [::ffff:10.0.0.11] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":true}]} +5ms
  EventedHTTPServer [::ffff:10.0.0.11] HTTP Response is finished +9ms
  EventedHTTPServer [::ffff:10.0.0.11] Writing pending HTTP event data +1ms
  EventedHTTPServer [::ffff:10.0.0.24] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value":false}]} +2s
  EventedHTTPServer [::ffff:10.0.0.11] Sending HTTP event '14.10' with data: {"characteristics":[{"aid":14,"iid":10,"value"

Notes

Please write about things that you did not see fit the above headers.

AlexGustafsson commented 5 years ago

It could be the fact that you seem to have two plugins for WoL, try either WinPC or homebridge-wol and see if the issue persists.

bobisaperson1 commented 5 years ago

I tried and it didn’t help.

AlexGustafsson commented 5 years ago

Could you go through the debugging steps with debugging in homebridge-wol enabled? There should be an option mentioned in the readme for further logging.

In your output I couldn’t see any issue, but you didn’t seem to turn anything on or off, also try flicking a switch during debugging and post the result.

Kopertje commented 5 years ago

I got the same issue as OP. When i have send the action to shut down a Windows 10 PC, when its shutdown, the button in my HomeKit goes back to "on".

bobisaperson1 commented 5 years ago

Yeah I trouble shooted (mind the grammar) and worked out the magic packets weren’t even reaching my computer.

AlexGustafsson commented 5 years ago

@koportje Could you follow the debug steps so that I can follow the exact flow on homebridge?

AlexGustafsson commented 4 years ago

Closing due to inactivity.