Samsung AC


#43

HI,
I updated version form repo and updated the HA to 0.87.1. Still have such log

2019-02-26 10:58:28 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform samsungrac
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/config/custom_components/climate/samsungrac.py”, line 297, in async_setup_platform
rac.initialize()
File “/config/custom_components/climate/samsungrac.py”, line 430, in initialize
self.update_state_from_json(j)
File “/config/custom_components/climate/samsungrac.py”, line 491, in update_state_from_json
OP_BEEP, j[‘Devices’][0][‘Mode’][‘options’][14])
IndexError: list index out of range


#44

@wachux Ok, It was added by me last time because I figured out what is this option for. I’ve added some kind of feature detecting. Should work now. Let me know if it is working.


#45

It worked for a while but suddenly it stopped. Tried to restart HA but it doesnt help. The error in log is
[custom_components.climate.samsungrac] samsungrac: execute_operation_command: response error: 204


#46

This log is ok, I have to removed it. Error code 204 means ‘No data in response’ but request was processed successful. What is not working?
I’ve to fix status updating but generally it works in my HA. In my case, first I need to turn on AC unit and next I can switch configuration. If i change order then unit is not reporting correct status. It looks like bug/feature in AC unit :slight_smile:


#47

Thanks for this, it’s great to finally get my AC working through HA. It works well enough! It sometimes seems to get in to the wrong state (reporting as on when it is off), but better than nothing!


#48

@Jayphen I know there are some issues with current state. In my unit, if I change state (eg. mode) when unit is turned off, then device is sending old status. I’m working on it and I hope I will resolve this problem.
I will let you know when it will be fixed.


#49

@miklosandras @wachux @Jayphen
New version is available on GitHub. Problems with status should be resolved


#50

Yes, this version is working fine with the status updates :slight_smile: Thank you!


#51

@miklosandras Did you try to control Purify and GoodSleep modes?


Samsung AC Support, help needed
#52

Yeeees, both are working fine, just tried with automation :slight_smile: I like this component :wink:


#53

@SebuZet I’m not sure if my AC does REST. I can get some control using openssl and xml. Does the below reveal anything?

after I have run…

openssl s_client -connect 192.168.1.38:2878 -cert cert.pem -cipher ‘HIGH:!DH:!aNULL’

AC responds

DPLUG-1.6
<?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

I respond with

> <Request Type="AuthToken"><User Token="fdd3429a-fda5-4312-8837-1c34ed42f3d1" /></Request>

AC Responds

<?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-02-28/22:44:12"/>

I respond with

<Request Type="DeviceState" DUID="144125b5ed61" /></Request>

AC Responds

> <?xml version="1.0" encoding="utf-8" ?>
   <Response Type="DeviceState" Status="Okay">
> <DeviceState>
> <Device DUID="144125b5ed61" GroupID="AC" ModelID="AC" >
> <Attr ID="AC_FUN_ENABLE" Type="RW" Value="Enable"/>
> <Attr ID="AC_FUN_POWER" Type="RW" Value="Off"/>
> <Attr ID="AC_FUN_OPMODE" Type="RW" Value="Cool"/>
> <Attr ID="AC_FUN_TEMPSET" Type="RW" Value="24"/ >
> <Attr ID="AC_FUN_COMODE" Type="RW" Value="Off"/>
> <Attr ID="AC_FUN_ERROR" Type="RW" Value="NULL"/>
> <Attr ID="AC_FUN_TEMPNOW" Type="R" Value="23"/>
> <Attr ID="AC_FUN_SLEEP" Ty pe="RW" Value="0"/>
> <Attr ID="AC_FUN_WINDLEVEL" Type="RW" Value="Auto"/>
> <Attr ID="AC_FUN_DIRECTION" Type="RW" Value="SwingLR"/>
> <Attr ID="AC_ADD_AUTOCLEAN" Type="RW" Value="Off "/>
> <Attr ID="AC_ADD_SETKWH" Type="RW" Value="255"/>
> <Attr ID="AC_ADD_CLEAR_FILTER_ALARM" Type="RW" Value="0"/>
> <Attr ID="AC_ADD_APMODE_END" Type="W" Value="0"/>
> <Attr ID="AC_ADD_STARTWPS" Type="RW" Value="Default"/>
> <Attr ID="AC_ADD_SPI" Type="RW" Value="Off"/>
> <Attr ID="AC_OUTDOOR_TEMP" Type="R" Value="78"/>
> <Attr ID="AC_COOL_CAPABILITY" Type="R" Value="70"/>
> <Attr ID="AC_WARM_CAPABILITY" Type="R" Value="80"/>
> <Attr ID="AC_SG_WIFI" Type="W" Value="Connected"/>
> <Attr ID="AC_SG_INTERNET" Type="W" Value="Connected"/>
> <Attr ID="AC_ADD2_USEDWATT" Type="R" Value="65024"/>
> <Attr ID="AC_ADD2_VERSION" Type="RW" Value="65024"/>
> <Attr ID="AC_SG_MACHIGH" Type="W" Value="85"/>
> <Attr ID="AC_SG_MACMID" Type="W" Value="234"/>
> <Attr ID="AC_SG_MACLOW" Type="W" Value="100"/>
> <Attr ID="AC_SG_VENDER01" Type="W" Value="20"/>
> <Attr ID="AC_SG_VENDER02" Type="W" Value="73"/>
> <Attr ID="AC_SG_VENDER03" Type="W" Value="224"/>
> <Attr ID="AC_ADD2_PANEL_VERSION" Type="R" Value="130814"/>
> <Attr ID="AC_ADD2_OUT_VERSION" Type="R" Value="1246985"/>
> <Attr ID="AC_FUN_MODEL" Type="R" Value="6"/>
> <Attr ID="AC_ADD2_OPTIONCODE" Type="R" Value="63162"/>
> <Attr ID="AC_ADD2_USEDPOWER" Type="R" Value="27521"/>
> <Attr ID="AC_ADD2_USEDTIME" Type="R" Value="23860"/>
> <Attr ID="AC_ADD2_CLEAR_POWERTIME" Type="RW" Value="254"/>
> <Attr ID="AC_ADD2_FILTERTIME" Type="RW" Value="180"/>
> <Attr ID="AC_ADD2_FILTER_USE_TIME" Type="R" Value="4980"/>
</Device></DeviceState></Response>

#54

@SebuZet I get error while setting up platform samsungrac.
Here is the log

Error while setting up platform samsungrac
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x72d1fdd0>: Failed to establish a new connection: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.178.1.209', port=8888): Max retries exceeded with url: /devices (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x72d1fdd0>: Failed to establish a new connection: [Errno 110] Operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
  File "/config/custom_components/samsungrac/climate.py", line 335, in async_setup_platform
rac.initialize()
  File "/config/custom_components/samsungrac/climate.py", line 438, in initialize
j = self.get_device_json()
  File "/config/custom_components/samsungrac/climate.py", line 418, in get_device_json
resp = session.request('GET', url=self.host + url, headers=self.extra_headers, verify=False, cert=self.cert, data=json.dumps({ 'sebu' : 'zet' }))
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='192.178.1.209', port=8888): Max retries exceeded with url: /devices (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x72d1fdd0>: Failed to establish a new connection: [Errno 110] Operation timed out'))

#55

At settings you have to include https too like this:

host: https://192.178.1.200:8888

#56

Thank you. It works now.


#57

From now on schema ‘https://’ is automatically added if user passed only ip/host


#58

I’m fairly new to ha but have one of these aircon I want to integrate. How do I get access token. I’ve tried to follow the link you provide but don’t understand python very well. Any help would be great.


#59

@joelFORCE
So to get the “access token” follow these steps:
1- Download files from here: FILES and put them in a easy accessible folder from terminal.
2- Open the file “actest.py” with a editor and change the SAMSUNG.IP to your AC ip adress and save the file.
3- Power off your AC Device. IMPORTANT STEP!
4- Open a terminal and navigate to the folder where you have the (previously downloaded) files.
5- Execute: python3 server.py keep this terminal open.
6- Open another terminal and navigate to the same folder as in step 4.
7- Execute: python3 actest.py in this second terminal.
8- Go to your first terminal and check the output there you should have something like: “DeviceToken”:“XXXXXXXXXX” where the “XXXXXXX” is your token.
9- Save your token somewhere save, like a text file (for later). Now you can close both terminals.

Hope this helps.


#60

Cheers for ya help but just found out it uses port 2878.
It uses the mim-h02 controller. Don’t think this method works for it.


#61

@Jman I need few days to finish what I have started. After that I can try to do something with your AC but I cannot promise anything


#62

Thankyou @SebuZet, that’s very kind. I am pretty sure now my AC does not have REST.