Samsung AC / Port changed to 8888


I am trying to use org.openhab.binding.samsungac to connect to Samsung RACs, that were installed a month ago.

I am using the certificate from the android app and the binding from org.openhab.binding.samsungac_1.9.0.SNAPSHOT-20160404. However, this seems to insist on connecting on the (now) defunct port 2878 instead of 8888

OpenHAB log excerpt:
[DEBUG] [.b.s.internal.SamsungAcBinding:57 ] - Started Samsung AC Binding [INFO ] [.b.s.internal.SamsungAcBinding:202 ] - No refresh interval configured, using default: 60000 ms [DEBUG] [.b.s.internal.SamsungAcBinding:208 ] - Configuration key is: Livingroom.certificate [DEBUG] [.b.s.internal.SamsungAcBinding:208 ] - Configuration key is: [DEBUG] [.b.s.internal.SamsungAcBinding:208 ] - Configuration key is: Livingroom.mac [DEBUG] [.b.s.internal.SamsungAcBinding:208 ] - Configuration key is: [INFO ] [.service.AbstractActiveService:169 ] - Samsung Air Conditioner service has been started [DEBUG] [.b.s.internal.SamsungAcBinding:286 ] - Broken connection found for 'Livingroom', attempting to reconnect... [DEBUG] [.b.s.internal.SamsungAcBinding:294 ] - java.lang.Exception: Cannot connect to 10.x.x.x:2878 : Connection refused

Conf in openhab.cfg:





Any ideas or plans to make the port configurable? Or is it just not reasonable to do that because the whole protocol changed?

Thanks for all the great work that went into creating and maintaining this binding so far, by the way!

Also see the thread over at github, where this is also mentioned (in a way).

Cheers, Gabe

I will submit a PR and provide you a JAR to test, but I currently don’t know what the most suitable default port value should be for the predominant number of users of this binding. I don’t want to break the existing users’ configurations, but if, for example, everyone’s firmware gets updated automatically, then that would be an argument to make the default 8888. Absent any clear and definitive answer, I will leave the default 2878.

Try this JAR and add a samsungac:port=8888 parameter to your openhab.cfg file, and let me know if it works!

Here is the pull request (#4522).

Thanks, I tried it. It seems to try to communicate with the 1st rac in the conf, but then nothing:

08:52:06.246 [DEBUG] [.b.s.internal.SamsungAcBinding:57   ] - Started Samsung AC Binding
08:52:06.247 [INFO ] [.b.s.internal.SamsungAcBinding:203  ] - No refresh interval configured, using default: 60000 ms
08:52:06.247 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: KiZi.certificate
08:52:06.250 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is:
08:52:06.251 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: KiZi.mac
08:52:06.251 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: KiZi.port
08:52:06.251 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is:
08:52:06.251 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: SZ.certificate
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is:
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: SZ.mac
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: SZ.port
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: WZ.certificate
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is:
08:52:06.252 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: WZ.mac
08:52:06.253 [DEBUG] [.b.s.internal.SamsungAcBinding:209  ] - Configuration key is: WZ.port
08:52:06.260 [DEBUG] [.b.s.internal.SamsungAcBinding:295  ] - Broken connection found for 'WZ', attempting to reconnect...
08:52:06.260 [DEBUG] [.o.b.s.internal.AirConditioner:273  ] - Disconnected so we'll try again
08:52:06.260 [DEBUG] [.o.b.s.internal.AirConditioner:99   ] - Disconnected from AC: 10.X.X.X
08:52:09.693 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:11.696 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:15.700 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:19.701 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:23.705 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:27.708 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:31.710 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:35.713 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:39.714 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:43.717 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:47.719 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:51.721 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:55.725 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:52:59.727 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC
08:53:03.729 [DEBUG] [.o.b.s.internal.AirConditioner:261  ] - Nothing more to read from AC

Conf excerpt:
# samsungac:WZ.token=
# samsungac:WZ.password=something
# samsungac:SZ.token=
# samsungac:SZ.password=something
# samsungac:KiZi.token=
# samsungac:KiZi.password=something

Do you have any ideas?

Can you get the attention of other Samsung AC users here on the forum for their input? I don’t have such a unit and so I don’t know what a proper configuration should be. I’m wondering if the proper port number could be discovered using the SsdpDiscovery process in the binding, but again I lack knowledge of these devices.

Hi John. I have recently bought a Samsung Smart AC and bumped into this issue where the default-latest openhab binding doesn’t work due to the port change. My symptoms are the same just like allisgray’s comment above.
I am able to communicate with the AC using “openssl s_client -connect -cert cert.pem” so the connection looks fine. But something is still not working properly as I am not able to get your jar file above working. I don’t even get a token from the AC. I am open for any suggestions and testing for beta bindings.

@powerwade I don’t have a Samsung air conditioner and so can’t test the change myself. I merged it without getting testing feedback because it fixed a few other issues, and the binding will otherwise work as well or badly with the change. So my test JAR should be the same as the “official” one which is built here nightly.

Could you share your .cfg file settings for this binding so I can verify that what you are trying is at least at the limits of my ability to advise? Also, if on openHAB 1.8.3, add

<logger name="org.openhab.binding.samsungac" level="TRACE"/>

to your logback.xml file. Or if on openHAB 2 beta/nightly, at the openhab> prompt type

log:set TRACE org.openhab.binding.samsungac

The extra logging might prove helpful.

Thanks for the prompt reply. Downloaded the nightly jar file and I set the loglevel to TRACE as suggested and restarted OH however I cannot see any further, useful messages in openhab’s log.

here’s the binding config

and my openhab.log

22:46:40.705 [DEBUG] [.s.internal.SamsungAcActivator:33 ] - Samsung AC binding has been started.
22:46:40.731 [DEBUG] [.b.s.internal.SamsungAcBinding:57 ] - Started Samsung AC Binding
22:46:40.734 [INFO ] [.b.s.internal.SamsungAcBinding:203 ] - No refresh interval configured, using default: 60000 ms
22:46:40.735 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.certificate
22:46:40.742 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is:
22:46:40.742 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.mac
22:46:40.744 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.port
22:46:40.745 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is:
22:46:40.746 [INFO ] [.service.AbstractActiveService:169 ] - Samsung Air Conditioner service has been started
22:46:40.748 [DEBUG] [.b.s.internal.SamsungAcBinding:295 ] - Broken connection found for ‘NappaliAC’, attempting to reconnect…
22:46:40.749 [DEBUG] [.o.b.s.internal.AirConditioner:273 ] - Disconnected so we’ll try again
22:46:40.751 [DEBUG] [.o.b.s.internal.AirConditioner:99 ] - Disconnected from AC:
22:46:42.949 [DEBUG] [.o.b.s.internal.AirConditioner:261 ] - Nothing more to read from AC
22:46:44.952 [DEBUG] [.o.b.s.internal.AirConditioner:261 ] - Nothing more to read from AC

It’s not certain if I’ve followed the code correctly from those log messages, but my bet is that not only has the port number changed, but so has the protocol used, and I suspect that the binding is getting stuck here. If you can find any information through searches regarding a changed Samsung Air Conditioner protocol on port 8888, I will have a look, but it might take someone with such an air conditioner to get it going again. @stein_tore_tosse, any thoughts?

Samsung has done some changed to the protocol since I first implemented this binding, so it might not work for the newer once.

My AC is stuck on an old release as it has no internet connection.

It could be possible to add some more information about the error message you should receive when OpenHAB fails to connect to the air conditioner.

I think it always says “Broken connection” the first time you start it, cause it has no connection.

If the ssl handshake had failed then an exception would have been thrown and it would have been logged. Now it tries to read from port 8888, but it doesn’t get any data, thus it prints “Nothing to read from AC” (which is not an actual error, just information that there is no more data to read)

What happens if you change something on your air conditioner or try to send commands to the air conditioner?

Is there a reason why your token is commented?

The token is still needed when you use your certificate.

I looked again at the code and it seems like the binding will wait to receive a token, that might explain the “Nothing more to read from AC”

Can you test again with the token, and give me feedback on the result?

The reason the token was commented out is that I have never been able to get a token from the AC - so that’s is just a dummy one (copied-pasted from some forum post)

So when I uncomment the token line in the config, I see the following

2017-01-04 12:32:47.104 [DEBUG] [.b.s.internal.SamsungAcBinding:57 ] - Started Samsung AC Binding
2017-01-04 12:32:47.109 [INFO ] [.b.s.internal.SamsungAcBinding:203 ] - No refresh interval configured, using default: 60000 ms
2017-01-04 12:32:47.110 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.certificate
2017-01-04 12:32:47.118 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is:
2017-01-04 12:32:47.119 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.mac
2017-01-04 12:32:47.119 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.port
2017-01-04 12:32:47.120 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is: NappaliAC.token
2017-01-04 12:32:47.122 [DEBUG] [.b.s.internal.SamsungAcBinding:209 ] - Configuration key is:
2017-01-04 12:32:47.129 [INFO ] [.service.AbstractActiveService:169 ] - Samsung Air Conditioner service has been started
2017-01-04 12:32:47.130 [DEBUG] [.b.s.internal.SamsungAcBinding:295 ] - Broken connection found for ‘NappaliAC’, attempting to reconnect…
2017-01-04 12:32:47.131 [DEBUG] [.o.b.s.internal.AirConditioner:273 ] - Disconnected so we’ll try again
2017-01-04 12:32:47.131 [DEBUG] [.o.b.s.internal.AirConditioner:99 ] - Disconnected from AC:
2017-01-04 12:32:56.618 [DEBUG] [.o.b.s.internal.AirConditioner:261 ] - Nothing more to read from AC
2017-01-04 12:32:56.618 [DEBUG] [.o.b.s.internal.AirConditioner:130 ] - Token has been acquired: ‘6acb7452-bb3f-429c-912c-72bfbb5bf052’
2017-01-04 12:32:56.618 [DEBUG] [.o.b.s.internal.AirConditioner:236 ] - Sending request:’‘
2017-01-04 12:32:56.769 [DEBUG] [.o.b.s.internal.AirConditioner:231 ] - Got response:’‘
2017-01-04 12:32:56.770 [DEBUG] [.o.b.s.internal.AirConditioner:236 ] - Sending request:’'
2017-01-04 12:32:56.781 [DEBUG] [.o.b.s.internal.AirConditioner:247 ] - Could not write line. Disconnecting.
at org.openhab.binding.samsungac.internal.AirConditioner.writeLine( [bundlefile:na]
at org.openhab.binding.samsungac.internal.AirConditioner.getStatus( [bundlefile:na]
at org.openhab.binding.samsungac.internal.AirConditioner.loginWithToken( [bundlefile:na]
at org.openhab.binding.samsungac.internal.AirConditioner.login( [bundlefile:na]
at org.openhab.binding.samsungac.internal.SamsungAcBinding.reconnectToAirConditioner( [bundlefile:na]
at org.openhab.binding.samsungac.internal.SamsungAcBinding.execute( [bundlefile:na]
2017-01-04 12:32:56.782 [DEBUG] [.o.b.s.internal.AirConditioner:99 ] - Disconnected from AC:
2017-01-04 12:32:56.783 [DEBUG] [.o.b.s.internal.AirConditioner:80 ] - Disconnecting… with exception: java.lang.Exception: Could not update status for air conditioner with IP:
2017-01-04 12:32:56.783 [DEBUG] [.o.b.s.internal.AirConditioner:99 ] - Disconnected from AC:
2017-01-04 12:32:56.783 [DEBUG] [.b.s.internal.SamsungAcBinding:303 ] - Caught exception: java.lang.Exception: Could not update status for air conditioner with IP: : Connection closed by remote host
2017-01-04 12:32:56.783 [DEBUG] [.b.s.internal.SamsungAcBinding:305 ] - Reconnect failed for ‘NappaliAC’, will retry in 60s

Sorry mate, but it seems like Samsung has changed it’s protocol/interface and that the code I wrote for my “old” one is not working for you.

To verify that something is changed you could try to install and run this code, which is basically the same as mine, just written for Node.

Thanks Stein. I am not familiar with node, not sure how to test this code above. However I have a bad feeling that when Samsung changed their firmware they changed the interface and protocol as well as you said… so these codes and the binding are useless for newer Samsung Smart ACs. What a pity, this binding was the only reason I bought this AC :slight_smile: Thanks for trying to help here.
Anyway, maybe sooner or later someone who owns a newer model might finds a way to communicate the device and update the binding.

Hi. Also having problems connecting to Samsung AC. Suspected port is the issue, i managed to get service discovery response using node.js:
Got a response to an m-search:
“DATE”: “Wed Apr 19 19:43:21 2017”,
“EXT”: “”,
“CACHE-CONTROL”: “max-age = 1800”,
“USN”: “uuid:::urn:SmartHomeAlliance-org:d
evice:Air_Conditioner:1.0 deviceSubType/Room_Air_Conditioner modleID/TP6X_RAC_16
“SERVER”: “Linux/2.6 SHP/1.0 Air_Conditioner/1.0 deviceSubType/Room_Air_Condit
ioner modleID/TP6X_RAC_16K”,
The openssl command connects successfully to 8888. Can you please add port as configurable variable in binding. The link to binding on dropbox is not available any more.

UPDATE: Managed to get certificate, and import it to certificate store as detailed here, but i still get the error:

depth=3 C = KR, O = Samsung Electronics, CN = ROOTCA
verify error:num=19:self signed certificate in certificate chain
verify return:0

I checked, and the “/etc/ssl/certs/samsungcert.pem” is present in keystore. Karaf console log states:

21:25:27.076 [DEBUG] [.samsungac.internal.SamsungAcBinding] - Broken connection found for ‘Aircondition’, attempting to reconnect…
21:25:27.078 [DEBUG] [ng.samsungac.internal.AirConditioner] - Disconnected so we’ll try again
21:25:27.080 [DEBUG] [ng.samsungac.internal.AirConditioner] - Disconnected from AC:
21:25:27.647 [DEBUG] [ng.samsungac.internal.AirConditioner] - Disconnecting… with exception: java.lang.Exception: Could not connect using certificate: /etc/openhab2/services/cert.pem
21:25:27.649 [DEBUG] [ng.samsungac.internal.AirConditioner] - Disconnected from AC:
21:25:27.651 [DEBUG] [.samsungac.internal.SamsungAcBinding] - Caught exception: java.lang.Exception: Could not connect using certificate: /etc/openhab2/services/cert.pem : PKIX path building failed: unable to find valid certification path to requested target
21:25:27.653 [DEBUG] [.samsungac.internal.SamsungAcBinding] - Reconnect failed for ‘Aircondition’, will retry in 60s

Obviously a certificate problem. Can anyone suggest what am I doing wrong?

I just got a new samsung better AC. I can not get the token. My version is also listening on port 8888.

root@raspberrypi:~# curl -XPOST -H "Content-Type: text/xml" -d "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Request Type=\"GetToken\" />" --cert /etc/openhab2/services/cert.pem "" --insecure
{"errorCode":"0","errorDescription":"Token is not valid"}

Anyone can help me how can I get it?

Meanwhile we are closer to get it working.

With workaround of mapilarc of getting the proper token, and marko3dana’s samples to controll the Air conditioner.

Excellent job! Check out this:

Hi just got a new Samsung AC, also having trouble getting the certificate and token
So far this is what i get when i do an ssl connection using the following command:
s_client -connect

I get this log>
Loading ‘screen’ into random state - done
depth=3 /C=KR/O=Samsung Electronics/CN=ROOTCA
verify error:num=19:self signed certificate in certificate chain
verify return:0

Certificate chain
0 s:/C=KR/O=Samsung Electronics/CN=DA_SET/
i:/C=KR/O=Samsung Electronics/CN=DeviceCA/
1 s:/C=KR/O=Samsung Electronics/CN=DeviceCA/
i:/C=KR/O=Samsung Electronics/CN=CECA
2 s:/C=KR/O=Samsung Electronics/CN=CECA
i:/C=KR/O=Samsung Electronics/CN=ROOTCA
3 s:/C=KR/O=Samsung Electronics/CN=ROOTCA
i:/C=KR/O=Samsung Electronics/CN=ROOTCA

Server certificate
subject=/C=KR/O=Samsung Electronics/CN=DA_SET/
issuer=/C=KR/O=Samsung Electronics/CN=DeviceCA/

Acceptable client certificate CA names
/C=KR/O=Samsung Electronics/CN=DeviceCA/
/C=KR/O=Samsung Electronics/CN=RemoteAccessCA(CE)
/C=KR/O=Samsung Electronics/CN=CECA
/C=KR/O=Samsung Electronics/CN=ROOTCA

SSL handshake has read 4577 bytes and written 462 bytes

New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: 07116E0D1CCB8521FF591BD1DB73A1345EA7C814422153E31AE6FA2AC25C65A0
Master-Key: 14A4003C3E9FA23B4B5BF51FED6AD64B2D5BCD33DC19A50917BD8E6B7FCA062CB34CB04D111B9C5F0C46F5A7CA336C8A
Key-Arg : None
Start Time: 1548203854
Timeout : 300 (sec)
Verify return code: 19 (self signed certificate in certificate chain)


Got no idea what to do from here…

Visit this topic, we have a solution for that :slight_smile: