Samsung Smart Air Conditioner - OpenHAB 2.0

Sorry to bother you…

curl: (58) could not load PEM client certificate, OpenSSL error error:140AB18E:SSL routines:SSL_CTX_use_certificate:ca md too weak, (no key found, wrong pass phrase, or wrong file format?)

Googling for this message point me in asking for a stronger certificate :-/

I have one of the older devices that listens on 2878 too, it doesn’t seem to work with this binding.

The correct certificate is here, further up in the thread.

Has anyone managed to get this working for the older Port 2878 devices recently?

I can successfully communicate via OpenSSL directly to the devices, but can’t get the binding to work - simply receive the following errors when sending any command:

==> /var/log/openhab2/openhab.log <==

2020-02-16 18:50:51.497 [INFO ] [.samsungac.internal.SamsungAcBinding] - No refresh interval configured, using default: 60000 ms

2020-02-16 18:51:59.089 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'samsungac.items'

==> /var/log/openhab2/events.log <==

2020-02-16 18:52:05.366 [ome.event.ItemCommandEvent] - Item 'ac_power' received command ON

==> /var/log/openhab2/openhab.log <==

2020-02-16 18:52:05.526 [WARN ] [.samsungac.internal.SamsungAcBinding] - Could not send value: 'On' to property:'AC_FUN_POWER', try 1/5

2020-02-16 18:52:05.646 [WARN ] [.samsungac.internal.SamsungAcBinding] - Could not send value: 'On' to property:'AC_FUN_POWER', try 2/5

2020-02-16 18:52:05.742 [WARN ] [.samsungac.internal.SamsungAcBinding] - Could not send value: 'On' to property:'AC_FUN_POWER', try 3/5

2020-02-16 18:52:05.841 [WARN ] [.samsungac.internal.SamsungAcBinding] - Could not send value: 'On' to property:'AC_FUN_POWER', try 4/5

I deleted my ac thing (it was formely added via samsungac.cfg in the service directory) and now if I add it via paperUI (I think the cfg fle gets ignored) I get this error:

Status: OFFLINE - CONFIGURATION_ERROR Server returned HTTP response code: 400 for URL: https://192.168.10.3:8888//devices

Also when adding the thing I get in the log:

Server returned HTTP response code: 400 for URL: https://192.168.10.3:8888//files/usage.db

I have a working sh script using pem certificate…so the AC is working

I generated the pkcs12 as per documentation (adding the -nokeys option becauser there is no key file)

Latest openhab 2.5.2 with latest 3.0.0 snapshot of the binding

Any clue?

The URLs reported in the logs contain a double slash after the port…could it be the problem?

The // has been replaced with / in latest release, available here: https://www.dropbox.com/s/6awh757auaus5xt/org.openhab.binding.samsungdigitalinverter-2.5.1-SNAPSHOT.jar?dl=0

But the AC handles // just fine, no change in response.

Note that the new version is created using the 2.5.1 snapshot. My runtime is 2.5.2, and the AC woks fine. The power usage has been modified. Total power consumption is the only one in the new version.

1 Like

Thank you!
The new version seems to work!

Hi @jag, many thanks for your contribution to the community. I’ve not used it yet but plan to in the future.

Got 2 questions for you:

  • Will this binding be available in the openhab binding website/be installable within PaperUI?
  • Is there somewhere we can send you a donation for your hard work?

Hi @Nickmman. I have plans to include the binding in bistro, but have not done it yet. The Source code is available, via link in this thread. Thanks for the offer for donations, but I’ve made the binding as a part of my hobby, and as an exercise.
No donations accepted😉

1 Like

Hi All,

Anyone managed to get this working for Port 2878 devices?

Hello @bt91, do you have som sample outputs from your AC?
The binding has only been used with Samsung Digital Inverter, and works with the json response fro said device. If you could paste in some response text I could have a look.

I don’t know if this would help, but this project was made to connect to them:

Thx @Anquietas86, this helps.
Looking at the source code for the “2878 device”, I can see that they are using XML as the inforamtion bearer. This binding is written for Json, henmce it will not be able to comunicate with the 2878 device.

Yep - definitely uses XML.

The OpenHab 1 ‘samsungac’ binding is meant to work only for 2878 devices, but I can’t get it to work at all - looking at the source code and the errors generated it doesn’t actually send the message to the device but goes straight to the error (as there is no log entry for sending the commands) - but to be honest that is about the extent of my skills on the java code I could find online.

Hi Guys, I have an AR09HSSDBWK (2015) type Samsung AC. Is this an old “2878” type? How can I figure it out?

You probably have a device supporting the protocol, used by the new plugin"Samsung Digital Inverter" .

Hi Guys,
first of all i wish to thank all of you for your hard work and for sharing your knowledge.
This is my very first post… I hope to properly format my post :innocent:
I’m a really beginner in Openhab, Linux, Raspberry (basically everything :sweat_smile: ) and I’m trying to configure my AC.
I’ve read a lot of posts but I still can’t obtain a token. Someone could be so kind to help me?
I don’t want to bother anyone but I’ll try to explain my situation in detail
My AC is relatively new (2019). I’m running OpenHab on Raspberry (Raspian OS) and I’m connecting via ssh from Win 10 (Powershell). I’m using the @jag binding
I’ve placed the cert.pem (the @vaillan one) in /etc/openhab2/services, the server.py script seems running fine but the token script give me some errors.

/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.7/http/client.py", line 1336, in getresponse
    response.begin()
  File "/usr/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.7/http/client.py", line 275, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

I’ve tried to connect via openssl

openssl s_client -connect 192.168.1.111:2837 -cert /etc/openhab2/services/cert.pem

and this is my output

CONNECTED(00000003)
Can't use SSL_get_servername
depth=1 CN = Samsung Electronics OCF HA Device SubCA v1, OU = OCF HA Device SubCA, O = Samsung Electronics, C = KR
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = OCF Device: Appliance PUF (7f4a7bd2-2a70-45f1-89dd-e7a75e2ebc3b), OU = OCF HA Device, O = Samsung Electronics, C = KR
verify return:1
---
Certificate chain
 0 s:CN = OCF Device: Appliance PUF (7f4a7bd2-2a70-45f1-89dd-e7a75e2ebc3b), OU = OCF HA Device, O = Samsung Electronics, C = KR
   i:CN = Samsung Electronics OCF HA Device SubCA v1, OU = OCF HA Device SubCA, O = Samsung Electronics, C = KR
 1 s:CN = Samsung Electronics OCF HA Device SubCA v1, OU = OCF HA Device SubCA, O = Samsung Electronics, C = KR
   i:CN = Samsung Electronics OCF Root CA, OU = OCF Root CA, O = Samsung Electronics, C = KR
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICmTCCAj6gAwIBAgIUSEEwMVAxODAzMDYwMzAwMTkxOTUwDAYIKoZIzj0EAwIF
ADB+MTMwMQYDVQQDEypTYW1zdW5nIEVsZWN0cm9uaWNzIE9DRiBIQSBEZXZpY2Ug
U3ViQ0EgdjExHDAaBgNVBAsTE09DRiBIQSBEZXZpY2UgU3ViQ0ExHDAaBgNVBAoT
E1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMCAXDTE4MDMwNjEwMjYx
NloYDzIwNjkxMjMxMTQ1OTU5WjCBjjFJMEcGA1UEAxNAT0NGIERldmljZTogQXBw
bGlhbmNlIFBVRiAoN2Y0YTdiZDItMmE3MC00NWYxLTg5ZGQtZTdhNzVlMmViYzNi
KTEWMBQGA1UECxMNT0NGIEhBIERldmljZTEcMBoGA1UEChMTU2Ftc3VuZyBFbGVj
dHJvbmljczELMAkGA1UEBhMCS1IwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQP
8oI80QaWHIZzcU2nMIgwNkR/W4MQwqiOkYZY45eIIUxeAIFfsNlkQcaxPg5N1RF/
TES1UHRLY1lMbZJl3yqJo4GEMIGBMA4GA1UdDwEB/wQEAwIGwDA2BgNVHR8ELzAt
MCugKaAnhiVodHRwOi8vY3JsLnNhbXN1bmdpb3RzLmNvbS9oYXYxY2EuY3JsMDcG
CCsGAQUFBwEBBCswKTAnBggrBgEFBQcwAYYbaHR0cDovL29jc3Auc2Ftc3VuZ2lv
dHMuY29tMAwGCCqGSM49BAMCBQADRwAwRAIgAij+m3HZAqHF029KatcsXtNR4dN5
hr8UCoXQTM7ehH8CIH6k9KFpzFcg8En5vjt3un/JS8OF0nkiyo77cwLK3cT+
-----END CERTIFICATE-----
subject=CN = OCF Device: Appliance PUF (7f4a7bd2-2a70-45f1-89dd-e7a75e2ebc3b), OU = OCF HA Device, O = Samsung Electronics, C = KR

issuer=CN = Samsung Electronics OCF HA Device SubCA v1, OU = OCF HA Device SubCA, O = Samsung Electronics, C = KR
---
Acceptable client certificate CA names
CN = Samsung Electronics OCF Root CA, OU = OCF Root CA, O = Samsung Electronics, C = KR
CN = Samsung Electronics OCF HA Device SubCA v1, OU = OCF HA Device SubCA, O = Samsung Electronics, C = KR
CN = Samsung Electronics OCF Root CA TEST, OU = OCF Root CA, O = Samsung Electronics, C = KR
Client Certificate Types: RSA sign, ECDSA sign
Requested Signature Algorithms: RSA+SHA256:ECDSA+SHA256:RSA+SHA1:ECDSA+SHA1
Shared Requested Signature Algorithms: RSA+SHA256:ECDSA+SHA256:RSA+SHA1:ECDSA+SHA1
Peer signing digest: SHA256
Peer signature type: ECDSA
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 2025 bytes and written 1626 bytes
Verification error: unable to get local issuer certificate
---
New, TLSv1.2, Cipher is ECDHE-ECDSA-AES128-GCM-SHA256
Server public key is 256 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-ECDSA-AES128-GCM-SHA256
    Session-ID: 4D72D29008059ECFED5657662FC713E7CA01C29B68DF1D30E85FF02CC24BE268
    Session-ID-ctx:
    Master-Key: 513D10993C208211A349BB332B983C6199777948FDD0F15AD44797A66467AFA72F2BC5DF85DD4EA3E43E9DBD3DF5C893
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1588585716
    Timeout   : 7200 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
    Extended master secret: no
---

My AC also uses different ports (scanned using a smartphone app) that changing over the time.

Any ideas? Please I really need your help!

Hi friends,
I hope you are all healthy and doing well.
Can someone help me obtain tokens for two Samsung Wind-free AC’s?
I’ve gone over this topic, but have not been able to find my AC’s tokens.
Unfortunately I’m a noob, so explanations that might appear natural to developers are rather cryptic for us beginners.
Is there a simple tutorial explaining how to get the AC’s tokens, accompanied with “copy-paste” commands ready for usage?
This could really be helpful :pray:

Hi @jag
I’m trying to install your binding and add two samsung Windfree AC’s to my OpenHAB system.
I’m trying to get their token files based on your explanation here: https://gitlab.com/jan19/samsung-digital-inverter,
However, I think I’m doing something wrong, because I’m getting an error message when I’m trying to run server.py with python.

Here are the steps I’ve made:

  1. copy the binding’s jar file into the following location on the raspberry pi: /usr/share/openhab2/addons/org.openhab.binding.samsungdigitalinverter-2.5.1-SNAPSHOT.jar
  2. in the same folder as the jar file, I created two files: server.py and token.py and pasted the texts you mentioned for each in your explanation.
  3. (within the same folder) in terminal I run the command: python3 server.py
  4. I get this output and error message:
    pi@raspberrypi:/usr/share/openhab2/addons $ python3 server.py
    Traceback (most recent call last):
    File “server.py”, line 1, in
    from http.server import HTTPServer, BaseHTTPRequestHandler
    File “/usr/lib/python3.7/http/server.py”, line 100, in
    import shutil
    File “/usr/lib/python3.7/shutil.py”, line 22, in
    import bz2
    File “/usr/lib/python3.7/bz2.py”, line 17, in
    from threading import RLock
    File “/usr/lib/python3.7/threading.py”, line 8, in
    from traceback import format_exc as _format_exc
    File “/usr/lib/python3.7/traceback.py”, line 5, in
    import linecache
    File “/usr/lib/python3.7/linecache.py”, line 11, in
    import tokenize
    File “/usr/lib/python3.7/tokenize.py”, line 35, in
    from token import *
    File “/usr/share/openhab2/addons/token.py”, line 1
    mport requests
    ^
    SyntaxError: invalid syntax
    pi@raspberrypi:/usr/share/openhab2/addons $

Any chance you can tell me what I’m missing or doing wrong? :pray:

@mjeshurun You can try to fix the syntax error locally. Edit file /usr/share/openhab2/addons/token.py and add the missing first character i. It should be import requests not mport requests. Bad copy/paste?

1 Like