There might be some ssl errors. If experienced, try implementing the solution at ssl - Certificate error after upgrade to 20.04 - Ask Ubuntu
Hi @jag
Thank you for the suggestion.
I tried changing the fike name, but I still get an error message.
pi@raspberrypi:/usr/share/openhab2/addons $ sudo mv server.py sd_server.py
pi@raspberrypi:/usr/share/openhab2/addons $ sudo python3 sd_server.py
Traceback (most recent call last):
File "sd_server.py", line 1, in <module>
from http.server import HTTPServer, BaseHTTPRequestHandler
File "/usr/lib/python3.7/http/server.py", line 100, in <module>
import shutil
File "/usr/lib/python3.7/shutil.py", line 22, in <module>
import bz2
File "/usr/lib/python3.7/bz2.py", line 17, in <module>
from threading import RLock
File "/usr/lib/python3.7/threading.py", line 8, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.7/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.7/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.7/tokenize.py", line 35, in <module>
from token import *
File "/usr/share/openhab2/addons/token.py", line 1, in <module>
import requests
File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 3, in <module>
import logging
File "/usr/lib/python3.7/logging/__init__.py", line 210, in <module>
_lock = threading.RLock()
AttributeError: module 'threading' has no attribute 'RLock'
Thanks Jan!
I got a step further, whereas not with your file.
Steps and status:
- I did a
sudo git clone https://github.com/cicciovo/homebridge-samsung-airconditioner.git
of this github repo - Followed the advice given here as per your remark Jan
- Executed
sudo python Server8889.py
which successfully starts the server listening on port 8889 - In a new shell, executed
curl -k -H "Content-Type: application/json" -H "DeviceToken: xxxxxxxxxxx" --cert /usr/local/lib/node_modules/homebridge-samsung-airconditioner/ac14k_m.pem --insecure -X POST https://192.168.1.152:8888/devicetoken/request
changing the IP - Sadly I am stuck as I get a
curl: (7) Failed to connect to IP port 8888: Connection refused
I assume above is connected to the port (8888) which might be different ?!
edit: it might also be connected to this change Samsung didâŚ
edit2: Did a port scan via NMAP and indeed it shows only ports 49153/49154/49155 UDP openâŚ
samsungac.xml (15.2 KB)
@chrismast, your portscan does not find any tcp ports open. You could try to power off, and power on again. Then try curl (or portscan) within 3o seconds.
But may be Samsung AC has to be registered with Samsung Smart Things, to enable the http interface?
I donât understand how the AC can be managed from SST, with only UDP open.
Port scan of my Samsung Digital Inverter
PORT STATE SERVICE
8888/tcp open sun-answerbook
Hello guys,
any updates on this here?
I got also new Samsung AC Windfree climate units with integrated WIFI modules (Modeltype AR07TXFCAWKNEU, Windfree Comfort NASA) which I want to integrate to openhab 2.5 .
I tried the Samsung a/c binding - which doesn´t work. Guess it´s quite old version and was running well with openhab1.x but not with newer versions of openhab / samsung AC´s.
So I also tried to use the Samsung Smartthings binding but obviously I would need to buy a Samsung Smartthings Hub? I´m using Hue Bridge already and don´t want to use another Hub from SamsungâŚI also was reading that Samsung discontinued the Hub already?
So long question short: How to get my Samsung Wifi AC units to openhab? Which binding to use? Any documentation available?
Thank you and best regards,
Mario
Hello.
To use the binding for Samsung Digital Inverter, you have to download a token, which is unique for your device. This must be done before configuring thee binding.
I donât know if you device will accept http, as others have had problems connecting to newer devices (Windfree). If your device does not support http, then my binding will not support it.
I followed the instrucstions â start openhab2 service in debug mode and searched the logs for AirConditioner. Turned on and off the AC but I don´t get one single entry in my log files like described here:
WARN o.b.o.s.c.AirConditioner[:179]- NO TOKEN SET! Please switch off and on the air conditioner within 30 seconds
So at the moment I don´t know how to continueâŚ
Hello @Mario084 , seems like you are using the binding for the old type of Air Conditioner, I do not know that binding, and doubt it will work with modern devices. The old devices used XML, whereas the newer ones use json as information bearer.
Yes - that´s the version I can install directly under Add-Ons / Bindings.
Do you have a newer one?
Where to download?
Thx!
Okay I found your latest Binding and instructionsâŚ
The webserver is up and running
[21:49:40] openhabian@openhab:/usr/share/openhab2/addons$ sudo python3 sdi_server.py
Listening on localhost:8889
But when I want to start the sdi_token.py I receive the following errors:
[21:58:59] openhabian@openhab:/usr/share/openhab2/addons$ sudo python3 sdi_token.py
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
During handling of the above exception, another exception occurred:
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 343, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0xb5f9fa90>: Failed to establish a new connection: [Errno -5] No address associated with hostname
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='samsungdi', port=8888): Max retries exceeded with url: /devicetoken/request (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5f9fa90>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "sdi_token.py", line 4, in <module>
resp = s.post("https://SamsungDI:8888/devicetoken/request", data={"DeviceToken":"xxxxxxxxxxx"}, headers=headers, stream=True, verify=False, cert='/etc/openhab2/services/cert.pem')
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='samsungdi', port=8888): Max retries exceeded with url: /devicetoken/request (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5f9fa90>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))
Any ideas how to fix this?
Thank you!
Br,
Mario
Meanwhile I port scanned the Samsung AC unit with the following result:
With command openssl I am also able connect through this port:
[22:02:39] openhabian@openhab:/usr/share/openhab2/addons$ openssl s_client -connect 192.168.1.150:8443 -cert cert.pem
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 (7837eaf5-8781-4d05-83a3-b91d0e1ff4ae), OU = OCF HA Device, O = Samsung Electronics, C = KR
verify return:1
---
Certificate chain
0 s:CN = OCF Device: Appliance PUF (7837eaf5-8781-4d05-83a3-b91d0e1ff4ae), 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-----
MIICmjCCAj6gAwIBAgIUSEEwMVAyMDAxMDgwNDAwNjQzNDUwDAYIKoZIzj0EAwIF
ADB+MTMwMQYDVQQDEypTYW1zdW5nIEVsZWN0cm9uaWNzIE9DRiBIQSBEZXZpY2Ug
U3ViQ0EgdjExHDAaBgNVBAsTE09DRiBIQSBEZXZpY2UgU3ViQ0ExHDAaBgNVBAoT
E1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMCAXDTIwMDEwNzIyMzUx
MFoYDzIwNjkxMjMxMTQ1OTU5WjCBjjFJMEcGA1UEAxNAT0NGIERldmljZTogQXBw
bGlhbmNlIFBVRiAoNzgzN2VhZjUtODc4MS00ZDA1LTgzYTMtYjkxZDBlMWZmNGFl
KTEWMBQGA1UECxMNT0NGIEhBIERldmljZTEcMBoGA1UEChMTU2Ftc3VuZyBFbGVj
dHJvbmljczELMAkGA1UEBhMCS1IwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT6
YwcQU9EJ9Wlb2mZUMEJt+lrZhujDyndMSjvRtuBcTksv22n8aBse4E+aKgkEX+q9
MNykwXOopEvrbZfKiX7Go4GEMIGBMDcGCCsGAQUFBwEBBCswKTAnBggrBgEFBQcw
....................
Any suggestions how to continue ?
Update from 05.04.2021:
So the port is also changing of my 2021 Samsung Windfree unit. Today it´s running on port 1857.
So any chance to use this binding even with changing ports or is it waste of time?
Otherwise I try to use the Rest API for Smartthings to workâŚ
Thanks!
Hi @jag!
Iâve got Samsung Windfree ACs installed yesterday as well, so I am now highly interested in seeing official support in openHAB3 for that.
Would it make sense that your create a PR against openhab-addons for your binding? We could then collaborate on that PR and I could help getting the token retrieval as part of the binding as well as this currently seems to be a step that many people struggle with. Wdyt?
In moments like these, I wish I had the coding expertise to help you guys develop the official binding. Unfortunately, I donât
But for what itâs worth, I can offer my help with any beta testing needed
Same here guys, happy to test any beta version on my test OH VM. Got a windfree AC readily available.
Hi @Kai
It would be a honor to have my binding as an official binding with OH.
I strongly agree about the token part. It takes som technical knowledge that not everybody has. I really ned some help with the PR.
@jag Small question,
Could it be that the process to getting the token fails, because we have our Windfree ACâs also connected to the Samsung SmartThings app?
I just realized that when I configured the OpenHAB Broadlink binding, we had to make sure not to connect our Broadlink RM devices to the phone app.
Hi @jag,
I have created an initial PR against the openHAB repo at Initial contribution of SamsungAC binding by kaikreuzer ¡ Pull Request #10938 ¡ openhab/openhab-addons ¡ GitHub.
I did some clean-up of the code base and adjusted it to the required format. I also took the liberty to rename it to âsamsungacâ as this is what we had for openHAB 1.x (although those were older models, I know) - but digital inverters are also in refridgerators and tumble tryers from Samsung and I doubt that weâll support those device types in the binding as well.
The PR isnât yet working - still want to find a solution for the token retrieval and need to refactor the power consumption (as Iâve removed the dependency to sqlite, I donât see the need for a database for this as it makes the binding much more complex - Iâd hope that an in-memory cache should suffice).
Feel free (anyone) to do PRs against my PR with improvements, fixes, etc. Iâm happy for any collaboration to get this binding in a mergeable state!
Thanks Kai and everyone for pushing this ahead!
In the meantime, have a look here as @Mario084 found another way of integrating the windfree ACs, not necessary completely self-hosted though as it is based on the SmartThings API, but maybe it helps?
Hi @Kai
Thank you so much for creating the PR.
Iâve not had the time to dive into your updates, yet.
Power consumption in the AC, are downloaded as a base64 encoded sqlite database.
Latest update int the database is extracted using the sqlite Java library. This dowload seemed to be kind of resource consuming in the AC, this download was done at a separate (lower) interval, not to overload the interanls in the AC.
Is there another way of reading the power consumption?
I will happily contribute to the binding.
Ah, thanks for the explanation, I didnât yet fully understand how that was working. Ok, then I guess I have to re-add this dependency again as we wonât be able to parse the data otherwise.