Samsung AC Support, help needed

@SebuZet @Nick2 I removed comments and are getting this error:

Somthing with ssl handshake failure

Thu Mar 14 2019 13:20:59 GMT+0100 (Central European Standard Time)
Error while setting up platform climate_ip
Traceback (most recent call last):
File “/config/custom_components/climate_ip/connection_s2878.py”, line 123, in execute
sslSocket.connect((self._host, self._port))
File “/usr/local/lib/python3.7/ssl.py”, line 1150, in connect
self._real_connect(addr, False)
File “/usr/local/lib/python3.7/ssl.py”, line 1141, in _real_connect
self.do_handshake()
File “/usr/local/lib/python3.7/ssl.py”, line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1056)

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/climate_ip/climate.py”, line 75, in async_setup_platform
device_controller = create_controller(‘yaml’, config, _LOGGER)
File “/config/custom_components/climate_ip/controller.py”, line 58, in create_controller
if c.initialize():
File “/config/custom_components/climate_ip/controller_yaml.py”, line 116, in initialize
self.update_state()
File “/config/custom_components/climate_ip/controller_yaml.py”, line 132, in update_state
self._state_getter.update_state(self._state_getter.value, debug)
File “/config/custom_components/climate_ip/properties.py”, line 129, in update_state
device_state = self.get_connection(None).execute(None, None)
File “/config/custom_components/climate_ip/connection_s2878.py”, line 136, in execute
sslSocket.shutdown(SHUT_RDWR)
File “/usr/local/lib/python3.7/ssl.py”, line 1090, in shutdown
super().shutdown(how)
OSError: [Errno 107] Socket not connected
Connection lost. Reconnecting…

@Modrica Thanks (removing comment (#) from lines 118 and 141 will comment out all communication stuff.
Can you please download and check this script and share output

EDIT: of course you have to change variables HOST, certfile, token, duid to meet your configuration

@SebuZet I have som issue I need to solve her, I think it is just my os installation not your code… Need to solve python-openssl

%Run ac_connection_test.py
Traceback (most recent call last):
File “/usr/share/hassio/homeassistant/custom_components/climate_ip/ac_connection_test.py”, line 14, in
ssl.PROTOCOL_TLS_CLIENT,
AttributeError: module ‘ssl’ has no attribute ‘PROTOCOL_TLS_CLIENT’

@Modrica It looks like it depends on system/python version etc… Just remove this line ( or change to -1) and try again

@SebuZet I changed it to -1 and here is result: :frowning:

#####################################################################################
#  Checking ssl for: -1
#####################################################################################
wrap socket test (ctx: -1)...
TEST FAILED, skipping
#####################################################################################
#  Checking ssl for: 3
#####################################################################################
wrap socket test (ctx: 3)...
TEST FAILED, skipping
#####################################################################################
#  Checking ssl for: 4
#####################################################################################
wrap socket test (ctx: 4)...
TEST FAILED, skipping
#####################################################################################
#  Checking ssl for: 5
#####################################################################################
wrap socket test (ctx: 5)...
TEST FAILED, skipping
#####################################################################################
#  Checking ssl for: 2
#####################################################################################
wrap socket test (ctx: 2)...
TEST FAILED, skipping
#####################################################################################
#  Checking ssl for: None
#####################################################################################
wrap socket test (ctx: None)...
TEST FAILED, skipping

@SebuZet I am following your another thread (Samsung AC) and I am getting this response from AC

 <?xml version="1.0" encoding="utf-8" ?>
<Response Type="DeviceState" Status="Okay">
<DeviceState>
<Device DUID="___DUID__" GroupID="AC" ModelID="AC" >
<Attr ID="AC_FUN_ENABLE" Type="RW" Value="Enable"/>
<Attr ID="AC_FUN_POWER" Type="RW" Value="On"/>
<Attr ID="AC_FUN_OPMODE" Type="RW" Value="Heat"/>
<Attr ID="AC_FUN_TEMPSET" Type="RW" Value="23"/>
<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" Type="RW" Value="0"/>
<Attr ID="AC_FUN_WINDLEVEL" Type="RW" Value="High"/>
<Attr ID="AC_FUN_DIRECTION" Type="RW" Value="Fixed"/>
<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="240"/>
<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="55"/>
<Attr ID="AC_COOL_CAPABILITY" Type="R" Value="25"/>
<Attr ID="AC_WARM_CAPABILITY" Type="R" Value="32"/>
<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="73"/>
<Attr ID="AC_SG_MACMID" Type="W" Value="124"/>
<Attr ID="AC_SG_MACLOW" Type="W" Value="153"/>
<Attr ID="AC_SG_VENDER01" Type="W" Value="248"/>
<Attr ID="AC_SG_VENDER02" Type="W" Value="4"/>
<Attr ID="AC_SG_VENDER03" Type="W" Value="46"/>
<Attr ID="AC_ADD2_PANEL_VERSION" Type="R" Value="150203"/>
<Attr ID="AC_ADD2_OUT_VERSION" Type="R" Value="1311745"/>
<Attr ID="AC_FUN_MODEL" Type="R" Value="6"/>
<Attr ID="AC_ADD2_OPTIONCODE" Type="R" Value="54714"/>
<Attr ID="AC_ADD2_USEDPOWER" Type="R" Value="22915"/>
<Attr ID="AC_ADD2_USEDTIME" Type="R" Value="138480"/>
<Attr ID="AC_ADD2_CLEAR_POWERTIME" Type="RW" Value="254"/>
<Attr ID="AC_ADD2_FILTERTIME" Type="RW" Value="300"/>
<Attr ID="AC_ADD2_FILTER_USE_TIME" Type="R" Value="3030"/>
</Device>
</DeviceState>
</Response>

Hi,
thank you for your work SebuZet. i tried your script, and i made some fix to get che output
script

here is the response:

 #####################################################################################
#  Checking ssl for: 3
#####################################################################################
wrap socket test (ctx: 3)...
TEST, connecting
TEST, response: 'DPLUG-1.6
'
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>
'
TEST, connected
TEST, authenticating...
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-03-14/14:05:38"/>
'
TEST, gettings status...
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Response Type="DeviceState" Status="Okay"><DeviceState><Device DUID="duid" 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="Wind"/><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="19"/><Attr ID="AC_FUN_SLEEP" Type="RW" Value="0"/><Attr ID="AC_FUN_WINDLEVEL" Type="RW" Value="High"/><Attr ID="AC_FUN_DIRECTION" Type="RW" Value="Rotation"/><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="68"/><Attr ID="AC_COOL_CAPABILITY" Type="R" Value="35"/><Attr ID="AC_WARM_CAPABILITY" Type="R" Value="40"/><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="183"/><Attr ID="AC_SG_MACMID" Type="W" Value="161"/><Attr ID="AC_SG_MACLOW" Type="W" Value="253"/><Attr ID="AC_SG_VENDER01" Type="W" Value="188"/><Attr ID="AC_SG_VENDER02" Type="W" Value="140"/><Attr ID="AC_SG_VENDER03" Type="W" Value="205"/><Attr ID="AC_ADD2_PANEL_VERSION" Type="R" Value="140315"/><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="54458"/><Attr ID="AC_ADD2_USEDPOWER" Type="R" Value="2060"/><Attr ID="AC_ADD2_USEDTIME" Type="R" Value="2440"/><Attr ID="AC_ADD2_CLEAR_POWERTIME" Type="RW" Value="254"/><Attr ID="AC_ADD2_FILTERTIME" Type="RW" Value="500"/><Attr ID="AC_ADD2_FILTER_USE_TIME" Type="R" Value="2440"/></Device></DeviceState></Response>

@jackdalma

with your code I am getting this error:

#####################################################################################
#  Checking ssl for: 3
#####################################################################################
wrap socket test (ctx: 3)...
TEST, connecting
TEST, response: 'DPLUG-1.6

'
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

'
TEST, connected
TEST, authenticating...
TEST: exception:
Traceback (most recent call last):
  File "/usr/share/hassio/homeassistant/custom_components/climate_ip/ac_connection_test.py", line 68, in <module>
    sslSocket.sendall(message)
  File "/usr/lib/python3.5/ssl.py", line 899, in sendall
    v = self.send(data[count:])
  File "/usr/lib/python3.5/ssl.py", line 869, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 594, in write
    return self._sslobj.write(data)
TypeError: a bytes-like object is required, not 'str'

try execute it with python 2.7

edit: updated the script to work with python 3 too

@jackdalma 2.7 is working , same output as you got … tnx

@jackdalma Home Assistant is working on python 3.5 so we have to do the same.
It looks like every device is different.
I will prepare new script and we will check if it will be enough. I’ll try to do this on the late evening.
@Modrica on other thread I have put the same script. Can you share whole output - at least ssl version?

@Modrica Can you check with python 3?

i tried with python3, same output as before.

@SebuZet here is response from 2.7

#####################################################################################
#  Checking ssl for: 3
#####################################################################################
wrap socket test (ctx: 3)...
TEST, connecting
TEST, response: 'DPLUG-1.6

'
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

'
TEST, connected
TEST, authenticating...
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-03-14/16:10:17"/>

'
TEST, gettings status...
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Response Type="DeviceState" Status="Okay"><DeviceState><Device DUID="__DUID__" GroupID="AC" ModelID="AC" ><Attr ID="AC_FUN_ENABLE" Type="RW" Value="Enable"/><Attr ID="AC_FUN_POWER" Type="RW" Value="On"/><Attr ID="AC_FUN_OPMODE" Type="RW" Value="Heat"/><Attr ID="AC_FUN_TEMPSET" Type="RW" Value="23"/><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="24"/><Attr ID="AC_FUN_SLEEP" Type="RW" Value="0"/><Attr ID="AC_FUN_WINDLEVEL" Type="RW" Value="High"/><Attr ID="AC_FUN_DIRECTION" Type="RW" Value="Fixed"/><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="240"/><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="55"/><Attr ID="AC_COOL_CAPABILITY" Type="R" Value="25"/><Attr ID="AC_WARM_CAPABILITY" Type="R" Value="32"/><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="73"/><Attr ID="AC_SG_MACMID" Type="W" Value="124"/><Attr ID="AC_SG_MACLOW" Type="W" Value="153"/><Attr ID="AC_SG_VENDER01" Type="W" Value="248"/><Attr ID="AC_SG_VENDER02" Type="W" Value="4"/><Attr ID="AC_SG_VENDER03" Type="W" Value="46"/><Attr ID="AC_ADD2_PANEL_VERSION" Type="R" Value="150203"/><Attr ID="AC_ADD2_OUT_VERSION" Type="R" Value="1311745"/><Attr ID="AC_FUN_MODEL" Type="R" Value="6"/><Attr ID="AC_ADD2_OPTIONCODE" Type="R" Value="54714"/><Attr ID="AC_ADD2_USEDPOWER" Type="R" Value="22934"/><Attr ID="AC_ADD2_USEDTIME" Type="R" Value="138500"/><Attr ID="AC_ADD2_CLEAR_POWERTIME" Type="RW" Value="254"/><Attr ID="AC_ADD2_FILTERTIME" Type="RW" Value="300"/><Attr ID="AC_ADD2_FILTER_USE_TIME" Type="R" Value="3050"/></Device></DeviceState></Response>

@SebuZet Here is 3 :frowning:

#####################################################################################
#  Checking ssl for: 3
#####################################################################################
wrap socket test (ctx: 3)...
TEST, connecting
TEST, response: 'DPLUG-1.6

'
TEST, response: '<?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

'
TEST, connected
TEST, authenticating...
TEST: exception:
Traceback (most recent call last):
  File "ac_connection_test2.py", line 68, in <module>
    sslSocket.sendall(message)
  File "/usr/lib/python3.5/ssl.py", line 899, in sendall
    v = self.send(data[count:])
  File "/usr/lib/python3.5/ssl.py", line 869, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 594, in write
    return self._sslobj.write(data)
TypeError: a bytes-like object is required, not 'str'

@Modrica @jackdalma @Nick2 Ok, I hope that this is the last one :slight_smile:
Latest version script

after adding \n on line 32 after < /Request > :smiley:
this is the response:

TEST, creating context
TEST, load verify location
TEST, set ciphers
TEST, load cert chain
TEST, wrapping ssl
TEST, connecting
DPLUG-1.6

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

TEST, athenticating
response: <?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-03-15/08:56:07"/>

TEST, Error creating socket

@jackdalma Thanks, can you try latest version. I hope it will work

thank you but unfortunately same response.

My mistake. Can you try one more time?