Wake_on_lan turn_off mqtt.publish

Hi All,

I have a mqtt service running on a laptop of mine. I have setup a standard mqtt block in Home Assistant to pub/sub to it. This works flawlessly.

What I want todo is add a wake_on_lan switch to turn off and on my laptop (turning it off over mqtt) I’m having some trouble following the WOL Switch documentation in regard to the turn_off option.

This is what I have so far, and would like some helpful direction as i’m not sure how to format the turn_off action for mqtt:

switch:
  - platform: wake_on_lan
    name: "Computer WOL"
    mac_address: "00-11-22-33-44-55"
    turn_off: 
      service: mqtt.publish 
      data_template:
        topic: "home/computer/switch/set"
        payload: "OFF"

Is this structure setup right?

fyi: the home/computer/switch/set OFF performs a “pmset sleepnow” on the laptop. I have tested this and it works great outside of the WOL context.

Thanks!

You could try putting “OFF” in single quotes ‘OFF’

quotes didn’t make a difference.

here is the error from the logs:

2017-08-03 20:07:31 ERROR (MainThread) [homeassistant.config] Invalid config for [switch.wake_on_lan]: expected a dictionary @ data['turn_off'][0]. Got 'a'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/switch.wake_on_lan/