Issue formating for switch as action

Based on my reading this should work but no such luck. If I activate the switch from the UI it’s works find but the action in the automation script does not. Any help would be appreciated.

# Switch for Wifi control with PoE and Unifi
switch:
    platform: command_line
    switches:
      wifi:
        command_on: ssh [email protected] '(echo "enable" ; echo "configure" ; echo "interface '0/7'" ; echo "poe opmode auto" ;$
        command_off: ssh [email protected] '(echo "enable" ; echo "configure" ; echo "interface '0/7'" ; echo "poe opmode shutdo$
        friendly_name: Wifi PoE Switch

# Automation
automation:
  - alias: Security alarm away reminder
    trigger:
      platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'armed_away'
    action:
    - service: switch.command_off
      entity_id: switch.wifi
    - service: notify.email_notification
      data:
        message: "Security system away armed"
        title: "Security Reminder"

Should be switch.turn_off in the automation.

1 Like