Hi all,
I managed to start the washing machine using the API:
curl --location --request POST 'https://api.smartthings.com/v1/devices/<DEVICE ID>/commands' \
--header 'Authorization: Bearer <AUTH TOKEN>' \
--header 'Content-Type: text/plain' \
--data-raw '[
{
"capability":"washerOperatingState",
"command":"setMachineState",
"arguments":["run"]
}
]'
After that, I created a Switch in my configuration.yaml to use this in Home Assistant:
switch:
- platform: command_line
switches:
wasmachine_run:
command_on: >
curl --location --request POST 'https://api.smartthings.com/v1/devices/<DEVICE ID>/commands' --header 'authorization: Bearer <AUTH TOKEN>' --header 'Content-Type: text/plain' --data-raw '[ { "capability":"washerOperatingState", "command":"setMachineState", "arguments":["run"] }]'
command_off: >
curl --location --request POST 'https://api.smartthings.com/v1/devices/<DEVICE ID>/commands' --header 'Authorization: Bearer <AUTH TOKEN>' --header 'Content-Type: text/plain' --data-raw '[ { "capability":"washerOperatingState", "command":"setMachineState", "arguments":["stop"] }]'
Example of my automation:
alias: Start wasmachine
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.power_production
above: '2.6'
condition:
- condition: device
type: is_on
device_id: <DEVICE ID>
entity_id: switch.wasmachine
domain: switch
- condition: not
conditions:
- condition: state
entity_id: sensor.wasmachine_washer_machine_state
state: run
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.wasmachine_run
mode: single