I’ve done a custom component for controlling my Samsung AC unit.
After that I did it more flexible and I think that it’s ready to work with other IP controlled devices.
At this moment component supports:
Samsung AC units available at port 8888 (new generation, REST API)
Samsung AC units available at port 2878 (old generation, socket communication)
Samsung MIM-H03 controller support is on the go (thanks to @kirichkov)
Support for any unit working with REST API can be easily added via YAML configuration file.
the constant errors on polling have stopped. However, occasional errors are occuring when the AC happens to issue an unsolicited <Update Type="Status"> while the polling is waiting for a <Response Type="DeviceState" Status="Okay"><DeviceState>
The AC sends these <Update Type="Status"> whenever there is a change to any of its Attributes (including from the IR remote)
Would it be possible to use these updates rather than constantly poll?
here is an example of an unsolicited message from the AC <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1441E051EADF11" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_TEMPNOW" Value="24" /></Status></Update>
@Jman I’ll do something with those messages. I noticed that there is a different duid in first response. Do you have two devices or it is connected with something else?
Sorry @SebuZet, latest dev version was unsuccessful. See errors below.
I am on HA 0.90.2
2019-03-28 12:00:45 INFO (MainThread) [homeassistant.loader] Loaded climate_ip.climate from custom_components.climate_ip.climate
2019-03-28 12:00:45 WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate_ip.climate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-03-28 12:00:45 INFO (MainThread) [homeassistant.setup] Setting up climate
2019-03-28 12:00:45 INFO (MainThread) [homeassistant.components.climate] Setting up climate.climate_ip
2019-03-28 12:00:45 INFO (MainThread) [custom_components.climate_ip.climate] climate_ip: async setup platform
2019-03-28 12:00:45 INFO (MainThread) [custom_components.climate_ip.climate] Loading configuration file: /home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.yaml
2019-03-28 12:00:45 INFO (MainThread) [custom_components.climate_ip.climate] ip_address: 192.168.1.30
2019-03-28 12:00:45 INFO (MainThread) [custom_components.climate_ip.climate] token: 11134c9a-fdd5-4111-8837-1c348d42f911
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Validate properties: False (False)
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, host: 192.168.1.30:2878
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, token: 11134c9a-fdd5-4111-8837-1c348d42f911
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, duid: 1229E055EA22
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, cert: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Connection invalid, creating!
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Socket wrapped: True
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.1.30:2878
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Response: DPLUG-1.6
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>
2019-03-28 12:00:46 ERROR (MainThread) [custom_components.climate_ip.climate] Sending command failed
Mar 28 12:00:46 hapi hass[29076]: File "/home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.py", line 176, in send_socket_command
Mar 28 12:00:46 hapi hass[29076]: File "/home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.py", line 231, in socket
Mar 28 12:00:46 hapi hass[29076]: File "/home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.py", line 222, in create_connection
Mar 28 12:00:46 hapi hass[29076]: File "/home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.py", line 160, in handle_socket_response
Mar 28 12:00:46 hapi hass[29076]: File "/home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.py", line 127, in handle_response_invalidate_account
2019-03-28 12:00:46 INFO (MainThread) [custom_components.climate_ip.climate] Retrying sending command...
Finally I got it working. I have a really messed up dir structure, the problem was with some faulty linking.
Thanks for the help and many thanks for the repo!
Also, there is a spelling error for property in samsung_2878.py
Mar 30 16:15:03 hass[480]: INFO (MainThread) [homeassistant.loader] Loaded climate_ip from custom_components.climate_ip
Mar 30 16:15:03 hass[480]: WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate_ip which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
Mar 30 16:15:03 hass[480]: INFO (MainThread) [homeassistant.loader] Loaded climate_ip.climate from custom_components.climate_ip.climate
Mar 30 16:15:03 hass[480]: WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate_ip.climate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
Mar 30 16:15:03 hass[480]: INFO (MainThread) [homeassistant.setup] Setting up climate
Mar 30 16:15:07 hass[480]: INFO (MainThread) [homeassistant.components.climate] Setting up climate.climate_ip
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] climate_ip: async setup platform
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Loading configuration file: /home/homeassistant/.homeassistant/custom_components/climate_ip/samsung_2878.yaml
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] ip_address: 192.168.1.30
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] token: f1d34c1a-fdd5-4131-1831-11318142f911
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Validate properties: False (False)
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Configuration, host: 192.168.1.30:2878
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Configuration, token: f1d34c1a-fdd5-4131-1831-11318142f911
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Configuration, duid: 1441E011EA11
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Configuration, cert: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Connection invalid, creating!
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Creating ssl context
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Setting up ciphers
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify mode
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Setting up verify location: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Setting up load cert chain: /home/homeassistant/.homeassistant/custom_components/climate_ip/ac14k_m.pem
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Wrapping socket
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Socket wrapped: True
Mar 30 16:15:08 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Connecting with 192.168.1.30:2878
Mar 30 16:15:09 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Response: DPLUG-1.6
Mar 30 16:15:09 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Update Type="InvalidateAccount"/>
Mar 30 16:15:09 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Sending auth command: <Request Type="AuthToken"><User Token="f1d34c1a-fdd5-4131-1831-11318142f911" /></Request>
Mar 30 16:15:09 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Auth command sent
Mar 30 16:15:11 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Response: <?xml version="1.0" encoding="utf-8" ?><Response Type="AuthToken" Status="Okay" StartFrom="1970-01-02/21:30:49"/>
Mar 30 16:15:11 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Connection authenticated
Mar 30 16:15:11 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Requesting status with command: <Request Type="DeviceState" DUID="1441E011EA11"></Request>
Mar 30 16:15:11 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Status request sent
Mar 30 16:16:56 hass[480]: WARNING (MainThread) [custom_components.climate_ip.climate] Socket timed out
Mar 30 16:16:56 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Connection created!
Mar 30 16:16:56 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:16:56 hass[480]: WARNING (MainThread) [homeassistant.components.climate] Setup of platform climate_ip is taking over 10 seconds.
Mar 30 16:16:58 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:16:58 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:16:58 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:17:00 hass[480]: INFO (MainThread) [homeassistant.components.climate] Setting up climate.generic_thermostat
Mar 30 16:17:00 hass[480]: INFO (MainThread) [homeassistant.setup] Setup of domain climate took 20.1 seconds.
Mar 30 16:18:24 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:18:24 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:18:24 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:18:45 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:18:45 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:18:45 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:19:06 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:19:06 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:19:06 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:19:27 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:19:27 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:19:27 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
Mar 30 16:19:48 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Executing command: None
Mar 30 16:19:48 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Getting socket connection
Mar 30 16:19:48 hass[480]: INFO (MainThread) [custom_components.climate_ip.climate] Command empty, skipping sending
@Jman, Hi thanks. It’s strange. I thought I don’t need to call get status with this solution. Can you please try to uncomment line 13 in samsung_2878.yaml file? Right now it looks like this: