NewGen Samsung AC Protocol

please replace the row 30 from:
print(“Request payload:”, self.rfile.read(length))
to:
print(“Request payload:”, self.rfile.read(28))

Anyway I uploaded to http://mieletunkhosting.com/server.py :wink: Please let me know, if it is works!

Yes it worked, now i got this:
----- Request Start ----->

Request path: /devicetoken/response
Content Length: 0
Request headers: Host: 192.168.1.84:8889
Accept: /

X-API-Version : v1.0.0
Content-Type: application/json
Content-Length: 28

Request payload: b’{“DeviceToken”:“Sx8UB72paG”}’
Body: <main.RequestHandler object at 0x000001FA7386B5C0>
<----- Request End -----

Ive changed the cfg to use this token, configured a few items according to the docs, but unfortunately im not getting any response.

Also tried this but absolutely no response

curl -s -X PUT -d ‘{“direction”: “All”}’ -k -H “Content-Type: application/json” -H “Authorization: Bearer Sx8UB72paG” --cert ‘c:\cert.pem’ --insecure https://192.168.93:8888/devices/0/wind

What shall I do next?

This is my cfg settings
Mancave_AC.host=192.168.1.93
Mancave_AC.mac=52c7bf734a9e
Mancave_AC.token=Sx8UB72paG

Items:

Number ac_current_temp "Current temp [%.1f]" (AC) { samsungac="[Mancave_AC|AC_FUN_TEMPNOW]" }
Switch ac_power                              (AC) { samsungac="[Mancave_AC|AC_FUN_POWER]" }
Number ac_mode "Convenience mode"            (AC) { samsungac="[Mancave_AC|AC_FUN_COMODE]" }
Number ac_op_mode "Operation mode"           (AC) { samsungac="[Mancave_AC|AC_FUN_OPMODE]" }
Number ac_set_temp "Set temp [%.1f]"         (AC) { samsungac="[Mancave_AC|AC_FUN_TEMPSET]" }
Number ac_direction "Direction"              (AC) { samsungac="[Mancave_AC|AC_FUN_DIRECTION]" }
Number ac_windlevel "Windlevel"              (AC) { samsungac="[Mancave_AC|AC_FUN_WINDLEVEL]" }

Could be related to the samsung AC or not, but noticed this error in the log since i installed this binding

2019-01-23 23:42:33.918 [ERROR] [org.jupnp.transport.spi.StreamClient] - Request: HttpRequest[GET /capability HTTP/1.1]@1d63285 failed
java.lang.NullPointerException: Missing SslContextFactory
at java.util.Objects.requireNonNull(Unknown Source) ~[?:?]
at org.eclipse.jetty.io.ssl.SslClientConnectionFactory.(SslClientConnectionFactory.java:50) ~[75:org.eclipse.jetty.io:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpClient.newSslClientConnectionFactory(HttpClient.java:1155) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpDestination.newSslClientConnectionFactory(HttpDestination.java:138) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpDestination.(HttpDestination.java:95) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.PoolingHttpDestination.(PoolingHttpDestination.java:25) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.(HttpDestinationOverHTTP.java:32) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.http.HttpClientTransportOverHTTP.newHttpDestination(HttpClientTransportOverHTTP.java:51) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpClient.destinationFor(HttpClient.java:539) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:572) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:727) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:680) ~[71:org.eclipse.jetty.client:9.4.11.v20180605]
at org.jupnp.transport.impl.jetty.JettyStreamClientImpl$1.call(JettyStreamClientImpl.java:155) [206:org.jupnp:2.5.1]
at org.jupnp.transport.impl.jetty.JettyStreamClientImpl$1.call(JettyStreamClientImpl.java:1) [206:org.jupnp:2.5.1]
at org.jupnp.transport.spi.AbstractStreamClient$RequestWrapper.call(AbstractStreamClient.java:204) [206:org.jupnp:2.5.1]
at org.jupnp.transport.spi.AbstractStreamClient$RequestWrapper.call(AbstractStreamClient.java:1) [206:org.jupnp:2.5.1]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]

As I know, unfortunately new Samsung AC Protocol with port 8888 is not working with that binding. I am using exec binding instead of this.

Ok, thank you.
Do you have any idea if there are plans to update the binding to the more recent models?
How about the exec binding? can you post the procedure of how to set that up please?
Maybe post your setup as an example
Cheers

My setup is the 4th post, you can check that, script provided, please pm me if you need more info :wink:

Hi.
I have created a new binding, for the Samsung Digital Inverter.
It is currently under testing in my living room.
The following channels are implemented, and it only supports the new son format from the Inverter.

  • power Switch Power On/Off the Inverter
  • autoclean Switch Enable/Disable Autoclean
  • setpoint_temperature Number:Temperature Desired Temperature
  • temperature Number:Temperature Measured Temperature
  • outdoor_temperature Number:Temperature Outdoor Unit Temperature
  • winddirection String Set Wind Direction Automatic=All, Up and Down=Up_And_Low, Left and Right=Left_And_Right, Fixed=Fix
  • windspeed Number Set windspeed Auto=0, Low=1, Medium=2, High=3, Turbo=4
  • operation_mode String Set operating mode Auto, Heat, Cool, Dry, Wind
  • comode StringComfort Settings: Normal=Comode_Off, Quiet=Comode_Quiet, Comfort=Comode_Comfort, Smart=Comode_Smart, 25Step=Comode_25Step
  • filtertime Number Operating hours since last Filter Cleaning
  • filteralarmtime Number Set Thershold for Filter Cleaning Interval
  • alarm String Device Alarm Status
3 Likes

great, any chance to test it out, more than willing to give u feedback :grinning:

I’ve been browsing all the issues and forums about controlling Samsung ACs, but all the solutions fail for me simply because the AC is not listening on either of those ports. I’ve tried turning it on and off around, but still nothing.
I have the Windfree AC model (if that somehow helps)

~ # nmap -sS -p 2878,8888 192.168.1.11
Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-27 18:25 UTC
Nmap scan report for 192.168.1.11
Host is up (0.053s latency).

PORT     STATE  SERVICE
2878/tcp closed aap
8888/tcp closed sun-answerbook
MAC Address: 70:2C:1F:5F:2A:C1 (Wisol)

Nmap done: 1 IP address (1 host up) scanned in 1.12 seconds

Hi Skavan
Did you managed to decode the usage.db file for the energy readings?

Samsung hat die Geräte auf Smath Things upgedatet, mit einen Portscanner kann man im AP Modus den Port finden. Bitte alle Ports scannen! Smart Thing wechselt auch manchmal den Port, warscheinlich wenn eine neue Verbindung aufgebaut wird. Der Zugriff funktioniert leider wie es aussieht nur noch über die Cloud, die App funktioniert nur noch über die cloud. Kein Internet und die App wird nicht funktionieren. Mir gefällt das gar nicht was Samsung da gemacht hat!
Ich hänge gerade hier:


Ihr könnt das auch testen, aber immer vorher nach den Port scannen!

OPENHAB läuft bei mir auf einer Synology DS 718 Plus.

Ein Zertifikat bekommt man im AP Modus wenn man sich mit WLAN verbindet Passwort 1111122222, dann mit den Port Scanner den Port suchen und mit den edge Browser sich dahin verbinden, danach das Zertifikat exportieren. Weiss nur nicht wie ich mit diesen Zertifikat weiter komme.

Wir brauchen das samung electronics ocf root ca Zertifikat, " ausgestellt für" und “ausgestellt von” muss da gleich sein


Samsung hat den Zugriff aus den lokalen Netz deaktiviert wie es aussieht, das geht überhaupt nicht!
voc@samsung.de
Ihr könnt hier nachfragen warum das von Samsung so gemacht wurde.

Does anyone know whether the above-described process (including the cert posted above) for getting the token will work for Samsung smart washers and dryers?

Has anyone had any progress with communication with newer Samsung A/C (SmartThings).

I have been struggling with this for my Samsung Smart Home Exclusive 9 heat pump (model AR09NXPDPWKNEE). Getting it working with the SmartThings app was fairly easy. I then found the mac address from the AP web interface, and found the IP by looking in the arp cache on the router.

Using nmap I found a single port listening (and after a few days when I tried again the port had changed). I have connected with openssl, but don’t know how to proceed:

[spiff@ohserver samsung-ac]$ openssl s_client -connect 10.15.40.120:65021 -cert ./cert.pem
CONNECTED(00000003)
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
---
Certificate chain
 0 s:/CN=OCF Device: Appliance PUF (103c9a2f-d32e-4b0f-a61f-a8014573a20d)/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-----
MIICmzCCAj6gAwIBAgIUSEEwMVAxODAzMDYwMzAzMTQxNzkwDAYIKoZIzj0EAwIF
ADB+MTMwMQYDVQQDEypTYW1zdW5nIEVsZWN0cm9uaWNzIE9DRiBIQSBEZXZpY2Ug
U3ViQ0EgdjExHDAaBgNVBAsTE09DRiBIQSBEZXZpY2UgU3ViQ0ExHDAaBgNVBAoT
E1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMCAXDTE4MDMwNjEyMTEz
M1oYDzIwNjkxMjMxMTQ1OTU5WjCBjjFJMEcGA1UEAxNAT0NGIERldmljZTogQXBw
bGlhbmNlIFBVRiAoMTAzYzlhMmYtZDMyZS00YjBmLWE2MWYtYTgwMTQ1NzNhMjBk
KTEWMBQGA1UECxMNT0NGIEhBIERldmljZTEcMBoGA1UEChMTU2Ftc3VuZyBFbGVj
dHJvbmljczELMAkGA1UEBhMCS1IwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASW
pmFXZHosTYZjuc3ipRzjobow4x8YETJnD+HfyT6hAdyUrxpORDqrQ2HhrzuqWhF2
zjVEI315avjIpTHy65Dbo4GEMIGBMA4GA1UdDwEB/wQEAwIGwDA2BgNVHR8ELzAt
MCugKaAnhiVodHRwOi8vY3JsLnNhbXN1bmdpb3RzLmNvbS9oYXYxY2EuY3JsMDcG
CCsGAQUFBwEBBCswKTAnBggrBgEFBQcwAYYbaHR0cDovL29jc3Auc2Ftc3VuZ2lv
dHMuY29tMAwGCCqGSM49BAMCBQADSQAwRgIhAKhVUXMi/KngieCc+k8ldQUTLcu+
CWWggpr6yqW2xbvrAiEAzAnF0FIv9Cb8eW6fP+WrQESvqjnJu2ia8upaK9/svEU=
-----END CERTIFICATE-----
subject=/CN=OCF Device: Appliance PUF (103c9a2f-d32e-4b0f-a61f-a8014573a20d)/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
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 2026 bytes and written 1513 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: B4CCD8DFC57CBEEBE12183334489A2495B07F8330A792825DF3644A3DBEA0ED0
    Session-ID-ctx:
    Master-Key: 1DC971512310470ADE4352C13FA892479F98F5B768DF56876443859CC2A00F3162B7E882E7280ABC01AF81DE5BBF7349
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1561907398
    Timeout   : 7200 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
    Extended master secret: no
---

Any suggestions? I chose this heat pump because I thought it would work with OH, but it seems that is not straight forward. I would really like to get rid of Samsungs cloud connection and being able to control my A/C from OH.

Hi,
the new heat pumps seem to be using the SmartThings Cloud.
This boils down to a normal OAuth + REST cloud flow:
https://smartthings.developer.samsung.com/docs/api-ref/st-api.html

You can request a token for your own devices by registering as a developer and requesting a personal token:
“Personal access tokens are used to interact with the API for non-SmartApp use cases. They can be created and managed on the personal access tokens page.”

Am not well-versed enough to do something with this but here you should be able to use the API.

For Binding purposes maybe a deployed app would work better - maybe this would help: https://github.com/bradymholt/smartthings-rest-api

Best,
Stefan

1 Like

Hi,

I have a question regarding the use of the script written by miklosandras
I was able to get the token, created the file control_samsung.sh and stopped here.
I don’t know what to add in the openhab items section to make it work

any hint?

Hi.
Do you have the older Samsung Digital Inverter or one of the new models?
There is at least 3 generations with different communication protocols…