My parents ordered the Samsung washer a while ago and recently I was able to visit them to make sure it’s connected to Home Assistant.
I can confirm that the washing machine can be started from Home Assistant if it has been switched to remote control. As expected this requires pushing an additional button when putting the laundry into the machine, but this is not really an issue.
While Smart Things is supported through an official Home Assistant integration, for the washing machine this only provides sensors. I understand this is a limitation on Samsung’s side, not on the side of Home Assistant. IFTTT also does not support starting a washing programme (not that I was planning on using them).
I managed to get it working though using virtual devices in Smart Things as a workaround.This was before @KevinVGW explained how to use the SmartThings rest API, which is probably the best and cleanest way to do it. I’ll describe my method here though just in case someone needs it.
TL;DR The washer cannot be controlled by the Smart Things Hass integration, but virtual switches can be controlled. Create a few virtual switches in Smart things and then create automations in the Smart Things app that start the washing machine when you flip a virtual switch in Home Assistant.
-
Use this tutorial by Smarthomeowl to create virtual switches in Groovy IDE (kind of like a developer portal for Smart Things). Things might look slightly different as the IDE has gotten a layout update. If the tutorial is not clear, just search on DDG how to create virtual switched for Smart Things.
-
Create a few virtual switches. These are the ones that I created. Not all of them might be useful for you. These switches will pop up in Home Assistant as soon as you reload the Smart Things integration or restart.
- Switches that serve as sensors
switch.sensor_washer_ready_simulated_switch
switch.sensor_washer_smart_control_on_simulated_switch
- Switches that serve as triggers for automations in SmartThings
switch.action_washer_start_simulated_switch
switch.action_washer_cancel_simulated_switch
switch.action_washer_pause_simulated_switch
- Create the Smart Things routines that control the washer or switch the switches based on the washer status. These are the ones that I made.
- Sensor states
- Washer, Device Status: Ready
- Washer ready sensor
on
when ready
- Washer, Device Status: Not ready
- Washer ready sensor
off
when washing, finishing, or smart control is off
- Washer, Smart Control: On
- Washer smart control sensor
on
when smart control turns on
- Washer, Smart Control: Off
- Washer smart control sensor
on
when smart control turns on
- Actions
- Action washer pause simulated switch, On or off
- Pause cycle, then wait 10 sec, then switch the simulated switch to
off
- Action washer start simulated switch, On or off
- Start cycle, then wait 10 sec, then switch the simulated switch to
off
- Action washer cancel simulated switch, On or Off
- Cancel cycle, then wait 10 sec, then switch the simulated switch to
off
- Add a script in Home Assistant that allows you to easily control your washer with a service. It acts like a service with a several options for the actions that your washing machine can take.
alias: Washer services
description: Washing machine services
variables:
washer_start_switch: switch.action_washer_start_simulated_switch
washer_pause_switch: switch.action_washer_pause_simulated_switch
washer_cancel_switch: switch.action_washer_cancel_simulated_switch
washer_entity_id: switch.wasmachine
fields:
command:
name: command
description: What command should be sent to the washing machine?
example: start_cycle
default: start_cycle
required: true
selector:
select:
options:
- start_cycle
- pause
- cancel
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ command == "start_cycle" }}'
sequence:
- service: switch.toggle
data: {}
target:
entity_id: '{{ washer_start_switch }}'
- conditions:
- condition: template
value_template: '{{ command == "pause" }}'
sequence:
- service: switch.toggle
data: {}
target:
entity_id: '{{ washer_pause_switch }}'
- conditions:
- condition: template
value_template: '{{ command == "cancel" }}'
sequence:
- service: switch.toggle
data: {}
target:
entity_id: '{{ washer_cancel_switch }}'
default: []
- service: logbook.log
data:
name: '{{ washer_entity_id }}'
message: Sent {{ command }} to the SmartThings Washer
mode: single
icon: mdi:washing-machine
Now you can control your washing machine like this:
- Switches are not entirely an accurate representation of how a washing machine is started, a button is better. Create some template buttons that you can use on the dashboard to start your washing machine. These buttons use the script created in the previous step, but you can of course add any actions you want.
template:
- button:
- name: "Start wasprogramma"
icon: mdi:washing-machine
press:
- service: script.washer_services
data:
command: start_cycle
- name: "Pauzeer wasprogramma"
icon: mdi:pause
press:
- service: script.washer_services
data:
command: pause
- name: "Cancel wasprogramma"
icon: mdi:washing-machine-off
press:
- service: script.washer_services
data:
command: cancel
- Create template binary sensors for the virtual switches that we created that only represent states (so they act as sensors in Hass). The state of our template sensors is based on the virtual switches that are switched on and off by a Smart Things routine depending on the state of the washing machine.
template:
- binary_sensor:
- name: "Washer ready"
icon: mdi:timeline-clock
state: "{{ is_state('switch.sensor_washer_ready_simulated_switch', 'on') }}"
- binary_sensor:
- name: "Washer smart control enabled"
icon: mdi:cellphone-key
state: "{{ is_state('switch.sensor_washer_smart_control_on_simulated_switch', 'on') }}"
- The resulting entities are the following. The 5 entities at the op are the ones I created. The bottom 4 are the default ones. (I don’t think the switch from the default SmartThings entities does anything).
As I said, using the API is probably easier. But perhaps there are situations where the API is not a solution. Or where Home Assistant is used as a secondary smart home system. In that case: virtual switches will be useful.