Recently I’ve bought a new Samsung Washer (wasmachine), with wifi connectivity. As a home automation nerd I try to have every new equipment in a certain way connected to my Homeseer system. I’ve seen the SmartThings plugin in Homeseer but I read in the comments that the newer models from Samsung were not compatible. I’m not a fan of connect my devices to the cloud but sometime there is no other way to reach your goal, so it is in this way as well. Because I tried already long time ago to make a script with an authentication option in it (and I’ve failed many times), I installed Home Assistant (or hassio) on a Raspberry Pi. Home Assistant has a standard integration for SmartThings, so in this way I was able to see a few things, like this:
Very interesting here is the “Completion time” and the “Washer Mode” aka the program is running. But instead of “Cotton” you’ll see the value “Table_00_Courese_5B”…. well, a little dissapointment actually, so I tried to get my script skills and spend some evenings to get the autorisation script again, afterall the script was able to make a connection to SmartThings.
Even I set up the saving of these devices to a MQTT broker so I was able to see the washer integration from Home Assistant in HomeSeer…The should be done better, right?
Needs:
- Samsung/SmartThings user account
- SmartThings token
- Added washer device in SmartThings Android/iOS app
No needs:
- Samsung hub
SmartThings
Make sure you have your Samsung washer connected via wifi to the SmartThings platform. It’s up to you to assign the washer to a certain room. With the Android/iOS app you can do the setup to the washer easily and in the end you see very nice things, in real time, like the current running program (i.e.”cotton”), the set temperature, the current mode that is running (weight sensing, rinse, spin, etc), the remaining time and so much more.
If the authentication script can connect to SmartThings, then it should be possible to grab the data from the platforms and store it in Homeseer, so here wel go.
Be sure you’ve connected your washer to the SmartThings app.
Create an account first on https://account.smartthings.com/login, you can login with a Smasung account, or you can create a SmartThings account. I had already an Samsung account, so I’ll continue with it. It’s fore sure not necessary to have also a SmartThings account next to your Samsung account. AFter the account is created, make sure you’re logged in.
Go to https://account.smartthings.com/tokens here you will see your current tokens (could be empty), and you can create a new tokenin the top right corner. Click on “GENERATE NEW TOKEN”.
Give the token a name, like “HomeSeer” and authorize the token for all scopes. On the bottom of the page, click “GENERATE TOKEN”. Your Personal access token is created now. The personal token is valid for 50 years, so don’t worry about an expiry date. In the blue pane a warning is visible to copy the token code to a save location, because it’s true that you can’t see this full code anymore, after the page is closed.
Postman
With the generated token, it’s time to make a connection to the SmartThings API.
To activate the token and find the device-id of the washer, we have to download an app called “Postman” on your computer. This app is wildly used by developers to do GET and POST request to API’s.
- Go to https://www.postman.com/pricing and click the download button in the FREE plan.
- Install the download on your computer. In case an account is necessary for download or installation, you’ll find your way to do this.
- Start the Postman program on your computer.
In the left op corner click on the orange “NEW” button and choose for “Request”.
Enter a name like “SmartThings” and click in the bottom of the top for the “1” folder in the collection section. Press “Save to 1”.
Make sure the “GET” command is selected. Copy paste the following command into the “Enter request URL” field (without quotes): “https://api.smartthings.com/v1/devices“.
To add the generated token, you have to select the “Authorization” tab below the url:
At the TYPE dropdown, select “Bearer Token”.
What is a Bearer token? Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources.
On the right side of the TYPE dropdown manu, you can enter the earlier generated token, without quotes.
It’s now time to make the first API requst to SmartThings, so press the blue SEND button the the right side of the screen.
If authentication is done successfully withthe Bearer token and the API request is done successfully, a JSON result will be shown below. an example is visible here:
Depending on how many devices are present in your SmartThings environment, it could be a very long list. In this case we are only interested in the Samsung washer, so scroll down untill you see that device.
Regarding the result for the Samsung washer, we are interested only in the “deviceId”, which start in this case with “59846602-………”. Copy your complete deviceId to another location, like Notepad because we need it for later use.
If you’re interesed in a more structured overview to read this JSON output, copy all the code in this pane and open the website http://jsonviewer.stack.hu. Paste all the code into the “Text” tab. Switch then to the “Viewer” tab. Click on the plus sign to expand the several menus or right click on JSON and coose for “Expand all”.
HomeSeer
So we have now a token for SmartThings and we have the deviceId of the Samsung washer. These 2 variables will be used in the vb.NET script that can be downloaded at the bottom of this blog post.
The HomeSeer script will make the same way cinnection as we have used inthe Postman program, also with the same Bearer token. The Bearer token is now activated and authorised, so any script can now grab data from SmartThings.
Open the SmartThings_Washer.vb script
- On script line 13, Debug mode is default set to set to True (debug mode = ON).
- On script line 13, device creating in HomeSeer is set to true as well.
- On script line 21 the SmartThings access token has to be filled in, between the double quotes.
- On script line 22 the deviceId has to be entered, between the double quotes.
Save the script in the HomeSeer script directory.
Create an event, recurring, depending on your needs, with action to run the script.
With the first script run, the virtual devices will be created, like this:
Release Notes:
June 11, 2022 | v4.2
|
|
January 17, 2021 | v4.1
|
|
April 27, 2020 | v1.0
Tested on HomeSeer 3, version 3.0.0.548 on Windows 8.1 and 10. Tested with Samsung Washer: WW90K6605QW/EN |
|
“Table_00_Course_5B” = ‘Cotton’ “Table_00_Course_65” = ‘Wool’ “Table_00_Course_5C” = ‘Super Speed’ “Table_00_Course_63” = ‘Drum Cleaning’ “Table_00_Course_67” = ‘Synthetic’ “Table_00_Course_6B” = ‘Spinning’ “Table_00_Course_60” = ‘Outdoor Care’ |
Downloads:
SmartThings_Washer v4.2.zip (4.1 KiB, 648 hits)
Related Posts
May 15, 2019
Control a Windows Service from a vb.NET script
August 20, 2017
Buienradar (NL) precipitation/rain forecast PHP script
November 15, 2014
hallo,
ik kan het bestand (SmartThings_Washer v4.2.zip) niet openen kunt u het nogmaals plaatsen of sturen via de mail?
alvast bedank,
Met vriendelijk groet
Patrick
Thanks. The ZIP-file is not there anymore. Can you re-upload in again please?
Thanks!
Hiya, I just brought a new Samsung washer and then tried to HS4 plugin and was very disappointed. After a quick google I found your guide but for some reason no devices are being created. The log shows fast amounts of data being received from the API but thats it.
The only thing I can think is that on your guide its says about setting device creation to true, but I dont see anything like that within the script.
“On script line 13, device creating in HomeSeer is set to true as well.” ?????
Any idea where im going wrong?
Cheers
Dan
Hi Dan,
A copy from your log output would be good a start for me to see where it is going wrong.
Can you provide me a copy of the log entries in a text file please?
Rutg3r
First of all, many thanks for your smartthings / Homeseer post. Tried to install it following your instructions, but the log shows: ‘Error: De objectverwijzing is niet op een exemplaar van een object ingesteld.’ and although there is large log about the details of the Samsungs device, no devices are created in Homeseer…. Any suggestions what I might be doing wrong?
Hi Abl,
My whole home automation system is currently down, so I don’t have the most recent script available, that will probably solve this issue.
I’ll send you an email with the script when I’ve access to the server again (probably within 2 weeks from now).
regards,
Rutg3r
Hello,
Great post you got there, thanks.
I’ve recently bought a Samsung Washer and would like to trigger the machine whenever my PV system produces enough energy.
I first connected it to my Home Assistant setup but like you, I can only read status from there.
I tried the SmartThings Alexa skill but there’s nothing about washer yet.
I then tried with IFTTT but there’s an error when I try to connect to Samsung SmartThings.
I see in a reply to Mario on July 22nd that you couldn’t make the token working from SmartThings. Does that mean that you couldn’t be able to do the “Send intrcutions” part in HA ?
Is that the reason why you made it happen in HomeSeer?
Because I don’t know anything about .NET or HomeSeer, but I’d LOVE to see it working in Home Assistant.
Hi Christian,
I wanted to use HomeAssistent in first place because I was wondering what kind of data was returned from the API. Since I’ve it all working in vb.NET (for HomeSeer), HomeAssistent is anyway off the table and I can’t give you any assistant regarding that setup.
regards,
Rutg3r
nice! thanks for sharing
where are you doing the conversion for the “course” names to be something more friendly?
eg. Course_D1 = Eco Cotton, or whatever it may be?
Hi JamieP,
You’re welcome regarding the script. There is hardly or no info available regarding these wash programs codes, so I’m checking the “table course codes” at the same moment as which program is set on the washer itself. Until now I’ve these:
“Table_00_Course_5B” = ‘Cotton’
“Table_00_Course_65” = ‘Wool’
“Table_00_Course_5C” = ‘Super Speed’
“Table_00_Course_63” = ‘Drum Cleaning’
“Table_00_Course_67” = ‘Synthetic’
“Table_00_Course_6B” = ‘Spinning’
“Table_00_Course_60” = ‘Outdoor Care’
Kind regards,
Rutg3r
Hi looks good.
But when run the script i get the following errors in my Homeseer log file :
HomeSeer
Error
Compiling script SmartThings_Washer.vb: Type ‘JProperty’ is not defined.
HomeSeer
Error
Compiling script SmartThings_Washer.vb: Type ‘JObject’ is not defined.
HomeSeer
Error
Compiling script SmartThings_Washer.vb: Namespace or type specified in the Imports ‘Newtonsoft.Json.Linq’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
HomeSeer
Error
Compiling script SmartThings_Washer.vb: Namespace or type specified in the Imports ‘Newtonsoft.Json’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
HomeSeer
Error
Compiling script SmartThings_Washer.vb: Namespace or type specified in the Imports ‘System.Core’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
How can i resolve the error messages ?
Hi Edwin,
I think the dll files + HS settings are missing for the JSON part. These files are also used in other script, but not attached in the download of this blogpost (my bad). I’ll send you an email with these files + instructions.
Rutg3r
Hello friend 🙂 i see your tutorial to add smart washing machine to homeseer i have question it possible way add washing machine to hassio(home assistant)? Thank’s
Hi Mario, in the first part of the blogpost, a screenshot is posted from Home Assistant, so yes it is possible to do a SmartThings integration in HA. I’ve tried to have the integration working in hassio, but there was something not working with the token from SmartThings. The standard integration is explained here: https://www.home-assistant.io/integrations/smartthings/
Kind regards,
Rutg3r