rtyle/wake-on-lan

Not showing in SmartApps

Closed this issue · 22 comments

After adding your repo into the SmartThings IDE, I don't see it when trying to add a SmartApp.

rtyle commented

Are you using the same Account and Location in both the Phone App and the IDE?
Have you Published the SmartApp from the IDE?
I just checked mine and it looks OK.
That is,

  • In the App, when I hit + in SmartApps, the Add SmartApp page lists it.
  • In the App, when I turn on the virtual switch that an instance of this SmartApp is configured to listen to, the configured TV turns on.

Yes, it's the same account that the Homebridge SmartApp is installed with and yes, the SmartApp is published in the IDE.

Here's a screenshot of the IDE page:
wol

Here's a screenshot of the custom apps available to me when I try to add a SmartApp
unnamed

rtyle commented

Here's a screenshot of the IDE page:
wol

Why is OAuth "True"?

Ah, I don't know why I assume it needed to be on. I just deleted the entry in the IDE and configured it again without the OAuth being enabled, but it's still not showing in the SmartApps list. Am I missing something?

So when I remove OAuth, I get this now when I try to add your repo in the IDE: "You don't have access to rtyle/wake-on-lan"

EDIT: Reconnecting my connection from the IDE to Github seemed to allow access to your repo. I can see it now!

Sorry to keep spamming you here; The switch shows up but it's "Not Responding". It doesn't seem to do anything when the switch is activated. I set it up with the TVs MAC address but there's nowhere to put the TVs IP address. Does it know what device to send the packet to?

rtyle commented

The Wake on LAN SmartApp instance will log a "WoL" debug message when it hears that its switch turned on.
It will then send the magic packet to the configured layer 2 ethernet address.

In the SmartThings IDE, you can look at "Live Logging" to see this message.

https://en.wikipedia.org/wiki/Wake-on-LAN

The magic packet is sent on the data link layer (layer 2 in the OSI model) and when sent, is broadcast to all attached devices on a given network, using the network broadcast address; the IP-address (layer 3 in the OSI model) is not used.

Ah, right. Got it.

Looking at the Live Logging in the IDE, when I tap the switch, no logs show up. The Magic Packet isn't making it to the TV for some reason.

rtyle commented

Always make sure when you are using the IDE that you first select your Location.
If not selected, logs won't show.
To make sure, try to make some of your other devices/smartapps log.

Yeah, I see my Homebridge logging and my iPhone logging there.

rtyle commented

If you aren't seeing "WoL" debug messages in the log from the SmartApp then the SmartApp is not being triggered.
It will not ask your hub to send a WoL packet on the hub's LAN until it is triggered.

Yeah, I am not seeing any "WoL" debug messages in the logs. I guess I'm confused on exactly how it gets triggered.

rtyle commented

Have you looked at the source?
https://github.com/rtyle/wake-on-lan/blob/master/smartapps/rtyle/wake-on-lan.src/wake-on-lan.groovy
It is very simple.
It subscribes for "switch.on" events from the configured triggerSwitch.
triggerSwitchOnHandler is called when such occurs.
It logs and sends a command to your hub instructing it to send a "wake on lan $targetMacAddress" where targetMacAddress is what you have configured it to be.
If configured correctly, there is not much that can go wrong.
I suspect that you do not have it or the triggerSwitch configured correctly.

Yeah, sorry. I guess I meant if there was anything else I should be doing on my end to trigger it. I'm now seeing it in the debug logs. I have two other TVs setup with SmartApp triggers but Homekit hasn't recognized those switches yet.

rtyle commented

I'm now seeing it in the debug logs.

Good.
Then your hub was told to send the WoL packet (see code).
My hub is v2.
Can you see the WoL packet on the hub's LAN (using a packet sniffer like wireshark)?

I'll check wireshark and see. Is there a way to set multiple switches? I have 3 TVs I'd like to keep alive so my automations still work. I have 3 devices in the SmartApps list now but only 1 switch is showing up in Homebridge/Homekit:

WOL2

rtyle commented

Homebridge/Homekit

Maybe this is at the root of your problem.
Is the triggerSwitch a HomeKit one reached through HomeBridge?
If so, please, first get it to work with a native SmartThings switch (preferably a virtual one).
Once that is working reliably, any difference in performance with a HomeKit switch is a HomeKit/HomeBridge problem.
I am sorry, but I can't help you with HomeKit problems.

Switches in Homebridge work and also in Homekit. That's not the issue. I have my HVAC and other switches set up in Homebridge that are working in Homekit currently, so that's not it. Homekit just pulls from Homebridge.

When I set up the first initial switch using your plugin here, I was able to see it in Homebridge (and then obviously Homekit) but the other two seen above haven't even shown up in Homebridge. I'm unsure of what the difference is.

The reason I even mentioned Homebridge/Homekit was just to say that the other two switches I set up for WoL haven't shown up in there from the SmartApps.

rtyle commented

Please, humor me.
Try it with a SmartThings virtual switch.
I will try to address your problems if that fails.

rtyle commented

Which SmartThings hub do you have?

I actually don't have a SmartThings hub. My SmartThings app says I have a "virtual hub", which I assume is the IDE? My SmartThings IDE pushes devices to Homebridge and that pushes devices to Homekit (which is irrelevant here at the moment). The "switches" inside of the SmartThings app that turns the TVs on/off work when they're reading the TVs as "online", but sometimes the SmartThings app reads them as "offline" and "unreachable", which is what sent me looking for a wake-on-lan solution in the first place. I kept reading that the Q-series TVs go into a deep sleep and it turns the NICs off.

I thought if I could just have a Magic Packet sent to the TVs every so often, they would always be seen as "online" by the SmartThings app and then always discoverable by Homebridge.

rtyle commented

https://github.com/rtyle/wake-on-lan

Use any SmartThings switch (including a virtual one) to wake up a device on the LAN of your SmartThings hub.

You need a SmartThings hub.
This SmartApp needs an agent on the LAN of the target WoL device to send the WoL packet to it.
This is the SmartThings hub.
This SmartApp asks its agent (your SmartThings hub) to do this with sendHubCommand (see code).
Who knows what your virtual hub will do with this.
Apparently, not surprisingly, nothing.
Your complaint is with your virtual hub.


I thought if I could just have a Magic Packet sent to the TVs every so often, they would always be seen as "online" by the SmartThings app and then always discoverable by Homebridge.

Sending a WoL packet to my Samsung TV turns it full on.
While on, it will be reachable through whatever tools you have on your LAN but the display will also be on.
I don't know how your TV behaves and
I don't know if turning on your TV display every so often is what you want.
If it is, and you have an agent on your LAN that you can program, you might want to do something like this
https://wiki.archlinux.org/index.php/Wake-on-LAN#Trigger_a_wake_up