Git Product home page Git Product logo

thinq2-python's People

Contributors

tinkerborg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thinq2-python's Issues

AC Device Snapshots Outdated

Hello,
this is not a bug with this repository, but an issue I have while developing my own API. Unfortunately I have not found any API docs, so hoping someone can help me here.
I am doing APIv2 /service/application/dashboard calls and I get all my AC devices, but unfortunately the snapshots I get are couple of hours old. But, when I open the LG Thinq app on my phone, a new snapshot gets created and sent to the cloud, so next time I do the API call I see the refreshed state with up-to-date temperatures.
How is the app doing that? Is there an API call I could use to tell the AC devices to refresh the state in the cloud?
Thank you

MQTT reverse

As you are only subscribe to /inbox topic, is there a way to subscribe to other topics ?
There are some, like/data /online /event(reverse app)

But when I add them manually in the array of state.json, that's not working, and the working alone /inbox stop to receive msg

Error on startup

Hi, I really like your project. I have an issues with the code:

On line 72 of thinq2/model/thinq.py I get the following error: AttributeError: 'dict' object has no attribute 'device_type'. Accessing item.device_type does not work for me. item['device_type'] or item.get("device_type", {}) works, but than the result of this line (device_schema) is not able to load the snapshop in the next line... Even if it seems like it gets the current schema (LaundryDevice).

The error when calling device_schema.load() is: AttributeError: 'dict' object has no attribute 'snapshot'. Of course there is no attribute snapshot if you are accessing only the snapshop part of data. So I thought I would change it to just use data, but then I get the next error: marshmallow.exceptions.ValidationError: {'result': {'item': {0: {'washerDryer': ['Missing data for required field.'], 'timestamp': ['Missing data for required field.'], 'static': ['Missing data for required field.']}}}}.

Maybe you can help?!

Issue with washing machine

Hi,

First of all, thank you for making this tool!

I tried with one of my AC, and it was working, but only with e-mail/password login, it does not work with e.g. Facebook auth.

When I added my washing machine to my account in LG ThinQ app, I got the following error:

Traceback (most recent call last): File "example.py", line 53, in <module> devices = thinq.mqtt.thinq_client.get_devices() ... marshmallow.exceptions.ValidationError: {'result': {'item': {0: {'countryCode': ['Missing data for required field.'], 'area': ['Missing data for required field.'], 'blackboxYn': ['Missing data for required field.'], 'userNo': ['Missing data for required field.'], 'modelCountryCode': ['Missing data for required field.'], 'snapshot': ['Missing data for required field.'], 'fwVer': ['Not a valid string.']}}}}

AttributeError: 'dict' object has no attribute 'device_type' in thinq2\model\thinq.py in method plymorphism

I had this error before I changed the follwing in file thinq2\model\thinq.py:
@post_load(pass_original=True)
def polymorphism(self, item, data, **kwargs):

  •    device_schema = device_types.get(item.device_type, Device).Schema()
    
  •    item.snapshot = device_schema.load(data.get("snapshot", {}))
    
  •    if hasattr(item, 'device_type'):
    
  •        device_schema = device_types.get(item.device_type, Device).Schema()
    
  •        item.snapshot = device_schema.load(data.get("snapshot", {}))
       return item
    

C:\Users\eduar\PycharmProjects\thinq2-python\venv\Scripts\python.exe C:\Users\eduar\PycharmProjects\thinq2-python\KlimaG.py
UserID: [email protected]
User #: DE2210150767551

Devices:

Traceback (most recent call last):
File "C:\Users\eduar\PycharmProjects\thinq2-python\KlimaG.py", line 108, in
KlimaG.main()
File "C:\Users\eduar\PycharmProjects\thinq2-python\Core.py", line 111, in main
devices = thinq.mqtt.thinq_client.get_devices()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\builder.py", line 106, in call
return execution.start(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 97, in start
return self._io.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 31, in execute
return executable.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 36, in execute
return execution.before_request(self._request)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 56, in before_request
return self.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 105, in execute
return execution.send(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 73, in send
return self._io.invoke(self._client.send, (request,), {}, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 21, in invoke
return callback.on_success(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 96, in on_success
return self._context.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 123, in execute
return execution.after_response(self._request, self._response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 62, in after_response
return self.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 65, in execute
return execution.sleep(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 76, in sleep
return self._io.sleep(duration, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 119, in sleep
return self._io.sleep(duration, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 119, in sleep
return self._io.sleep(duration, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 119, in sleep
return self._io.sleep(duration, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 25, in sleep
return callback.on_success()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 52, in on_success
return self._context.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 36, in execute
return execution.before_request(self._request)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 56, in before_request
return self.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 105, in execute
return execution.send(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 73, in send
return self._io.invoke(self._client.send, (request,), {}, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 21, in invoke
return callback.on_success(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 96, in on_success
return self._context.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 123, in execute
return execution.after_response(self._request, self._response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 62, in after_response
return self.execute()
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\state.py", line 221, in execute
return execution.finish(self._response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 79, in finish
return self._io.finish(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 125, in finish
return self._io.finish(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 125, in finish
return self._io.finish(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 143, in finish
return self._invoke(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 133, in _invoke
return self._io.invoke(func, args, kwargs, FinishingCallback(self._io))
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 19, in invoke
return callback.on_failure(type(error), error, tb)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\execution.py", line 108, in on_failure
return self.io.fail(exc_type, exc_val, exc_tb)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\interfaces.py", line 300, in fail
compat.reraise(exc_type, exc_val, exc_tb)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\six.py", line 719, in reraise
raise value
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 16, in invoke
response = func(*arg, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\clients\requests
.py", line 53, in apply_callback
return callback(response)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\builder.py", line 47, in wrapper
return func(self._consumer, *args, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\hooks.py", line 21, in wrapper
return hook(*args, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\returns.py", line 39, in call
return self.strategy(*args, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\converters\interfaces.py", line 6, in call
return self.convert(*args, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\uplink\converters\marshmallow
.py", line 59, in convert
return self._extract_data(self._schema.load(json))
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 722, in load
return self._do_load(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 861, in _do_load
result = self._deserialize(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 664, in _deserialize
value = self._call_and_store(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 500, in _call_and_store
value = getter_func(data)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 661, in
getter = lambda val: field_obj.deserialize(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 370, in deserialize
output = self._deserialize(value, attr, data, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 673, in _deserialize
return self._load(value, data, partial=partial)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 656, in load
valid_data = self.schema.load(value, unknown=self.unknown, partial=partial)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow_dataclass_init
.py", line 752, in load
all_loaded = super().load(data, many=many, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 722, in load
return self._do_load(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 861, in _do_load
result = self._deserialize(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 664, in _deserialize
value = self._call_and_store(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 500, in _call_and_store
value = getter_func(data)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 661, in
getter = lambda val: field_obj.deserialize(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 370, in deserialize
output = self._deserialize(value, attr, data, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 788, in _deserialize
result.append(self.inner.deserialize(each, **kwargs))
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 370, in deserialize
output = self._deserialize(value, attr, data, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 673, in _deserialize
return self._load(value, data, partial=partial)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\fields.py", line 656, in load
valid_data = self.schema.load(value, unknown=self.unknown, partial=partial)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow_dataclass_init
.py", line 752, in load
all_loaded = super().load(data, many=many, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 722, in load
return self._do_load(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 897, in _do_load
result = self._invoke_load_processors(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 1095, in _invoke_load_processors
data = self._invoke_processors(
File "C:\Users\eduar\PycharmProjects\thinq2-python\venv\lib\site-packages\marshmallow\schema.py", line 1223, in _invoke_processors
data = processor(data, original_data, many=many, **kwargs)
File "C:\Users\eduar\PycharmProjects\thinq2-python\thinq2\model\thinq.py", line 78, in polymorphism
device_schema = device_types.get(item.device_type, Device).Schema()
AttributeError: 'dict' object has no attribute 'device_type'

Process finished with exit code 1

Install error

Hi,

I have an error whan installing

pi@raspberrypi:~/thinq2-python $ poetry install
/home/pi/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
The currently activated Python version 2.7.16 is not supported by the project (^3.7).
Trying to find and use a compatible version.
Using python3 (3.7.3)
Installing dependencies from lock file

Package operations: 49 installs, 0 updates, 0 removals

  • Installing pycparser (2.20)

[OSError]
[Errno 2] No such file or directory: 'pip'

PyPI package

Thanks for this awesome library!

Could you upload it to PyPI so that it can be installed with pip?

Trying to port to VB.Net

Not an issue, but a question. Hopefully you allow me to post it here as I have been searching the net for days without result. I am trying to use the AWS IoT MQTT from the new v2 API, in my .Net project. Something is wrong with my certificate, but the code runs fine until I try to connect to the AWS MQTT. I can't find the issue, what do I miss?

Most important parts of my code below. I use the M2Mqtt for the actual MQTT connection. After I have been successfully authenticated to the API, this is what I do:

' Do a GET and (empty) POST to /service/users/client. Not sure why this is neccessary.
result = LG_API(API_ThinQ2_Url & "/service/users/client", "GET")
result = LG_API(API_ThinQ2_Url & "/service/users/client", "POST", "")

' Create a new public/private key pair, and create a CSR
Dim RSA2048 As RSA = RSA.Create(2048)
Dim distinguishedName As X500DistinguishedName = New X500DistinguishedName("CN=AWS IoT Certificate, O=Amazon")
Dim req As CertificateRequest = New CertificateRequest(distinguishedName, RSA2048, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)

' Save the private and public key
Dim CertPrivKey = Certificate.ExportPrivateKey(RSA2048)
File.WriteAllText(Path.GetTempPath() & "Certificate.private.key", CertPrivKey)
Dim CertPubKey = Certificate.ExportPublicKey(RSA2048)
File.WriteAllText(Path.GetTempPath() & "Certificate.public.key", CertPubKey)

' Create the actual request in PEM format. Make sure the change the Accept header to */*
CertCSR = PemEncodeSigningRequest(req)
result = LG_API(API_ThinQ2_Url & "/service/users/client/certificate", "POST", "{""csr"": """ & CertCSR & """}", "*/*")
Dim Cert As CertificateClass = JsonConvert.DeserializeObject(Of CertificateClass)(result, New JsonDeserializeSettings)

' Save the certificate as PEM file
CertPem = Cert.result.certificatePem
File.WriteAllText(Path.GetTempPath() & "Certificate.pem", CertPem)

' Add the private key to the certificate and save as Pfx
Dim Cert2 = New X509Certificate2()
Cert2.Import(Path.GetTempPath() & "Certificate.pem")
Dim CertWithKey As X509Certificate2 = Cert2.CopyWithPrivateKey(RSA2048)
File.WriteAllBytes(Path.GetTempPath() & "Certificate.pfx", certWithKey.Export(X509ContentType.Pfx, "P@SSW0rd"))

' Get the CA certificate and save as PEM
CertCA = LG_API("https://www.websecurity.digicert.com/content/dam/websitesecurity/digitalassets/desktop/pdfs/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem", "GET", "", "*/*")
File.WriteAllText(Path.GetTempPath() & "root.pem", CertCA)

' Get the required MQTT endpoints
result = LG_API("https://common.lgthinq.com/route", "GET")
Dim Route As RouteClass = JsonConvert.DeserializeObject(Of RouteClass)(result, New JsonDeserializeSettings)
Dim Uri As New Uri(Route.result.mqttServer)
Dim iotEndpoint As String = Uri.Host
Dim brokerPort As Integer = Uri.Port

' Get the certificates
Dim clientCert = New X509Certificate2(Path.GetTempPath & "Certificate.pfx", "P@SSW0rd")
Dim caCert = New X509Certificate(Path.GetTempPath & "root.pem")

' Setup the MqttClient and attach the certificates
Dim client = New MqttClient(iotEndpoint, brokerPort, True, caCert, clientCert, MqttSslProtocols.TLSv1_2)
AddHandler client.MqttMsgPublishReceived, AddressOf Client_MqttMsgPublishReceived
AddHandler client.MqttMsgSubscribed, AddressOf Client_MqttMsgSubscribed
Dim clientId As String = Guid.NewGuid().ToString()

' Connect to the AWS IoT MQTT
client.Connect(clientId)

Note that LG_API is simply returning the data from the API. The client.Connect results in the following error: "AuthenticationException: The remote certificate is invalid according to the validation procedure."

Anything obvious I am missing here? Thanks!!

No module named 'uplink'

HI, thanks for your great work. However, I get an error when running the example:

Traceback (most recent call last):
File "example.py", line 6, in
from thinq2.controller.auth import ThinQAuth
File "thinq2-python\thinq2\controller\auth.py", line 9, in
from uplink.clients.io import RequestTemplate, transitions
ModuleNotFoundError: No module named 'uplink'

Error after authentication

This time I followed the instructions, and after pasting the URL this is the error I get:

Traceback (most recent call last):
File "example.py", line 34, in
thinq = ThinQ(auth=auth)
File "thinq2-python\thinq2\schema.py", line 89, in init
self.data = schema.load(merge_args(self, args))
File "thinq2-python\thinq2\schema.py", line 67, in merge_args
attrs = {
File "thinq2-python\thinq2\schema.py", line 68, in
k: getattr(self, k, None) for k in schema.fields.keys() if not k in kwargs
File "thinq2-python\thinq2\util_init
.py", line 10, in inner
memo[key] = func(*args, **kwargs)
File "thinq2-python\thinq2\schema.py", line 148, in inner
return func(self, existing)
File "thinq2-python\thinq2\controller\thinq.py", line 26, in mqtt
return ThinQMQTT(mqtt, auth=self.auth)
File "thinq2-python\thinq2\schema.py", line 89, in init
self._data = schema.load(merge_args(self, args))
File "thinq2-python\thinq2\schema.py", line 67, in merge_args
attrs = {
File "thinq2-python\thinq2\schema.py", line 68, in
k: getattr(self, k, None) for k in schema.fields.keys() if not k in kwargs
File "thinq2-python\thinq2\schema.py", line 167, in inner
value = getattr(data, obj.name, None) or obj(self)
File "thinq2-python\thinq2\controller\mqtt.py", line 94, in registration
if self.thinq_client.get_registered() is False:
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\builder.py", line 101, in call
return execution.start(
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 97, in start
return self._io.execute(self)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 122, in execute
return self._io.execute(executable)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 31, in execute
return executable.execute()
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\state.py", line 36, in execute
return execution.before_request(self._request)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 56, in before_request
return self.execute()
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\state.py", line 105, in execute
return execution.send(
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 73, in send
return self._io.invoke(self._client.send, (request,), {}, callback)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 116, in invoke
return self._io.invoke(func, args, kwargs, callback)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 21, in invoke
return callback.on_success(response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\state.py", line 96, in on_success
return self._context.execute()
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\state.py", line 123, in execute
return execution.after_response(self._request, self._response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 62, in after_response
return self.execute()
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 93, in execute
return self.state.execute(self)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\state.py", line 221, in execute
return execution.finish(self._response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 79, in finish
return self._io.finish(response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 125, in finish
return self._io.finish(response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 125, in finish
return self._io.finish(response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 143, in finish
return self._invoke(
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 133, in _invoke
return self._io.invoke(func, args, kwargs, FinishingCallback(self._io))
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 19, in invoke
return callback.on_failure(type(error), error, tb)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\execution.py", line 108, in on_failure
return self.io.fail(exc_type, exc_val, exc_tb)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\interfaces.py", line 303, in fail
compat.reraise(exc_type, exc_val, exc_tb)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\six.py", line 703, in reraise
raise value
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\io\blocking_strategy.py", line 16, in invoke
response = func(*arg, **kwargs)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\clients\requests
.py", line 53, in apply_callback
return callback(response)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\hooks.py", line 20, in wrapper
return hook(*args, **kwargs)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\returns.py", line 39, in call
return self.strategy(*args, **kwargs)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\converters\interfaces.py", line 6, in call
return self.convert(*args, **kwargs)
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\uplink\converters\marshmallow
.py", line 59, in convert
return self._extract_data(self._schema.load(json))
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\marshmallow\schema.py", line 722, in load
return self._do_load(
File "pypoetry\Cache\virtualenvs\thinq2-i1Pm4NnS-py3.8\lib\site-packages\marshmallow\schema.py", line 904, in _do_load
raise exc
marshmallow.exceptions.ValidationError: {'status': ['Unknown field.'], 'message': ['Unknown field.'], 'timestamp': ['Unknown field.'], 'path': ['Unknown field.'], 'error': ['Unknown field.']}

MQTT Server

Is it possible to change to a local MQTT server?

No module named 'uplink'

after installing I get the following error when trying to run it:
Traceback (most recent call last): File "example.py", line 6, in <module> from thinq2.controller.auth import ThinQAuth File "/etc/openhab/scripts/thinq2-python/thinq2/controller/auth.py", line 9, in <module> from uplink.clients.io import RequestTemplate, transitions ModuleNotFoundError: No module named 'uplink'

when running poetry install in found this eror message:

`Installing cffi (1.14.5): Failed

EnvCommandError

Command ['/home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/bin/pip', 'install', '--no-deps', '/home/lukaz/.cache/pypoetry/artifacts/83/1b/72/38f5684c129d97cae47042e3bbb688afed3aee9c204d6f6e5afce1df95/cffi-1.14.5.tar.gz'] errored with the following return code 1, and output:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/lukaz/.cache/pypoetry/artifacts/83/1b/72/38f5684c129d97cae47042e3bbb688afed3aee9c204d6f6e5afce1df95/cffi-1.14.5.tar.gz
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"'; file='"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-rnj8edqt
cwd: /tmp/pip-req-build-27c1pkgi/
Complete output (56 lines):
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-3.7 creating build/lib.linux-armv7l-3.7/cffi copying cffi/commontypes.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/model.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/recompiler.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/cparser.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/verifier.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/error.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/lock.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/api.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/__init__.py -> build/lib.linux-armv7l-3.7/cffi copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.7/cffi copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.7/cffi copying cffi/_embedding.h -> build/lib.linux-armv7l-3.7/cffi copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.7/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-armv7l-3.7 creating build/temp.linux-armv7l-3.7/c arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/include -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.7/c/_cffi_backend.o c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory #include <ffi.h> ^~~~~~~ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for cffi Running setup.py clean for cffi Failed to build cffi Installing collected packages: cffi Running setup.py install for cffi: started Running setup.py install for cffi: finished with status 'error' ERROR: Command errored out with exit status 1: command: /home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-nd1bak4z/install-record.txt --single-version-externally-managed --compile --install-headers /home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/include/site/python3.7/cffi cwd: /tmp/pip-req-build-27c1pkgi/ Complete output (56 lines): Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/cffi
copying cffi/commontypes.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/model.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/recompiler.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/cparser.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/verifier.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/error.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/lock.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/api.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/init.py -> build/lib.linux-armv7l-3.7/cffi
copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.7/cffi
copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.7/cffi
copying cffi/_embedding.h -> build/lib.linux-armv7l-3.7/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/c
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/include -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"'; file='"'"'/tmp/pip-req-build-27c1pkgi/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-nd1bak4z/install-record.txt --single-version-externally-managed --compile --install-headers /home/lukaz/.cache/pypoetry/virtualenvs/thinq2-rt_iq-AX-py3.7/include/site/python3.7/cffi Check the logs for full command output.

at ~/.poetry/lib/poetry/utils/env.py:1075 in run
1071│ output = subprocess.check_output(
1072│ cmd, stderr=subprocess.STDOUT, **kwargs
1073│ )
1074│ except CalledProcessError as e:
→ 1075│ raise EnvCommandError(e, input=input
)
1076│
1077│ return decode(output)
1078│
1079│ def execute(self, bin, *args, **kwargs):`

but I did install cffi afterwards using pip3 install cffi and it installs fine with no errors. But that did not fix it.
Someone already had the same issue and found a solution but didn't post it....

Any idea why my install will not run??

Add a new kind of device ?

I correctly found my air conditioner. Big thanks for your work on this project !

However, I would need some guidance to create a proper device as you did with your "laundry" device. The file "laundry.py" seems a bit empty. I am not sure what is the state of the art on this project as it is quite a new one (less than a month ago!). Are you able to get a proper output of your device state?

If you are interested by the output of the monitoring of my device:

Devices:

aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa: CLIMATISEUR (model RAC_056905_WW)

Listening for device events. Use Ctrl-C/SIGINT to quit.


b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"DGsAGN6gQWG2lQKbFKMUvg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589212436932}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"cCJ-NV3FQmypi0Bvuc-3AQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589212737984}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"607u_f0XR06jgEpPgyag7Q"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213038997}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.operation":1,"meta":{"allDeviceInfoUpdate":false,"messageId":"25Y-9HHwRCu2uCyIcBwImQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213104475}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":27,"meta":{"allDeviceInfoUpdate":false,"messageId":"JTlLtX38RGS1bHfrh5u4gw"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132510}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":29,"meta":{"allDeviceInfoUpdate":false,"messageId":"7S_pj_A2Q0CsyvgJf8KIrQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132522}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":26,"meta":{"allDeviceInfoUpdate":false,"messageId":"k7dR1VIITjKQMYE8RSGPuA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132531}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":28,"meta":{"allDeviceInfoUpdate":false,"messageId":"8WqDea8yQcmN221qmhp6oQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132554}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":25,"meta":{"allDeviceInfoUpdate":false,"messageId":"Nc4WmwATS3uX9kEJm6Deeg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132737}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.tempState.target":24,"meta":{"allDeviceInfoUpdate":false,"messageId":"XzibpwCASFC_QOsIzUIjQg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213132761}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.opMode":2,"meta":{"allDeviceInfoUpdate":false,"messageId":"JMlUelreQtSBryXH3D0dHA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213140048}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.opMode":0,"airState.tempState.target":18,"meta":{"allDeviceInfoUpdate":false,"messageId":"E22DppwGTF2c-UaZuUxKwA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213140947}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.opMode":6,"airState.tempState.target":22,"meta":{"allDeviceInfoUpdate":false,"messageId":"uvA_QZAmSQ-P8jAZCn7QBA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213141583}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.operation":0,"meta":{"allDeviceInfoUpdate":false,"messageId":"ggdG-HofSUKpRp5AKc0-kQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213176075}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"d9woogCqTEevplwPWaMqfA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213340080}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"LvrjRLO1RD-nNCJnFQnTOg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213641172}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"ndVqeUCpRoCoVKtkDNSHvQ"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589213942110}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"OHMf7yg6SvCCgJ5uEAPQng"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589214243256}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"2LkCnXT-QNqfMEAHju1LVg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589215146435}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"hbbqnacrRnCDx_VfGRocDg"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589215447367}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
b'{"data":{"state":{"reported":{"airState.energy.accumulated":0,"airState.energy.accumulatedTime":0,"airState.tempState.current":24.5,"meta":{"allDeviceInfoUpdate":false,"messageId":"1sVN2z_iRZSJU_O2nphKAA"},"online":true,"static":{"countryCode":"BE","deviceType":"401"},"timestamp":1589215748535}}},"deviceId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","type":"monitoring"}'
^C
Caught SIGINT, saving application state.

(deviceId hidden)

MQTT SSL connection not working on Windows

Reported by @stefxx:

File "example.py", line 79, in
thinq.mqtt.connect()
File "thinq2-python\thinq2\controller\mqtt.py", line 25, in connect
self.client.connect(endpoint.hostname, endpoint.port)
File "thinq2-python\thinq2\util_init_.py", line 10, in inner
memo[key] = func(*args, **kwargs)
File "thinq2-python\thinq2\controller\mqtt.py", line 44, in client
client.tls_set_context(self.ssl_context)
File "thinq2-python\thinq2\controller\mqtt.py", line 67, in ssl_context
context.load_cert_chain(certfile=client_cert.name, keyfile=private_key.name)
PermissionError: [Errno 13] Permission denied```

thinq2 device error

First Error :
marshmallow.exceptions.ValidationError: {'result': {'item': {0: {'modelProtocol': ['Missing data for required field.']}}}}

Q: is this backwards compatible?

Would this be backwards compatible with the wideq supported devices?

Or a rephrasing of the question:

  • I have now a device which is found by WideQ; i will try and see if it also will be found by your script.

Ok, result:

No devices found!

Then i realized the country code is case sensitive (remember this from wideq);

In the end the following gave me my valid device on latest WideQ code:
python3 example.py -c NL -l en-NL

{
    "model_info": {},
    "gateway": {
        "auth_base": "https://nl.m.lgaccount.com",
        "api_root": "https://eic.lgthinq.com:46030/api",
        "oauth_root": "https://nl.lgeapi.com",
        "country": "NL",
        "language": "en-NL"
    },
    "auth": {
        "access_token": "xxx",
        "refresh_token": "xxx"
    },
    "session": "xxx.nodes_sadap_10",
    "country": "NL",
    "language": "en-NL"
}

Your current code doesn't yet:
COUNTRY_CODE=NL LANGUAGE_CODE=en-NL poetry run python example.py

results in:

{
    "auth": {
        "client_id": "3c25e7c2a38dbd839c56f03f25ea8144f3dcf5da0bbea0319e23e08bb30d875b",
        "language_code": "en-NL",
        "gateway": {
            "languageCode": "en-NL",
            "empUri": "https://nl.m.lgaccount.com",
            "thinq1Uri": "https://eic.lgthinq.com:46030/api",
            "thinq2Uri": "https://eic-service.lgthinq.com:46030/v1",
            "countryCode": "NL"
        },
        "token": {
            "expires_in": "3600",
            "access_token": "xxx",
            "refresh_token": "xxx",
            "oauth2_backend_url": "https%3A%2F%2Fgb.lgeapi.com%2F"
        },
        "profile": {
            "userNo": "xxx",
            "userID": "xxx"
        },
        "country_code": "NL"
    },
    "mqtt": {
        "ca_cert": "xxx",
        "csr": "xxx",
        "registration": {
            "subscriptions": [
                "t20/op/3c25e7c2a38dbd839c56f03f25ea8144f3dcf5da0bbea0319e23e08bb30d875b/inbox"
            ],
            "certificatePem": "xxx"
        },
        "private_key": "xxx",
        "route": {
            "mqttServer": "ssl://a3phael99lf879.iot.eu-west-1.amazonaws.com:8883",
            "apiServer": "https://eic-common.lgthinq.com:443"
        }
    }
}

Given the fact that the endpoints seem to match (eic.lgthinq.com) where can i dive in further to help getting an MQTT connection ?

Test with a LG KilmaG split inverter air conditioner

Hello I was looking for a python api to access a LG air conditioner.

After downloading I tried to access the projekt by pycharm. I had no success with poetry, wich I am not firm with. After installing missing packages in the venv the example.py was running and dumps information from the device. Now I want to send commands to the device. Do you know how I could do that and how I find out which commands are available?

I am working with pycharm under Win11.

With regards
Eduarad Gode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.