#Switch not being created for PC turn off

8 messages · Page 1 of 1 (latest)

lapis sparrow
#

so im trying to make an automation where I can turn on and off my PC via HA. So far, turning on the PC via the wake-on-lan automation works, but the shutdown isnt. I think it's because the entity for the turn off switch isnt being created

I am essentially following this guide: https://community.home-assistant.io/t/turning-off-a-windows-pc-with-home-assistant/27970

here is my config added to configuration.yml:

  - platform: command_line
    switches:
      pc:
        command_off: 'curl http://192.168.x.x:5001/Shutdown'
        
  - platform: wake_on_lan
    name: windowswol
    host: 192.168.x.x
    mac: 74:56:3C:x:x:x
    
  - platform: template
    switches:
      windows:
        value_template: '{{ states.switch.windowswol.state }}'
        turn_on:
          service: switch.turn_on
          entity_id: switch.windowswol
        turn_off:
          service: switch.turn_off
          entity_id: switch.pc ``` 


I see entities 'switch.windowswol' and 'switch.windows', but shouldnt there also be  'switch.pc'? 

If I run 'curl http://192.168.x.x:5001/Shutdown' in the HA terminal, shutdown works, which is why I think its because I dont have an entitiy being created for shutdown, and im not sure why

any help would be much appreciated
tight wharf
#

The problem is that you don't set up command_line switches like that anymore

#

You need to follow the instructions for that

gloomy sentinelBOT
tight wharf
#

When something doesn't work, I suggest reviewing the docs

lapis sparrow
#

ahh okay, so I need to add a comand_on string? and that would be the command I want to run?

#
tight wharf
#

Yes. There's a example right in the docs