Hi
I’m trying to turn on the switch via rest command,
switch:
- platform: command_line
scan_interval:
seconds: 10
switches:
power_outlet_6:
command_on: "curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d '{"DA":{"amOn":"true"}}' http://192.168.1.254"
command_off: "curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d '{"DA":{"amOn":"false"}}' http://192.168.1.254"
friendly_name: 'Aircon On'
Now how do I setup the commend state and value template,
So if curl -s -k -H ‘Accept:application/json’ --digest ‘http://192.168.1.254’ output
following
{“result”:1,“error”:null,“id”:0,“data”:{“vid”:2,“did”:4,“device_type”:“airconditioner”,“default_name”:“Air Conditioner Settings”, “tags”:“aircon”, “is_sensor”:1, “is_actuator”:1, “is_silent”:0, “has_time_series”:0, “has_subdevice_count”:0, “has_state”:0, “gid”:“0”, “guid”:“xxx_0_2_4”, “node”:“xxx”, “meta”:{},“shortName”:"", “subDevices”:{}, “last_data”:{“DA”:{“amOn”:true,“tempTarget”:23,“mode”:1,“fanSpeed”:0,“enabledZones”:[1,1,0,0,0,0,0,0]},“timestamp”:1499413530689}}}
my command state would be curl -s -k -H ‘Accept:application/json’ --digest ‘http://192.168.1.254’ ?
and what will be the value_template if status of the aircon is “DA”:{“amOn”:true , is on