Samsung AC

I am sorry, it is not working with the new version of HA, where climate component has been totally redefined

@lucac81 I havesame problem how I can solve?

first of all iā€™d like to give a sincere THANK YOU @SebuZet for this component :raised_hands:
i myself try to maintain a more-or-less-wannabe important HA component and i know how hard it is to debug/develop when you donā€™t own the device, so again thank you!

for those with older device that are using port 2878 (you can check by using the command nmap -sS -p 2878,8888 IP_ADDRESS already mentioned here in the thread) the easiest/fastest way I found to get the token was using the method mentioned by @joelFORCE here

but given the fact the openssl must be a lower version to play nice with the older certificate, i quickly installed an older debian 8.11 netinstall in a VM + all the basic packages (no updates). i proceeded by installing latest version of nodejs + homebridge-plugin-samsung-air-conditioner node package (i wonā€™t go into details how to do all of this -> google it)

the tricky part was that running homebridge-samsung-ac-get-token <your ac's ip address> was still throwing an error SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1929 after some googleing to overcome this the command had to be run like this:

node --tls-min-v1.0 /usr/bin/homebridge-samsung-ac-get-token IP_ADDRESS

after running the command wait a bit, like 10-20 seconds, until the message Power on the device within the next 30 seconds shows up and voilĆ  the token is returned :metal:!
(for the reference I have an AR07HSSDBWKN device model)

PS: I would like to mention that I read this entire thread and a lot of useful information was already exposed! for those who encounter problems, donā€™t just ask directly for a 5-seconds-solution and start reading firstā€¦ also I hope this mini-tutorial helps someone someday ĀÆ\_(惄)_/ĀÆ

5 Likes

maybe any thoughts why i am getting this error :

iMac:~ andrius$ homebridge-samsung-ac-get-token 172.16.0.211
IP: 172.16.0.211
Power on the device within the next 30 seconds
Error occured: Failed authentication

@andriuskr have you tried running the command multiple times? it failed for me at some point giving various (other) errors. wouldnā€™t hurt to reset everything too router/AC

also are you sure youā€™re using a port 2878 model?

1 Like

I originally thought ā€œPower on the deviceā€ meant powering the whole system off & on (typically via a breaker) - I eventually figured out that it actually meant ā€œturn it on to cool/heat/fan via the control panelā€.

Yes, i am usring 2878 model.
running homebridge on iMac with macOs high sierra. Nothing helps :frowning:

homebridge-samsung-ac-get-token 172.16.0.211

IP: 172.16.0.211

Power on the device within the next 30 seconds

Error occured: Failed authentication

have you followed my steps explained above using a virtual machine?

due to the newer version of openssl (which i highly believe HighSierra has it) or whatever ssl implementation macOS has you cannot run the homebridge-samsung-ac-get-token successfully!

@SebuZet
Hello SebuZet I have your component with samsung ac old protocol 2878, how i can sent script for start in heat mode or cool mode?
maybe the component does not support this function?

Hi Peter!

Thanks for summarising this post. Iā€™ve tried following your instructions with a VM using Debian 8.11 + Node + Homebridge + homebridge-plugin-samsung-air-conditioner. However, when i get to this point, the installer fails. Iā€™ve tried several times and did a lot of googling on the errors, but I canā€™t get it to work. My nodejs shows version 0.10.29, npm 6.13.4

I would really appreciate if you can give me a few more details on how to do this as im really struggling to get the token. Iā€™ve tried every single option without any success, and this is the only missing piece for my current Home Assistant configuration.

Cheers,
Nick

first of all you donā€™t need to install homebridge, the homebridge-plugin-samsung-air-conditioner needed can run without it, itā€™s a nodejs executable or so

can you give more details what exactly fails, maybe posting some output? hard to tell what youā€™re doing there. also, unless you typed something wrong your nodejs version looks awfully low

Wow! thanks for the quick response! As expected, after a lot of frustration, when I reach out for help I make it work.

Going over the logs, I realised i was missing an access to the node_modules folder, so it wasnā€™t installing it properly.

I run:

sudo chown -R root:pi /usr/local/lib/node_modules/
sudo chmod -R 775 /usr/local/lib/node_modules/

and I could finish the installation. I just managed to run the script but navigating to the directory:
/usr/local/lib/node_modules/homebridge-plugin-samsung-air-conditioner/bin $
and running:
node ac-get-token.js 192.168.8.116
I got

Device token: 04167757-9775-M633-N858-373832354144

:smiley: Happy days!!

now onto the configuration on HA, hopefully the difficult part is over.

Thanks again!
N

1 Like

Iā€™ve been trying for the past few days to get this working but struggling with loading the climate modules.

Iā€™m running a Pi3 with the hassio 32bit image of HA 0.104.3

My Ac runs on the 2878 port.

Iā€™ve successfully been able to get a token from the AC and cloned the dev version of SebuZetā€™s git hub to my server in config/custom_components/climate_ip. Iā€™ve also configured the config.yaml file with the steps mentioned a few times in this post with debug on.

In the output of the log iā€™m getting the following:

Platform error: climate

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 760, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 265, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/climate_ip_old/climate.py", line 21, in <module>
    from homeassistant.components.climate import (ClimateDevice, DOMAIN,
ImportError: cannot import name 'ATTR_HVAC_ACTIONS' from 'homeassistant.components.climate' (/usr/src/homeassistant/homeassistant/components/climate/__init__.py)

As far as i can see all the right settings are in the right place and the config file is calling the 2878.yaml file. Is there a critical step that iā€™m missing or is the image iā€™m using on the pi not compatible with this module?

Any help is appreciated!

Cheers,

AAG

This looks like the home assistant code has changed and broken the module. If you donā€™t have any new features you require you can try downgrading home assistant to version 0.9x

1 Like

Thank you,

Iā€™ll give it a go and report back

Hi all,

as per https://github.com/SebuZet/samsungrac/issues/14

you need to edit climate.py file under /config/custom_components/climate_ip and replace the 2 references on ATTR_HVAC_ACTIONS to ATTR_HVAC_ACTION

I have just made this change with version 0.105.2 and it works.

The only issue i have at the moment is that it is reading ā€˜Current Temperatureā€™ as 80* C (which i believe is actually F*) but target shows as 25* C. Any ideas?

Ah thank you Nick! That seems to have done the trick!

Also seem to have the temperature showing up F*

Having a quick look around ā€œAC_FUN_TEMPNOWā€ value seems to be the returned temperature, iā€™m struggling to find where the value is output to home assistant. was hoping to do a conversion then return that value to h.a.

properties.py seems to have mention of conversions but havenā€™t quite figured out how it works.

So Iā€™ve had a look on the Saumsung smart appliance pages and found that the temp code also returns the odd vaule tooā€¦

But yet the temperature returned is correct :

tempnowimage

So it got me looking though their javascript code and found this:

//CACėŠ” ķ˜„ģž¬ģ˜Øė„ėŠ” tempNowģ„ ź°’ģ— -55ė„ė„¼ ķ•“ģ•¼ ģ •ķ™•ķ•œ ģˆ˜ģ¹˜ź°€ ė‚˜ģ˜Øė‹¤.
    	tempNow = (tempNow - 55);
    	if (tempNow < -9)		//-10ģ“ķ•˜ (Lo)
    	{
    		tempNow = "Lo";
    	}
    	else if (tempNow > 40)	// 41ė„ģ“ģƒ(HI)
    	{
    		tempNow = "HI";
    	}
				

Google Translated the comment:
ā€œThe current temperature must be -55 degrees to tempNow value to get the correct value.ā€

To get the correct temperature just need to -55 from the returned value. Will post when i figure out how to change the value in code.

O wowā€¦ so itā€™s not F*?

That makes sense as when i converted 80*F to *C I get 26.6, which is higher than what the thermostat shows.

So, to make HA show the updated temp:

  • First i looked into samsung_2878.yaml. At the very beginning of this development, Sebu addressed this issue and suggested passing the unit as part of the attribute:
attributes:
    current_temperature:
      type: number
      status_template: '{% for key, value in device_state.items() %}{% if key == "AC_FUN_TEMPNOW" %}{{value}}{% endif %}{% endfor %}'
attributes:
    current_temperature:
      type: temperature #number
      status_template: '{% for key, value in device_state.items() %}{% if key == "AC_FUN_TEMPNOW" %}{{value}}{% endif %}{% endfor %}'
      unit_template: "F"

It didnā€™t work for me. So I just edited the current temperature get on climate.py, line 225:

    @property
    def current_temperature(self):
        return self.rac.get_property(ATTR_CURRENT_TEMPERATURE)

to

    @property
    def current_temperature(self):
        return (convert_temperature(self.rac.get_property(ATTR_CURRENT_TEMPERATURE), TEMP_FAHRENHEIT, TEMP_CELSIUS)-2) # -2 to adjust temp offset

But after your finding, i reckon it would be more appropriate to have

    @property
    def current_temperature(self):
        return self.rac.get_property(ATTR_CURRENT_TEMPERATURE-55)

Iā€™m not sure iā€™m 100% happy with the result as it doesnā€™t match the thermostat either. the (F to C) -2 conversion was a tad more accurate :smiley:

Let me know how you go.

1 Like
   @property
    def current_temperature(self):
        return (self.rac.get_property(ATTR_CURRENT_TEMPERATURE)-55)

Spot on! Now showing the correct temperature! Thank you!

1 Like