After a number of issues with the suggested syntax etc here is what I ended up creating. Please note I am using an EdgeRouter Lite with EdgeMax v1.9.0
1. I created a new "homeassistant" admin user on the EdgeRouter with SSH Keys for authentication (find the guides else where it is standard SSH keys on the homeassistant side and special steps for edgemax.
2. I created a script that takes some parameters on my Edge Router. The policy is ParentalControlRules and the rule I want to toggle is numbered 70 as per the "show firewall statistics" command.
/config/scripts/togglekidsinternet
#!/bin/vbash retval=1 cmd=/opt/vyatta/bin/vyatta-op-cmd-wrapper cfg=/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper if $cmd show firewall statistics | grep -q '^70.*\<disabled\>' then if [ "$1" == "STATUS" ]; then echo "isDisabled" retval=1 elif [ "$1" == "ENABLE" ]; then echo "Enable Rule" $cfg begin $cfg delete firewall name ParentalControlRules rule 70 disable echo "Commit" $cfg commit echo "Save" $cfg save $cfg end echo "isEnabled" retval=0 fi else if [ "$1" == "STATUS" ]; then echo "isEnabled" retval=0 elif [ "$1" == "DISABLE" ]; then echo "Disable Rule" $cfg begin $cfg set firewall name ParentalControlRules rule 70 disable echo "Commit" $cfg commit echo "Save" $cfg save $cfg end echo "isDisabled" retval=1 fi fi exit $retval
3. In home assistant I call the script via a command_line switch with the parameters STATUS, ENABLE or DISABLE
platform: command_line switches: kids_internet_override: friendly_name: "Kids Internet Override" command_on: "ssh homeassistant@192.168.1.1 -q /config/scripts/togglekidsinternet ENABLE" command_off: "ssh homeassistant@192.168.1.1 -q /config/scripts/togglekidsinternet DISABLE" command_state: "ssh homeassistant@192.168.1.1 -q /config/scripts/togglekidsinternet STATUS"