I’ve made a command line switch, can turn it on/ff no problem, but having trouble getting power status from below.
switch:
command_line:
- switch:
name: Dell R740 power
command_on: >
curl -H "Content-Type: application/json" -X POST --data '{"Action": "Reset", "ResetType": "On"}' https://192.168.66.119/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset/ -u root:xxx --insecure
command_off: >
curl -H "Content-Type: application/json" -X POST --data '{"Action": "Reset", "ResetType": "GracefulShutdown"}' https://192.168.66.119/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset/ -u root:xxx --insecure
command_state: >
curl -s https://192.168.66.119/redfish/v1/Systems/System.Embedded.1 -u root:xxx --insecure | python3 -mjson.tool | grep PowerState"
value_template: '{{ value == "on" }}'
grep output from terminal:
➜ ~ curl -s https://192.168.66.119/redfish/v1/Systems/System.Embedded.1 -u root:xxxx --insecure | python3 -mjson.tool | grep "PowerState"
"PowerState": "On",
➜ ~ curl -s https://192.168.66.119/redfish/v1/Systems/System.Embedded.1 -u root:xxxx --insecure | python3 -mjson.tool | grep "PowerState"
"PowerState": "Off",