I am just starting out with OpenHAB. I have installed OH 2.0 on Ubuntu Server 16.04.1 (LTS), and I am trying to get it to work with a Samsung Smart Air Conditioner.
the SSDP discovery command will not work:
java -cp org.openhab.binding.samsungac-1.9.0.jar org.binding.openhab.samsungac.communicator.SsdpDiscovery
Error: Could not find or load main class org.binding.openhab.samsungac.communicator.SsdpDiscovery
The configuration file mentioned on that page (openhab.conf) no longer exists in OH2
The syntax for the configuration parameters seems to have changed. The wiki page mentions “samsungac:Livingroom.host=192.168.1.2”, but my /etc/openhab2/services/samsungac.cfg has lines like “Livingroom.host=192.168.1.2”
[Edit: I should have read the documentation more carefully - this is a known change in OH2 . However, it is still confusing for new users, and should be documented with the binding as well… ]
I have followed the steps here to trust my AC’s certificate and to create an “application” certificate for communicating with it. I was able to successfully connect to the AC, get a valid token, and send commands to it from the command line (MAC and token edited for obvious reasons):
However, when I start OpenHab in debug mode (/usr/share/openhab2/start_debug.sh) and watch the logs, I get… absolutely nothing:
# grep onditioner /var/log/openhab2/openhab.log
2017-01-30 03:51:47.213 [INFO ] [b.core.service.AbstractActiveService] - Samsung Air Conditioner service has been started
What else do I need to do in order to get the binding to work?
As I mentioned before, I am VERY new to OpenHab, so please explain as clearly as possible
The Problem is that Samsung don’t want that other apps can control Samsung products. They updatet the air conditioners over the smart home app. I read that one user got a roll back to a older firmware to get the acs run. Maybe it is possible to write a new binding. It look like it is possible to communicate with samsung products over the Smart Home Api http://developer.samsung.com/smart-home
I tryed to communicate over ifttt with the samsung acs. But i can not turn them on. The communiaction from openhab -> ifttt -> samsung is not realy good. Some times one Message took up to 30 minutes.
Actually, I was perfectly able to communicate with the AC (see above). I have also written my own python code to interface with them, and I’ve had no issues - I can power them on/off, set parameters, view status, etc.
I would be glad to publish my code for anyone else to try, but be warned that it’s not really user-friendly. It’s just something I hacked together - it works, but it’s neither pretty nor easy to use
This leaves two more issues:
I believe my original issue was simply because I didn’t know enough about OpenHab. The Samsung AC binding is an older one (v1.9), and such it will not populate the “Things” tab in OH 2.0 automatically. I needed to manually create the list of items and a sitemap. As soon as I did that, I did find the items and was able to turn on/off the AC from OpenHab.
In both cases (python / OpenHab), the communication works well. The delay between sending a command and getting a result is of several seconds at most.
Unfortunately, the Samsung Home API is not available to the general public - in order to download it, one needs to register as a developer (which requires a “description of the application you intend to create”). So I had to skip that for now.
I’m getting mad at this…
recovered the root certs from my units, installed for java, got from pastebin the app certificate, but if I try to connect with openssl s_client -connect 192.168.1.202:2878 -cert /tmp/cert.pem
I still cannot connect:
CONNECTED(00000003)
depth=0 C = KR, L = Suwon, O = Samsung Electronics, OU = Digital Applicance, CN = a287848, emailAddress = moweon.lee@samsung.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = KR, L = Suwon, O = Samsung Electronics, OU = Digital Applicance, CN = a287848, emailAddress = moweon.lee@samsung.com
verify error:num=21:unable to verify the first certificate
verify return:1
139727987519192:error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small:s3_clnt.c:3626:
—
Certificate chain
0 s:/C=KR/L=Suwon/O=Samsung Electronics/OU=Digital Applicance/CN=a287848/emailAddress=moweon.lee@samsung.com
i:/C=KR/L=Suwon/O=Samsung Electronics/OU=Digital Applicance/CN=a287848/emailAddress=moweon.lee@samsung.com
—
Server certificate
-----BEGIN CERTIFICATE-----
MIIDdDCCAt2gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMCS1Ix
DjAMBgNVBAcTBVN1d29uMRwwGgYDVQQKExNTYW1zdW5nIEVsZWN0cm9uaWNzMRsw
GQYDVQQLExJEaWdpdGFsIEFwcGxpY2FuY2UxEDAOBgNVBAMTB2EyODc4NDgxJTAj
BgkqhkiG9w0BCQEWFm1vd2Vvbi5sZWVAc2Ftc3VuZy5jb20wHhcNNzAwMTAxMDkw
MDEyWhcNNzAwMjAxMDkwMDEyWjCBkTELMAkGA1UEBhMCS1IxDjAMBgNVBAcTBVN1
d29uMRwwGgYDVQQKExNTYW1zdW5nIEVsZWN0cm9uaWNzMRswGQYDVQQLExJEaWdp
dGFsIEFwcGxpY2FuY2UxEDAOBgNVBAMTB2EyODc4NDgxJTAjBgkqhkiG9w0BCQEW
Fm1vd2Vvbi5sZWVAc2Ftc3VuZy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBALfwrYWYfaaKF3nYIoEAYGQsBIMg1/lzk9ixi1+odq+aewix4t/dgKiUhc59
UmP0M0POapF/zPNSxyjNqErX5gOuAd6vnnX0fhU/A/qHkRdkZPlQ/dtvhpP2nxSg
S5sx8F3GeNIyGq9fxIwcA6l7MFeEbcnkd4rb/dBQGgvEB+bXAgMBAAGjgdkwgdYw
CQYDVR0TBAIwADAkBglghkgBhvhCAQ0EFxYVIlNhbXN1bmcgZWxlY3Ryb25pY3Mi
MB0GA1UdDgQWBBSFE/e+0Y1n9RS6MrHBeLJCS0B06jBfBgNVHSMEWDBWoUmkRzBF
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkggkAvwoLvHnlSoIwCwYDVR0PBAQDAgUgMBYG
A1UdEQQPMA2CC3NhbXN1bmcuY29tMA0GCSqGSIb3DQEBBQUAA4GBAKbOrRtV+wMY
m9fB4QanD4z+cX8MboJOccmv03yBRicPIyVN1+VjQdw0gJiuQu/Ygwhj6EuhgBGk
fGbCN2tsalvtD8Ev/S75SoGMXS2SggYMm8kKjDW0AyAKRhILGs8rhGSXXFEQ8HyW
HV0i9SQ51nHmSM7uqWzcte2hyqEiKpyE
-----END CERTIFICATE-----
subject=/C=KR/L=Suwon/O=Samsung Electronics/OU=Digital Applicance/CN=a287848/emailAddress=moweon.lee@samsung.com
issuer=/C=KR/L=Suwon/O=Samsung Electronics/OU=Digital Applicance/CN=a287848/emailAddress=moweon.lee@samsung.com
—
No client certificate CA names sent
Server Temp Key: DH, 64 bits
—
SSL handshake has read 1123 bytes and written 7 bytes
—
New, (NONE), Cipher is (NONE)
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1486233252
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
—
Actually, you seem to be connecting just fine. Because I see a CONNECTED(00000003) in your listing.
Just to make sure, could you please send me the full copy/paste from your session? There should be some message from the AC at the end. In my case, it looks like the one here (notice the DPLUG and the <?xml at the end)
If you have those lines at the end, try sending a message to the AC yourself. Try copy/pasting the following line into the session, and press Enter at the end (only one Enter - two will close the session!):
No, I always get the connected commad but the full output is the one I pasted above, no XML, and end with
New, (NONE), Cipher is (NONE)
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1486317933
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
My only guess is that my certificate (the one from the app) is invalid, I got that from the pastebin link, but I don’t know if is good, I tried to extract it myself but I cannot decode the bouncycastle (I can’t find the password)
You seem to have a slightly different device (or maybe different firmware version?) - mine sends a different server certificate (CN=AC14K), and a full certificate chain. But as long as the Samsung app is able to talk to your device, we should also be able to connect directly to it. Are you able to control your device using the app? (the “in-home” feature).
One thing I noticed from your output is the following error message:
139727987519192:error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small:s3_clnt.c:3626:
It is possible that you have an older model AC, which tries to negotiate a cipher that is insecure by today’s standards. This has been disabled in some version of openssl (some time in 2015, after the Logjam attack was published).
[Edited to add the official notice regarding the update - it is here]
Unfortunately, I was unable to find a way to disable this check - as far as I can tell, this check is hardcoded in openssl. Everyone’s solution is “update the server”, but this might not be possible in our particular case…
I modified samsungac.conf (I got tokens connecting through openssl), I have created samsung.items and samsung.sitemap.fragment, but the binding doesn’t appear in openhab. Should i do anything more? I’m sorry, I’m new to openhab.
I have followed this tutorial for creating the files:
Hello, after a long time I rechecked my AC bindings, I’ve migrated to home-assistant in the meantime, but I hope this helps other people, my problem above: 139727987519192:error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small:s3_clnt.c:3626:
is a consequence of latest openSSL development, which disable SSLv3 and DH key exchange, in order to run the command I had to do this: openssl s_client -connect 192.168.1.166:2878 -cert cert.pem -cipher 'HIGH:!DH:!aNULL'
which gives me a correct output, and using other libraries:
I’ve been able to connect.
Now I could try openhab again to see if I can command the ACs, and see if I could write something for home-assistant
Hi Guys and Gals, I’m new here to the forums and have just installed OpenHAB2 for the first time. This is new ground for me and I’m here for the same thing: getting samsung aircons connected.
Any stories of actual success and any guides would be greatly appreciated.
@hotswapster - sorry about the delay in responding. Holidays got in the way :))
As mentioned before, I’d be happy to share. My only condition is that if you change/improve the code in any way, you should also share all the changes so that others can benefit from them.
Once again, I know it’s not pretty, but it works. However, there is one problem I’ve noticed - the AC simply stops responding from time to time, for very long intervals:
ssl_sock = samsung_ac.ssl_connect (creds_ac_birou.ip_addr, creds_ac_birou.port)
File "/etc/scripts/samsung_ac.py", line 24, in ssl_connect
ssl_sock.connect((ip, port))
File "/usr/lib/python3.5/ssl.py", line 1019, in connect
self._real_connect(addr, False)
File "/usr/lib/python3.5/ssl.py", line 1006, in _real_connect
socket.connect(self, addr)
OSError: [Errno 113] No route to host
Since this connection is in the same LAN, with nothing that could block/filter the traffic, I can only assume that either the AC loses WiFi connectivity, or its firmware simply stops responding…