Climate_IP - ClimateDevice for IP based units (not only Samsung AC)

Hi Everyone,

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.

If anyone is interested you can find it on GitHub

7 Likes

Support for mim-h03_heatpump.yaml already added.

1 Like

Hi @SebuZet,

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>

We can try to do this but keep in mind that I don’t have a device working on port 2878 so it can be a little more harder than usual :wink:

Understood.
Appreciate the amount of effort you’ve already put into this. If it’s too much of a diversion, maybe leave it for now.

@Jman Can you check device response message after sending some command (E.g. after changing desired temperature or changing mode)?

Here you go…
(note: the outside temp is reported in Farenheit. The inside temp is in Celsius)

    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA64" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_POWER" Value="On" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_OUTDOOR_TEMP" Value="72" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_TEMPSET" Value="23" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Auto" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Dry" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Wind" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_WINDLEVEL" Value="Low" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Heat" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_WINDLEVEL" Value="Low" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_DIRECTION" Value="Fixed" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Auto" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_WINDLEVEL" Value="Auto" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_OPMODE" Value="Cool" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_DIRECTION" Value="SwingLR" /></Status></Update>
    <?xml version="1.0" encoding="utf-8" ?><Update Type="Status"><Status DUID="1456E055EA12" GroupID="AC" ModelID="AC"><Attr ID="AC_FUN_POWER" Value="Off" /></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?

I hastily changed it to hide my real one :wink:
“Missed it by that much”

Hi,
Im trying to set up the device in HA but Im constantly having this error:

Error while setting up platform climate_ip

Traceback (most recent call last):
File “/home/csirk/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 124, in _async_setup_platform
task = async_create_setup_task()
File “/home/csirk/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 89, in async_create_setup_task
None, platform.setup_platform, hass, platform_config,
AttributeError: module ‘homeassistant.components.climate.climate_ip’ has no attribute ‘setup_platform’

Any help is appreciated,
Feri

@Jman,
Can you try my last vdersion from dev barch
Please let me know if it is working

@csirk51 Which HASS version are you using?

Just updated to 0.90.2

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...

@Jman Sorry for that. I’ve fixed an issue. Can try once more time?
@csirk51 How did you install component. You have to do as follow:

  • Create folder climate_ip in /custom_components folder (in docker it should looks as follow: /config/custom_components/climate_ip/
  • download all files from GitHub and put them in newly created folder (only files, without samungrac folder)

Can you show your directory structure?

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!

Br.
Feri

@csirk51 That’s great. Which device are you using? With old API or the new one?
Br,
Sebastian

Im using a 2016 AR7580, it is a new api version. I tried the basic functions, they seem to work well.

@SebuZet, this time didnt work very well. Attributes arent populating.

min_temp: 16
max_temp: 32
fan_mode: 
special_list: wind3,sleep,off,wind1,softcontrol,quiet,smart,wind2
temperature: -1000
target_temp_step: 1
fan_list: mid,high,low,auto,turbo
special_mode: 
name: samsungrac
swing_mode: 
device_state: {}
operation_list: fan_only,heat,auto,dry,cool
current_temperature: -1000
friendly_name: Lounge AC
swing_list: up_down,all,left_right,fixed
power: 
supported_features: 4801
auto_clean: 
operation_mode: 
purify: 

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:

#connection_template: ‘<Request Type=“DeviceState” DUID=“{{duid}}”></Request>’

and it should looks like below:

connection_template: ‘<Request Type=“DeviceState” DUID=“{{duid}}”></Request>’

What kind of spelling error did you found? I don’t have such device and I don’t have a possibility to test it at home.

Has the custom components folder changed on recent releases? I’ve to stay with 0.70 since the new auth don’t work under a reverse proxy basic auth.

If I place this component under custom_components/climate_ip, it seems is not loading at all:

2019-03-31 17:43:54 ERROR (MainThread) [homeassistant.loader] Unable to find component climate.climate_ip

If this component is placed in custom_components/climate/climate_ip it loads, but then I face an error related to an attribute called “setup_platform”

2019-03-31 17:39:13 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform climate_ip
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 125, in _async_setup_platform
task = async_create_setup_task()
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 90, in async_create_setup_task
None, platform.setup_platform, hass, platform_config,
AttributeError: module ‘custom_components.climate.climate_ip’ has no attribute ‘setup_platform’