Get a simple custom switch recognized by Google Home

I have a custom device setup (Wake On Lan specifically) and I finally have the off working (custom scripting) but what I really want is to have my device integrated directly so it can be recognized by my Google Home, I have it as a virtual device but since I really just need the on/off like a regular switch I am wondering what I have to do to make that happen. I have both custom app (Wake On Lan that somebody else made) and also the custom app code that I modified on top of.

Basically, what is the best way (or easiest and hackiest) to directly manipulate the device that Google Home can see. I am a programmer so nothing is too crazy, I just haven't seen how to get this working anywhere, I don't want to create a custom Google Developer app if I don't have to

Would this work for you?

It's been a while since I played with WOL, so, depending on the capabilities of any devices created by the App, probably the simplest option (I expect) would be to:

  • Setup a virtual switch on HE
  • Setup a rule (RM, etc) to react to changes to that switch and initiate the WOL or other actions you want using your code modfications
  • Add the switch to the Built-In Google Home App on the HE hub and sync your devices
  • Start turning the switch on and off via GH

That said, there is one tweaks I would suggest to that approach. It may be preferable to have the switch effectively setup as a button, configuring a short period to automatically turn the switch off, configured in the Device Edit page. That way the switch does not need to reflect the state of the PC / laptop, rather, is used as a toggle, and the choice of a switch is simply for compatibility with GH. Any rules in HE would need to be adjusted to cater for this as well. You may also want to setup routines in GH so that interaction with the switch in GH is a little more natural, rather than always asking to turn the switch on, when in fact it will be turning the PC / laptop off.

What sburke said...here's my setup using the PC Controller app, but same principle. I just also have shut down setup as well.

  1. Virtual switch with "auto off" set to 500 ms.
  2. RM rule. That will send the WOL command when the virtual switch turns on.
  3. Added the switch to Google Home (I use the community app instead of the built-in option).
  4. Set up a routine to turn on the switch when I give the command.

Thanks but I already have a virtual switch, I am wondering how I can get a device recognized by itself, not using a virtual switch which I already have working. I am just trying to go deeper but I don't quite understand what things can be seen by the google api

The community instance of Google Home integration has some built-in mapping of converting Hubitat capabilities to Google Home device capabilities. Getting a device with a custom command recognized in GH would mean development on the GH side.

1 Like

All figured out, thanks everybody! Now my plex server can be controlled and monitored with simple automation

I have it kind of documented, minus the python server here

It wakes my pc and turns it off as well when I hit the simple endpoint, also will add more on it a bit later but for now I am happy with it all working without a virtual switch

1 Like

So, you essentially moved the RM/virtual switch part into the driver. smrt

Yup! A lot easier this way and no extra workarounds needed

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.