Controlling Samsung Air Conditioner from Home Assistant

I've gradually been connecting as many devices as I can using Home Assistant. One of the things that has been on my list is our WiFi connected Samsung Air Conditioner. It is a Samsung model AR24FSSSBWKN sold in Australia in around 2015.


We have made use of being able to control the air conditioner using the Samsung Smart Air Conditioner Android app, but it has always been problematic. It consistently requires a username and password to be entered when using it outside of the home, recently it has stopped working inside the home, and it also requests some (in my view) unnecessary permissions (such as telephone and contacts).



So, the idea of being able to control it via Home Assistant is appealing. I'd considered trying to set something up with my Broadlink IR Pro to control it via IR, but most of the possible solutions seemed a bit clumsy.

I became aware of the climate_ip custom component for Home Assistant created by SebuZet who is active on the Home Assistant forums, and one evening I sat down to try to get it working.

As my Samsung air conditioner is an older unit, apparently it communicates on port 2878 via an ssh connection.

After reading multiple forum posts, I understood that the process of setting up climate_ip involved:
  1. Installing the climate_ip custom component in my Home Assistant configuration folder
  2. Obtaining the security token specific to my air conditioner
  3. Configuring the air conditioner in Home Assistant
Steps 1 and 3 were pretty straight forward, but step 2 took me a few hours to figure out.

In the end I used the Samsung Air Conditioner Command Line Tool, also known as acdc. The problem was that this tool was written for node.js, which I had no experience with. I eventually found that I could install the tools necessary to get acdc running on an Ubuntu 19.04 instance using apt as follows:

 $ sudo apt install node.js  
 $ sudo apt install npm

I then cloned the acdc repository and attempted to set it up using the following commands:

 $ git clone https://github.com/massive/acdc  
 $ cd acdc
 $ npm install

The npm install command actually generated an error, which I suspect was because apparently the versions of node.js and npm contained in the Ubuntu apt repository are usually a bit out of date. However, it had successfully created a cli.js file in the lib folder, which was all I needed. I then executed the following command to obtain the security token I needed:

 $ lib/cli.js token
 connecting to <redacted>
 please power on the device within the next 30 seconds
 token found: <redacted>

The command ran successfully, and provided the token for my air conditioner, and I was then able to finalise the Home Assistant setup, adding the following in my configuration.yaml file.

 climate:
  - platform: climate_ip
    name: Aircon Kitchen
    config_file: 'samsung_2878.yaml'
    ip_address: '<redacted>'
    token: '<redacted>'
    cert: 'ac14k_m.pem' 
    mac: '<redacted>'

After restarting Home Assistant, I was getting an error message which required editing a few lines of the climate_ip component, as described here.

After that, my air conditioner was available as an entity in Home Assistant, with controls as shown below.



I then exposed it to Google Home, and was able to control it via voice commands, the Google Home app, and a Google Home/Nest Hub.



The only catch is that when I issue voice commands through Google Home, an error is reported saying "Sorry, something went wrong for the Aircon Kitchen", however it then goes on and successfully executes whatever command I have issued. I'm not sure what's going on there, but it's a problem for another day...



Comments

  1. Google home times out due to slow response of samsung server,it takes to long to get a state response.

    ReplyDelete
    Replies
    1. Thanks for the suggestion. However, I don't think it is using the Samsung server for anything. Google Home is talking to the aircon via Home Assistant, rather than via the Samsung servers. Also, the issue only happens with voice commands from Google Home. It doesn't happen with commands issued via the GUI on a Google Home Hub, or via the Google Home app.

      Delete
  2. unfortunately climate_ip works, but it slows down HA!

    ReplyDelete
    Replies
    1. I've heard of others suffering from this issue as well, but fortunately it has been okay for me so far. What are you running HA on?

      Delete
  3. Thank you so much for writing this guide! I have been looking for a way to get HA to work with my old Samsung AC for quite a long time.

    Setting up acdc was in fact the hardest part (even for me as a node.js developer) on Windows.

    ReplyDelete
    Replies
    1. Glad you found it helpful. That was the hardest part for me too!

      Delete
  4. Is this integration still working? I have tried following your tips and googling it but i'm just stuck...I think it might have something to do with the version of node.js I don't suppose you know what version you used?

    ReplyDelete
  5. Any idea why output is just blanc after I write lib/cli.js token ?

    ReplyDelete

Post a Comment

Popular posts from this blog

Smart Irrigation Controller with Tasmota and Home Assistant

PIR Sensor with Wemos D1 Mini and Tasmota