Samsung AC Support, help needed

sorry, wasnt home the last 2 days @SebuZet,
anyway with the last commit i have this:

2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-18 11:37:35 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.109:2878
2019-03-18 11:37:36 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful
2019-03-18 11:37:51 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-18 11:37:51 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-18 11:37:51 ERROR (MainThread) [custom_components.climate_ip.climate] Error while validating connecting, send error

and then it start again from “creating ssl context”

@SebuZet I have enabled debug but haven’t got more info in logfile then one I already sent you. I testet now commit df3d880 and it is working great :slight_smile: Will test ae70f41 in about 1-2h …

@SebuZet ae70f41 is not working on my AC, df3d880 is ok

Guys, I pushed to repo last changes. Probably last before evening :wink:
From now on, you don’t have to modify any file path. Main configuration section is moved to configuration.yaml from HA and should looks like below:

  climate:
    platform: climate_ip
    ip_address: '127.0.0.1'
    token: 'token'
    cert: 'ac14k_m.pem' # use '' to skip certificate validation
    config_file: 'samsungrac.yaml'
    mac: 'AB:CD:EF:DC:BA'
    #debug: true

I’ve added some improvements in reusing socket

updated the config, there are still same error as before:

2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878
2019-03-18 14:32:53 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-18 14:33:09 ERROR (MainThread) [custom_components.climate_ip.climate] ERROR while validating connecting, send error
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-18 14:33:09 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878
2019-03-18 14:33:10 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-18 14:33:24 ERROR (MainThread) [custom_components.climate_ip.climate] ERROR while validating connecting, send error
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878
2019-03-18 14:33:24 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful

it work even with this error.
it seems that it need to reconnect to get status or give new command.
or cant find the old connection :stuck_out_tongue:

edit: after i while, home assistant get stuck, and i need to restart it.

@jackdalma can you check commit df3d880 ?

@Modrica @SebuZet
df3d880 not working here, it get stuck, and hass not starting:

2019-03-18 16:19:51 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-18 16:19:51 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878

I will look at this in the evening. If you have any logs please provide. thanks

Ok, I’ve fixed some issues and added extra logs - just in case :slight_smile:
Please remember that from now on you don’t have to edit YAML files to set IP addres or token. It will be filled out by component. Also it is enough to specify yaml file name without full path - component will search for this file in component’s folder.
@Modrica @jackdalma @Nick2
Validation errors also should be fixed.

@SebuZet Thank you, just tried your new commit. this is the log:

2019-03-19 00:10:24 INFO (MainThread) [custom_components.climate_ip.climate] climate_ip: async setup platform
2019-03-19 00:10:24 INFO (MainThread) [custom_components.climate_ip.climate] Loading configuration file: /home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.yaml
2019-03-19 00:10:24 INFO (MainThread) [custom_components.climate_ip.climate] ip_address: 192.168.18.108
2019-03-19 00:10:24 INFO (MainThread) [custom_components.climate_ip.climate] token: token
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Validate properties: False (False)
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, host: 192.168.18.108:2878
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, token: token
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, duid: duid
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, cert: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Socket wrapped: True
2019-03-19 00:10:25 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878
2019-03-19 00:15:38 INFO (MainThread) [custom_components.climate_ip.climate] Response: DPLUG-1.6

2019-03-19 00:15:40 INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

2019-03-19 00:15:40 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful
2019-03-19 00:15:40 INFO (MainThread) [custom_components.climate_ip.climate] Sending init message: <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 00:15:40 INFO (MainThread) [custom_components.climate_ip.climate] Message sent
2019-03-19 00:15:45 INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-03-18/23:15:45"/>

2019-03-19 00:15:45 INFO (MainThread) [custom_components.climate_ip.climate] Socket created
2019-03-19 00:15:45 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 00:15:45 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-19 00:16:30 WARNING (MainThread) [homeassistant.components.climate] Setup of platform climate_ip is taking over 10 seconds.
2019-03-19 00:16:31 INFO (MainThread) [custom_components.climate_ip.climate] Sending init message: <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 00:16:31 ERROR (MainThread) [custom_components.climate_ip.climate] ERROR while validating connection, send error

and then restart from “Creating ssl context”

home assistant won’t start. it keep repeating this log.
edit: nvm hass now start, i had to reboot my samsung AC, it got stuck and was slow on answer.
but the log still keep repeating like above, just faster.

I get exactly the same.

@Jman @jackdalma Did you restart computer with HA? After previous version I had to reboot my laptop. After that everything started to work.
From logs everything looks ok

I am rebooting AC and server now. Will test and let you know

So, controlling the AC works but this error is occuring on every poll of the AC

ERROR (MainThread) [custom_components.climate_ip.climate] ERROR while validating connection, send error

I updated the test script @SebuZet created way back in this thread to send the status request, sleep 16 seconds and repeat with the same socket still open. That test worked, so my AC at least is not closing the socket in between requests

Can you paset log before this one? There should be log starting with "Response: " so we can see response from device.

Maybe device “doesn’t like” authenticating before every request. I’ve removed this so we can see if it helps. New version on repo.

@SebuZet I just tested your latest code and it is working but I have to specify full path for config file in order to get it work “/config/custom_components/climate_ip/samsung_2878.yaml”

@Modrica that’s great. It looks like problem was in authenticating request before sending command.

This is strange, if there is only name (without any ‘/’) in the path component should search for that file in component’s folder

@SebuZet with the new version i still have error on log.
this time i restarted everything :wink:

2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Socket wrapped: True
2019-03-19 14:02:25 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.18.108:2878
2019-03-19 14:02:26 INFO (MainThread) [custom_components.climate_ip.climate] Response: DPLUG-1.6

2019-03-19 14:02:26 INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>

2019-03-19 14:02:26 INFO (MainThread) [custom_components.climate_ip.climate] Socket created successful
2019-03-19 14:02:26 INFO (MainThread) [custom_components.climate_ip.climate] Sending init message: <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 14:02:26 INFO (MainThread) [custom_components.climate_ip.climate] Message sent
2019-03-19 14:02:28 INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="2019-03-19/13:02:28"/>

2019-03-19 14:02:28 INFO (MainThread) [custom_components.climate_ip.climate] Connection status OK
2019-03-19 14:02:28 INFO (MainThread) [custom_components.climate_ip.climate] Socket created!
2019-03-19 14:02:28 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 14:02:28 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-19 14:02:31 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="AuthToken"><User Token="token" /></Request>

2019-03-19 14:02:31 INFO (MainThread) [custom_components.climate_ip.climate] <Request Type="DeviceState" DUID="duid"></Request>

2019-03-19 14:02:31 ERROR (MainThread) [custom_components.climate_ip.climate] ERROR sending command to device

@jackdalma I’ve added one fix and print stack trace. Can you try this out?