Samsung Air Conditioner

Hi,

I would love to request the support of Samsung Air Conditionior’s wifi enabled. There are a couple threads\attemps to integrate this, but it’s not clear the funcionality neither if works 100%. I see a menber reporting that was able to discover the devices, but it’s really premature. Being such big third-party vendor for AC’s and the existence of Smart Things that is integrating them, can I please kind ask for a prediction for this future integration?

Thank you,
Paulo Azevedo

Hi,
You can try my custom component:
Climate_IP

Thank you SebuZet,

do you believe your custom component is able to connect to the following models?:

Brand: Samsung;
Interior unit Model: AR09KSWSBWKN ( check the manusl here https://www.samsung.com/uk/support/model/AR09KSWSBWKNET/ ) it’s wall mounted unit with wifi embed

?

Thank you,
Paulo

Hi,
I’m sure it can. To make this possible you have to get access token for your device. First of all you need to know if your device is working on port 8888 or 2878.
You can try steps from this post first:


Let me know if it works for you.

Br,
Sebastian

1 Like

Thanks @SebuZet,

sorry for my ignorance here, but when the guy says termina, are we refering to what exactly? I’m a Windows user. By other side, looking to this, "https://SAMSUNG.IP:8888/devicetoken/request , you will be doing a post request in a specific port immedeatly 8888, how are we going to figure out if this is working or not?

Can you give me more details about this Token? I was seeing posts from other folks and I do see a similar code within the SmarThings plartform isn’t this the same token ID?

Other question, while configuring the code on Yaml, can you point me to a right configuration of the custom component? How exactly it would look like

Thank you,
Paulo

By terminal, in windows, Milebe means ‘Command prompt’.

  • You need to download files from here to some folder (eg. C:\temp)
  • Open the file actest.py with an editor and change the SAMSUNG.IP to your AC ip adress and save the file.
  • Power off your AC Device. IMPORTANT STEP!
  • You have to open window called “command prompt” (e.g. press Windows button and R, type cmd and press enter) and change folder to that one where you have downloaded files (e.g. type cd C:\temp and press enter)
  • Next, you have to type in command prompt: python3 server.py
  • It will run a server which will get token from device
  • Next, you have to open another window with “command prompt” and go to the same folder and execute python3 actest.py
  • If everything goes OK then in fir window you will see text like “DeviceToken”:“XXXXXXXXXX”_ where XXXXXXXXXX is your device token

AC Device will try to connect to your PC using port 8889 (in first terminal you are running server listening on port 8889) and will send unit token

Token is a string used to authenticate your PC in AC device - in short :slight_smile: I don’t know which token is used for smartthings. I don’t use smarthings integration because I want to control my device locally,

If your device is working on port 8888 then this configuration (added to HASS configuration.yaml) will be a good start:

- platform: climate_ip
  config_file: 'samsungrac.yaml'
  ip_address: 'device_ip'
  token: 'token'
  cert: 'ac14k_m.pem'

When you will be able to connect to your device I can help you with yaml customization but I’m not sure if it will be necessary. Probably you will get everything what is needed by you :wink:

Thank you @SebuZet I’ll give a try today and see how it goes.

Nice stuff, so I was able to retrieve the token quite easly. Now, I’m just copying and pasting the above configuration into a random place on my configuration.yaml and doens’t compile, it shows some errors, where exactly do I need to add this - platform : climate_ip, shouldn’t be under a component like:

climate:

  • platform: climate_ip
    config_file: ‘samsungrac.yaml’
    ip_address: ‘192.168.1.135’
    token: ‘mytoke’
    cert: ‘ac14k_m.pem’

@SebuZet outstanding work, is working pretty nice :slight_smile: now, wondering how to configure all the 5 AC units I have. Do I need to create different samsungrac.yaml files and declare them like this:

climate:
platform: climate_ip
config_file: ‘samsungoffice.yaml’
ip_address: ‘192.168.1.135’
token: ‘officetoke’
cert: ‘ac14k_m.pem’

platform: climate_ip
config_file: ‘samsungkids.yaml’
ip_address: ‘192.168.1.188’
token: 'kidstoken
cert: ‘ac14k_m.pem’

:slight_smile: Really nice my friend :slight_smile:

I’m glad it is working.

To be honest I don’t know :slight_smile: I’ve own one device for now. My idea was to have one YAML file for one model. If you have same models then one YAML file should be enough (Ok, I think I need to add ‘friendly_name’ config item to make this possible :wink: - now it is configured in YAML file )
I’m guessing that you have created different file for each device.
Can you please add option debug: True to one device and send me a message with attribute called device_state. It will be available from dev-state panel. Of course you can modify/remove your device uuid.
It should looks like this. I’m wondering which options are available in your device. By customizing YAML file you can add options to control model specific parameters. Eg. If you’ll find something like Spi_On or Spi_Off it means you can turn on/off purifiy mode (in my model it is called doctor or something like that)

And of course you can add information that this component is working good with your AC in original thread ;-). Maybe I should make a list of supported and tested models…

Blockquote
o be honest I don’t know :slight_smile: I’ve own one device for now. My idea was to have one YAML file for one model. If you have same models then one YAML file should be enough (Ok, I think I need to add ‘friendly_name’ config item to make this possible :wink: - now it is configured in YAML file )
I’m guessing that you have created different file for each device.

This is precisly what I did indeed :slight_smile: Have created different files and changed the filename in the configuration.yaml it’s working perfectly! There is a delay on the commands response, but nothing to worry to be honest!

From a configuration point of view, this is precisly what I was looking now, you have 3 up\down arrows to set temperatures. The first one I get it, which is to set the desired temperature, but the other two (initiazlied with 16º and 32º) I’m not sure what are the end goal of it (thus I was thinking to remove it from the device.yaml config fie).

In regards the debug, let me add that line and share with you.

Blockquote
Can you please add option debug: True to one device and send me a message with attribute called device_state . It will be available from dev-state panel. Of course you can modify/remove your device uuid.

Here is the debug result, as you see contains much more info. I really guess would help to make a list of devices you currently support with this integration and the config for each one:

name: samsunglivingroom
device_state: {“Devices”: [{“Alarms”: [{“alarmType”: “Device”, “code”: “FilterAlarm_OFF”, “id”: “0”, “triggeredTime”: “2019-04-01T19:48:59”}], “ConfigurationLink”: {“href”: “/devices/0/configuration”}, “Diagnosis”: {“diagnosisStart”: “Ready”}, “EnergyConsumption”: {“saveLocation”: “/files/usage.db”}, “InformationLink”: {“href”: “/devices/0/information”}, “Mode”: {“modes”: [“Heat”], “options”: [“Comode_Off”, “Sleep_0”, “Autoclean_Off”, “FilterCleanAlarm_0”, “OutdoorTemp_69”, “CoolCapa_50”, “WarmCapa_60”, “UsagesDB_254”, “FilterTime_5835”, “OptionCode_32936”, “UpdateAllow_NotAllowed”, “FilterAlarmTime_700”, “Function_15”, “Volume_100”], “supportedModes”: [“Cool”, “Dry”, “Wind”, “Auto”]}, “Operation”: {“power”: “On”}, “Temperatures”: [{“current”: 22.0, “desired”: 22.0, “id”: “0”, “maximum”: 30, “minimum”: 16, “unit”: “Celsius”}], “Wind”: {“direction”: “Up_And_Low”, “maxSpeedLevel”: 4, “speedLevel”: 0}, “connected”: true, “description”: “TP6X_RAC_16K”, “id”: “0”, “name”: “RAC”, “resources”: [“Alarms”, “Configuration”, “Diagnosis”, “EnergyConsumption”, “Information”, “Mode”, “Operation”, “Temperatures”, “Wind”], “type”: “Air_Conditioner”, “uuid”: “myuuid”}]}
operation_mode: heat
operation_list: cool,heat,dry,fan_only,auto
power: on
purify: FilterCleanAlarm_0
auto_clean: off
beep:
special_mode: off
special_list: off,sleep,speed,2step,comfort,quiet,smart
fan_mode: auto
fan_list: auto,low,medium,high,turbo
fan_max_mode: turbo
fan_max_list: auto,low,medium,high,turbo
swing_mode: up_down
swing_list: fixed,up_down,left_right,all
good_sleep: 0
temperature: 22
target_temp_high: 30
target_temp_low: 16
current_temperature: 22
min_temp: 16
max_temp: 32
target_temp_step: 1
friendly_name: Living Room
supported_features: 4807

@SebuZet, seems we have several errors surfacing while trying to set desired temperatures (min\max), seems the device is never assuming that info:

ERROR response status code: 500, text: {“errorCode”:“0”,“errorDescription”:“InvokeGetDeviceListFunc fail”}10:10 PM custom_components/climate_ip/connection_request.py (ERROR)

Several errors as well like this:
Setup of platform climate_ip is taking over 10 seconds.

10:05 PM main.py (WARNING) - message first occured at 10:05 PM and shows up 4 times

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.

BTW, would be possible for you to explain me how I’m able to retreive extra info from each device like :1- Power consuption
2- Filter usage time
This seems to be pretty nice details to add

Let me know your thoughts

Thank you for that. I think I will do such list.

Does setting min/max temperatures work from time to time or it doesn’t work at all.

I’ve noticed that my device from time to time is returning internal server error with code 500. Exactly the same as yours. First I will handle this error in better way and next I will try to understand what is going on.

Adding this is very simple. You can add as many attributes/operations to YAML file as you want. This component uses jinja2 templates (like HASS) to get values from device state. Json data called device_state is passed into template render method. This data represent data received from device. Using this you can extract whatever you want. To make this easier you can use dev-template panel for testing your template.
You can try to copy text below to template editor (device state data is taken from you):

{% set device_state = {"Devices": [{"Alarms": [{"alarmType": "Device", "code": "FilterAlarm_OFF", "id": "0", "triggeredTime": "2019-04-01T19:48:59"}], "ConfigurationLink": {"href": "/devices/0/configuration"}, "Diagnosis": {"diagnosisStart": "Ready"}, "EnergyConsumption": {"saveLocation": "/files/usage.db"}, "InformationLink": {"href": "/devices/0/information"}, "Mode": {"modes": ["Heat"], "options": ["Comode_Off", "Sleep_0", "Autoclean_Off", "FilterCleanAlarm_0", "OutdoorTemp_69", "CoolCapa_50", "WarmCapa_60", "UsagesDB_254", "FilterTime_5835", "OptionCode_32936", "UpdateAllow_NotAllowed", "FilterAlarmTime_700", "Function_15", "Volume_100"], "supportedModes": ["Cool", "Dry", "Wind", "Auto"]}, "Operation": {"power": "On"}, "Temperatures": [{"current": 22.0, "desired": 22.0, "id": "0", "maximum": 30, "minimum": 16, "unit": "Celsius"}], "Wind": {"direction": "Up_And_Low", "maxSpeedLevel": 4, "speedLevel": 0}, "connected": true, "description": "TP6X_RAC_16K", "id": "0", "name": "RAC", "resources": ["Alarms", "Configuration", "Diagnosis", "EnergyConsumption", "Information", "Mode", "Operation", "Temperatures", "Wind"], "type": "Air_Conditioner", "uuid": "myuuid"}]} %}

Template render result: {{ device_state.Devices.0.Mode.options.8[11:]}}

This example shows how to extract data from your device_state json’s attribute FilterTime_XXXX

When you have working template you can use it in YAML file. At the end of the file (in attributes section) you can add as follow:

filter_time:
  type: number
  status_template: '{{ device_state.Devices.0.Mode.options.8[11:]}}'

After restarting HASS you will find new attribute called filter_time with value taken from attribute extracted by status_template

Just keep in mind that samsung AC devices do not report status changes. That’s why I’ve enabled polling every 15s.
There is one more thing: I’ve noticed that my device is getting correct status only when it is turned on. After turning it off I can modify any param (special mode, operation mode, swing mode, desired temperature, anything) but device will report old configuration. After turning device on it will report correct status. I don’t why it is working in this way but I can not do anything with that.

@psadeazevedo You can try latest version. Configuration parameters friendly_name and name are available. You can use one configuration file for all devices. Some improvements in error handling. If you will have problems you can try turn debugs on to get more logs.

@SebuZet let me try to summarize the last 24 hours experience with your custome control:

  1. first of all seems to slow down heavly HA, so much that I takes seconds now to load things. Inspecting errors take ages now:

2019-04-02 18:02:49 WARNING (MainThread) [homeassistant.components.climate] Setup of platform climate_ip is taking over 10 seconds.

  1. I noticed that after rebooting one of the routers, the AC itself change the IP address, guess what I lost access to our device and controlling it. So I was forced to check the network and change the configuration.yaml to reflect that new IP;

  2. The min\max temperatures do not work at all for my device, but this seems to be something specific. Did the data I provided you, shared some light on the device specs we can control with your custom control?

  3. All the errors reported yesterday made by HA totattly unresponsive. Neither a docker container restart process resolve the problem. Had to remove the entire configuration (climate_ip) in order to boot again HA;

  4. Tested your last version and didn’t had a good experience as well. Most part of the devices show the wrong state (disconnected) and do not show the information. what I did in terms of config:

climate:

  • platform: climate_ip
    config_file: ‘samsungrac.yaml’
    ip_address: ‘192.168.1.132’
    token: ‘mytoken’
    cert: ‘ac14k_m.pem’
    friendly_name: ‘Office’

  • platform: climate_ip
    config_file: ‘samsungrac.yaml’
    ip_address: ‘192.168.1.188’
    token: ‘mytoken’
    cert: ‘ac14k_m.pem’
    friendly_name: ‘Kids Room’

  • platform: climate_ip
    config_file: ‘samsungrac.yaml’
    ip_address: ‘192.168.1.66’
    token: ‘mytoken’
    cert: ‘ac14k_m.pem’
    friendly_name: ‘Suite’

  • platform: climate_ip
    config_file: ‘samsungrac.yaml’
    ip_address: ‘192.168.1.70’
    token: ‘mytoken’
    cert: ‘ac14k_m.pem’
    friendly_name: ‘Living Room’
    #debug: true

  1. While trying to edit the UI and add the entities via Lovelace I have errors now:

I just check now and I have 111 errors on a small space of time it’s insane. makes sense why this is crashing my HA. As you know, this Samsung AC’s they lose quite offten the access to the network, but do we really need to ping the device every 15seconds(if I understood correctly your stament above)

ERROR response error

20:07 custom_components/climate_ip/connection_request.py (ERROR) - message first occured at 19:52 and shows up 111 times

Any advice?

@psadeazevedo Updated version is available on GitHub.
Yes, polling every 15s looks strange (especially if you have 5 devices) but I’ve added this feature on users request for old devices. Now it is configurable and turn off by default for new gen devices (like yours).

It is a good approach to set static IP for your devices o router configuration page :wink:

On some devices it cannot be change in ‘auto’ mode but it works for heat/cool mode. You can check this. You can also turn debugs on, change value and look into debugs. There will be many information available.

First of all, for long time tests turn debugs off - there is a lot of debugs. I didn’t observed such behavior with my device (on last version of component).

Config looks good. I reduced sleep after sending command to device from 1.5s to 0.5s. Maybe it was connected to that. Now it is 1.5s again. My device need a moment to return correct status. Maybe I should make this configurable?

If you have network/connection issues it may take a while. to communicate with device. I believe that network issues with few devices may provide such things.
Maybe you can start with one device and check how it works. If everything goes well you can enable another device. If somethings happen then you can turn debugs for last device and look into debugs. There should be a lot of informations.

@SebuZet I’ll give a try tomorrow on the new version and perhaps enable debug for one device only. As you say, I have 5 AC units and configured all of them :slight_smile: Guess I was too excited to see this working. Let’s back to the debug phase and see how it goes. Noticed now, that I can’t control as well the speed (Low, Medium, High, Turbo, etc) it jumps always to auto. Tested as well to set the temperatures min\max desired in Heat mode, but doesn’t seem to work as well. So, what I’m gonna do is to set a single device and enable debug and see what we have for all this small issues.

Btw, thanks a lot for the work you did here, at least I’m able to se use the minimum functionality here, which was something I wasn’t able at all to do with other integrations.

Let me return back with more debugging info as soon I can test the new build.

Other thing :slight_smile: I have 1 router and 2 other routers config as AP’s. From those you can’t really config a static IP address(or I’m missing some option) so not sure how I’m going to resolve that.

Ok, let me know how it works. My AC is ignoring many settings in auto mode. After switching to heat/cool it allows to change many settings.
Strange thing is that the device doesn’t return error code. It always return status ok.