Samsung AC

Thanks.
This is my output ( cant see the token ).

Listening on localhost:8889

----- Request Start ----->

Request path: /devicetoken/response
Content Length: 0
Request headers: Host: 192.168.0.41:8889
Accept: /

X-API-Version : v1.0.0
Content-Type: application/json
Content-Length: 28

Request payload: b’’
Body: <main.RequestHandler object at 0x76b24530>
<----- Request End -----

Sorry, please replace the row 30 to:
print(“Request payload:”, self.rfile.read(28))

Anyway reuploaded to http://mieletunkhosting.com/server.py

OK i managed to do this. After restart of HA i get the error:
“[homeassistant.components.sensor.command_line] Command failed: /home/HA_0.80.3/control_samsungac.sh”

When tried to turn the AC on i got:

ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall shell_command.set_ac_power_boolean (c:5a30f748a4b34021a232181a00bbd3e2)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1177, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/shell_command.py”, line 86, in async_service_handler
process = await create_process
File “/usr/local/lib/python3.6/asyncio/subprocess.py”, line 225, in create_subprocess_exec
stderr=stderr, **kwds)
File “uvloop/loop.pyx”, line 2603, in subprocess_exec
File “uvloop/loop.pyx”, line 2563, in __subprocess_run
File “uvloop/handles/process.pyx”, line 595, in uvloop.loop.UVProcessTransport.new
File “uvloop/handles/process.pyx”, line 102, in uvloop.loop.UVProcess._init
FileNotFoundError: [Errno 2] No such file or directory
2019-01-08 17:38:13 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall shell_command.set_ac_temperature_slider (c:5a30f748a4b34021a232181a00bbd3e2)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1177, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/shell_command.py”, line 86, in async_service_handler
process = await create_process
File “/usr/local/lib/python3.6/asyncio/subprocess.py”, line 225, in create_subprocess_exec
stderr=stderr, **kwds)
File “uvloop/loop.pyx”, line 2603, in subprocess_exec
File “uvloop/loop.pyx”, line 2563, in __subprocess_run
File “uvloop/handles/process.pyx”, line 595, in uvloop.loop.UVProcessTransport.new
File “uvloop/handles/process.pyx”, line 102, in uvloop.loop.UVProcess._init
FileNotFoundError: [Errno 2] No such file or directory
2019-01-08 17:38:13 ERROR (SyncWorker_18) [homeassistant.components.sensor.command_line] Command failed: /home/HA_0.80.3/control_samsungac.sh

I’ve been browsing all the issues and forums about controlling Samsung ACs, but all the solutions fail for me simply because the AC is not listening on either of those ports. I’ve tried turning it on and off around, but still nothing.
I have the Windfree AC model (if that somehow helps)

~ # nmap -sS -p 2878,8888 192.168.1.11
Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-27 18:25 UTC
Nmap scan report for 192.168.1.11
Host is up (0.053s latency).

PORT     STATE  SERVICE
2878/tcp closed aap
8888/tcp closed sun-answerbook
MAC Address: 70:2C:1F:5F:2A:C1 (Wisol)

Nmap done: 1 IP address (1 host up) scanned in 1.12 seconds

If you have newer AC, then it should be the new protocol with port 8888, otherwise it seems not working, this is working.

I’ve bought it just last year.
But does it require some procedure (order of steps) to make the AC to open the port?
I can control it through the SmartThings app.

Follow my instructions to get the token, and after you can manage it :wink: if you need more info, please pm me.

As I stated above. I’ve tried every approach that I’ve found on the internet. Both 2878 and 8888 ports, either python snippets, or some NodeJS implementations.
Of course, all of them fall short, because the ports are just not open, so every attempt just fails with Connection refused error

Maybe the port(s) used by smartthings will be the same as what you require?

Otherwise, can you do a full port scan to see what IS open?

For those with slightly older AC units (Samsung SMART AC) without “REST” API, I’ve created this CLI tool for interacting with the unit: https://github.com/massive/acdc

Bear in mind that this is still in very early stages, so YMMV. It works for me though.

1 Like

Hi everyone,
Last few days I was playing with Python, HASS and my Samsung AC device. Thanks to informations taken from this thread (and few other sides mentioned here) I’ve created custom component for my device.
Basic functionality works good - at least for me :wink:
There is still few things to do but work is in progress.
If you are interested please give it a try :smiley:

My component can be taken from GitHub:

BR,
Seba

1 Like

I gave it a go, but no success.
My AC uses port 2878 which I believe is an earlier model (circa 2013). Is your code likely to only work for newer models?

It will work with units with REST API. It Is using the same API as scrpit above. The only difference is that it is implementation of HA climate device.

I’ve fixed readme file on GitHub.
As host full address has to be provided. Including ‘https://’ prefix. (eg. https://192.178.1.200:888)

1 Like

This is working well, thank you @SebuZet

HI,

I’m running HA in docker.
Did everything and got this error. Are you able to help ?

2019-02-25 16:16:04 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.climate.samsungrac. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/loader.py”, line 92, in get_component
module = importlib.import_module(path)
File “/usr/local/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/climate/samsungrac.py”, line 23, in
from homeassistant.helpers.config_validation import (PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
ImportError: cannot import name ‘PLATFORM_SCHEMA_BASE’
2019-02-25 16:16:04 ERROR (MainThread) [homeassistant.loader] Unable to find component climate.samsungrac

@miklosandras Good to hear. New version available on repo. Please let me know if everything is working.

@wachux Which HA version are you using?

I’m using 0.84.6.

@wachux Try the latest version from repo