andrewleech / ha_magiqtouch

Home Assistant (HACS) integration to control Seeley MagiQtouch heating and cooling units.
MIT License
24 stars 6 forks source link

Control functions have stopped responding to input #19

Open Dazzzwaa opened 9 months ago

Dazzzwaa commented 9 months ago

Hi, last week i have noticed the integration has stopped responding to input the magiqtouch display wont update to the value i set in Home assistant, however if i set it on magiqtouch controll it will update on Home assistant image image

see below information from the log This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:274 Integration: Seeley MagIQtouch (documentation, issues) First occurred: 8:40:15 PM (3 occurrences) Last logged: 8:51:34 PM

Failed to set value properly:

DeltaTangoLima commented 9 months ago

Came here to open an issue for the very same thing - identical experience, and log entry. Definitely happened in the past week or so.

AlexPotterOnGit commented 9 months ago

+1 with the same issue

roelfdiedericks commented 9 months ago

+1 same issue with the same error log

jmot205 commented 9 months ago

+1 same issue encountered here

jmot205 commented 9 months ago

For additional context I have tried deleting and re-adding the HA air con entity and also confirmed that the air con system is still able to be controlled remotely through the Seeley Magiqtouch app.

andrewleech commented 9 months ago

Oh that really sucks. I noticed my control widget wasn't working the other day and just assumed I probably needed to restart something... It looks like the magiqtouch app protocol must have actually changed a bit.

It's probably going to be quite a while before I can get to fixing this, I've only recently joined the "2 under 2" club and don't have much time for projects

jmot205 commented 9 months ago

Just sniffed the MagIQTouch app, and in addition to the host tgjgb3bcf3.execute-api.ap-southeast-2.amazonaws.com (which is in the ha_magiqtouch integration code) it is also hitting xs5z2412cf.execute-api.ap-southeast-2.amazonaws.com

Could it potentially just be an updated API URL? Not sure why it'd still be hitting the previous one though.

The error message in this post makes it sound like it just can't hit the tgjgb3bcf3 endpoint.

andrewleech commented 9 months ago

Nice one @jmot205 . I've decompiled a copy of old and newest app, hopefully that'll give me a more direct answer as to what's going on... though I'm coding from phone with Acode app and SSH to my Linux box, so it's just little bits here and there :-)

andrewleech commented 9 months ago

Actually it's bad news on the decompile. Previously the app code was written with dotnet & xamarin which is easy to decompile.

The brand new one has been rewritten from scratch, with that new url reported now locked inside a C / binary library which is much harder to inspect.

Oh, the new url is actually a websocket. While I haven't decompiled the binary library, just listing strings from it is quite interesting. wss://xs5z2412cf.execute-api.ap-southeast-2.amazo naws.com/prod The app is now written with flutter and aws-amplify

    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "analytics": {
        "plugins": {
            "awsPinpointAnalyticsPlugin": {
                "pinpointAnalytics": {
                    "appId": "b9c0364dab934e9aa7708a0b03417db1",
                    "region": "ap-southeast-2"
                },
                "pinpointTargeting": {
                    "region": "ap-southeast-2"
                }
            }
        }
    },
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "ap-southeast-2:87af6d7b-28ef-4014-88f1-67b19c361221",
                            "Region": "ap-southeast-2"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "ap-southeast-2_uw5VVNlib",
                        "AppClientId": "afh7fftbb0fg2rnagdbgd9b7b",
                        "Region": "ap-southeast-2"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [],
                        "usernameAttributes": [],
                        "signupAttributes": [
                            "NAME",
                            "FAMILY_NAME",
                            "EMAIL",
                            "PHONE_NUMBER"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 6,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                },
                "PinpointAnalytics": {
                    "Default": {
                        "AppId": "b9c0364dab934e9aa7708a0b03417db1",
                        "Region": "ap-southeast-2"
                    }
                },
                "PinpointTargeting": {
                    "Default": {
                        "Region": "ap-southeast-2"
                    }
                }
            }
        }
    },
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "apiGateway": {
                    "endpointType": "REST",
                    "endpoint": "https://tgjgb3bcf3.execute-api.ap-southeast-2.amazonaws.com/prod",
                    "region": "ap-southeast-2",
                    "authorizationType": "NONE"
                }
            }
        }
    }
andrewleech commented 9 months ago

Ah, this integration is also still using ApiUrl = "https://57uh36mbv1.execute-api.ap-southeast-2.amazonaws.com/api/" for much of its functionality; this url appears to no longer exist! So it seems I'll need to find equivalent endpoints oh the newer web API to replace these

jmot205 commented 9 months ago

That's a frustrating outcome of them seemingly putting so much effort into re-writing their app - that it throws a spanner into the decompile process. Nice find on that printout - that's a lot of info.

Here's hoping that a drag-and-drop update of the ApiUrl is all it needs to come back to life.

raym777 commented 9 months ago

Thanks for looking into this. I came here to report the issue but you guys are obviously all over it already :)

Hopefully not too difficult to get it back up and running.

andrewleech commented 9 months ago

So I've been trying a lot of different things, working day and night ( coding from phone while rocking newborn to sleep :-D )

... and was starting to get quite pessimistic about ever getting it working again.

I tried just changing the old url to either of the new endpoints identifed previously, but they just throw an AWS authentication error. Stack overflow says that particular error means the url path is wrong / doesn't exist...

My initial attempts at decompiling went nowhere (as mentioned above) so I went back to trying to sniff the network traffic.

Turns out there's an awesome on-phone network analyser now called pcapdroid. It acts like a "fake vpn" to intercept traffic and show all the packets. It works great, can select just the magiqtouch app and it shows communications to that new endpoint.

These are all https (aka encrypted) however so don't show the full url path or the request contents. So not enough to figure out how to use it.

Luckily pcapdroid has an option to decrypt these, so I got all that set up and going, only to find the magiqtouch app no longer works, it can't communicate with the server and pcapdroid shows a common error being that the app is detecting / rejecting the proxy decode certificate.

One common workaround for this requires a rooted device. Thankfully I had an old phone in the cupboard that's got magisk root installed so I got that charged, installed everything and tried again with the root / system certificate stuff configured. Same failure :-(

Apparently when this fails it usually means the app itself is enforcing the certificate. 

So I tried a few tools & techniques to patch the app itself to disable this so called "cert pinning". Some methods made the app crash, some didn't. None of them let me decode the API calls unfortunately.

FWIW though one tool that's _very useful for unpacking, smali editing, rebuilding and signing apks is apk.sh

It was about here I was getting close to giving up.

Then I thought, if all the app communication is hidden inside a binary library, maybe I don't need to figure out how the API calls work, maybe I can just copy the binary library and figure out how to embed it into my package, then directly call the official apps' functions in it!

So I took another look at the binary library and quickly figured out this wouldn't work because it's not a normal linux-like shared library, it's a custom format "flutter app" thing.

And that started me down a path of figuring out what flutter is. Tldr it's a cross platform mobile app framework by Google that has its own programming language that compiles to a binary library. Hence all the app code is in a binary library. Unfortunately flutter apps are very hard to decompile, and it's only becoming harder in newer versions. And that cert pinning issue I ran into is standard practice in all flutter apps!

But thankfully flutter is popular enough that lots of people have figured out various ways to patch it / disable cert pinning in different versions of flutter as this kind of network inspection is crucial for a lot of security research.

I tried a couple of ways that crashed the app, before finally one that didn't crash.  And actually worked to disable cert pinning, so network inspection finally worked!

The tool used is reflutter.

It does require a separate inspection proxy that's listening on a different port than pcapdroid uses, so I've got a separate copy of mitmproxy running on my home computer.

After all that, I think a picture is worth a thousand words, so... Screenshot_20240229-141409.png

PS. This doesn't mean I've fixed anything yet, but does mean I should be able to trace how the real app communicates with the server to copy it!

DeltaTangoLima commented 9 months ago

@andrewleech I am in awe. I could barely write a Python hello world one-liner when our kid was newborn, let alone decompile an app and sniff its traffic with a MITM proxy.

Look - I'm an infrastructure guy, and totally a Python hack. Clearly you've done a lot of the heavy lifting already, and you seem like a guy that enjoys doing this stuff but, if I can help at all, please yell out mate.

AlexPotterOnGit commented 9 months ago

So I've been trying a lot of different things, working day and night ( coding from phone while rocking newborn to sleep :-D )

< snip >

PS. This doesn't mean I've fixed anything yet, but does mean I should be able to trace how the real app communicates with the server to copy it!

I was so enjoying just reading the story so even if we are not going to be lucky enough to get back control, not going to be disappointed. Thanks mate for your time and efforts.

andrewleech commented 8 months ago

@DeltaTangoLima Cheers yeah to be clear, this is my second son and he's healthy and doing well... so it's all coming a bit easier than with our first :-)

I find this kind of hacking around mentally invigorating, similar to exercise being physically energising. I also need something to keep me awake at times when holding bubs in the middle of the night, don't want to fall asleep and drop him!

@AlexPotterOnGit actually it's looking quite definite I'll be able to get it working! I've already replaced a couple of calls to the old / shut down API url. The new API url is definitely a websocket, I got communication with that started last night and have received "current state" over it just like the app does.

The app uses this websocket for both

The format of the json data structures used for these is different to the old one though, so the dataclass structures here will need updating to suit.

I'm pretty sure my first round of fixes will break zone control because I don't have zones which in the new format seems to show as empty lists.... people with zones will have lists filled with "something new", we'll have to wait until someone with zones runs the new code (once it's written) to see what the format is.

andrewleech commented 8 months ago

Oh wow, just found another use for chatgpt! https://chat.openai.com/share/995ca6b7-6ac9-4fe8-8105-61c9039549b1

Neat, Gemini can do it too, question:

Can you write a python dataclass to match this json data: {"device":"606405ab6f38","timestamp":1709218416442,"online":true,"systemOn":false,"runningMode":"COOL","heaterFault":false,"coolerFault":false,"cooler":[{"brand":0,"name":"","runningState":"NOT_REQUIRED","zoneRunningState":"NOT_REQUIRED","zoneOn":null,"zoneType":"NONE","set_temp":18,"temperature_units":"c","actual_temp":22,"max_temp":28,"min_temp":18,"fan_speed":1,"max_fan_speed":10,"min_fan_speed":1,"control_mode":"FAN","control_mode_type":"MASTER","internal_temp":22,"external_temp":null,"programMode":"off","ProgramModeOverridden":false,"ProgramPeriodActive":false,"programOverrideDisabled":false}],"heater":[],"fan":{"cooler_available":true,"cooler_brand":0,"heater_available":false,"heater_brand":3,"heater_Fan_Speed":1,"cooler_Fan_Speed":1},"touchCount":206,"installed":{"evap":true,"faoc":false,"heater":false,"iaoc":false,"coolerType":0}}

Response:

Here's the Python dataclass that matches the provided JSON data: from dataclasses import dataclass


@dataclass
class Cooler:
brand: int
name: str
runningState: str
zoneRunningState: str
zoneOn: bool
zoneType: str
set_temp: float
temperature_units: str
actual_temp: float
max_temp: float
min_temp: float
fan_speed: int
max_fan_speed: int
min_fan_speed: int
control_mode: str
control_mode_type: str
internal_temp: float
external_temp: float
programMode: str
ProgramModeOverridden: bool
ProgramPeriodActive: bool
programOverrideDisabled: bool

@dataclass class Fan: cooler_available: bool cooler_brand: int heater_available: bool heater_brand: int heater_Fan_Speed: int cooler_Fan_Speed: int

@dataclass class Installed: evap: bool faoc: bool heater: bool iaoc: bool coolerType: int

@dataclass class DeviceData: device: str timestamp: int online: bool systemOn: bool runningMode: str heaterFault: bool coolerFault: bool cooler: list[Cooler] heater: list fan: Fan touchCount: int installed: Installed


> This dataclass structure closely mirrors the JSON data, with each class representing a nested element and its corresponding attributes.

PS. This is the current state json that's reported over websocket
DeltaTangoLima commented 8 months ago

Oh wow, just found another use for chatgpt! https://chat.openai.com/share/995ca6b7-6ac9-4fe8-8105-61c9039549b1

Neat, Gemini can do it too, question:

Yep - done this a lot myself. genAI isn't going to kill development, for those devs that learn how to harness it properly. I use it to bootstrap about 80% of a new project, which means I can spend my time refining and tweaking the end product. Very useful!

roelfdiedericks commented 8 months ago

Considering the "strings" trail you found, I'm going to guess that they built the app with AWS Amplify, and more specifically the amplify_flutter library. https://pub.dev/publishers/aws-amplify.com/packages

https://aws-amplify.com

Authentication could pose a bit of a challenge, I suspect.

Edit: indeed, looks like they use Amazon Cognito, after some more strings-ing.

andrewleech commented 8 months ago

Authentication could pose a bit of a challenge, I suspect.

Heh, yeah the auth was a massive pain to get working when I started this integration a year or two ago, it took me ages to get the AWS cognitive auth library & dependences all going.

Thankfully, that all still works. I think one of the pool identifiers has changed, I copied that from the amplify json/string block.

I can login still just fine and use the API and websocket endpoints, the json used in the dataclass comment above was pulled by my code.

roelfdiedericks commented 8 months ago

Ah, ok, I didn't directly see that in the current integration.

Was about to start down this rabbithole....

image

roelfdiedericks commented 8 months ago

Clearly my reading skills lacked.

image

roelfdiedericks commented 8 months ago

I can login still just fine and use the API and websocket endpoints, the json used in the dataclass comment above was pulled by my code.

Pull your own PR already :)

andrewleech commented 8 months ago

It's taken a lot of re-writing, testing, then restructuring to try to get even basic communication working reliability over websocket and new API but the original support for evap cooling seems to be working well again for me now https://github.com/andrewleech/ha_magiqtouch/pull/21

I've just cleaned up and merged that to the main hacs branch so anyone should be able to upgrade to it if you have pre-release versions enabled in hacs.

This may work for heating but it's a guess so far.

This will not work for zones as my setup doesn't have any so the json doesn't include any details for this. I'll need to get json data dumped from someone's ha logs (with verbose logging enabled on this integration) to make any progress there.

jmot205 commented 8 months ago

Legend! Thanks for all that work - sorry to hear it was such a big chunk of effort. Hopefully they refrain from any more "useful" app re-writes in future...

I've updated to v3.0 and had no entities auto-detected so found I need to login to my account again. Unfortunately that doesn't work - I get a "failed to connect" error in the GUI, and the error log shows that it didn't resolve:

This error originated from a custom integration.

Logger: custom_components.magiqtouch.config_flow Source: custom_components/magiqtouch/config_flow.py:42 integration: magiqtouch (documentation, issues) First occurred: 10:37:47 (4 occurrences) Last logged: 10:45:26

Could not connect: Cannot connect to host 57uh36mbv1.execute-api.ap-southeast-2.amazonaws.com:443 ssl:default [Name does not resolve] Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1173, in _create_direct_connection hosts = await asyncio.shield(host_resolved) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 884, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 899, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/socket.py", line 963, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -2] Name does not resolve The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 37, in validate_input if not await hub.login(): ^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/magiqtouch.py", line 106, in login async with self._httpsession.get( File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 57uh36mbv1.execute-api.ap-southeast-2.amazonaws.com:443 ssl:default [Name does not resolve] Could not connect: Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 38, in validate_input raise InvalidAuth custom_components.magiqtouch.config_flow.InvalidAuth

AlexPotterOnGit commented 8 months ago

First of all - thank you for the efforts. And wanted to confirm I have the same issue: Logger: homeassistant.setup Source: setup.py:296 First occurred: 10:38:49 AM (1 occurrences) Last logged: 10:38:49 AM

Setup failed for custom integration 'magiqtouch': Unable to import component: No module named 'mandate' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 296, in _async_setup_component component = await integration.async_get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 894, in async_get_component comp = self.get_component() ^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 921, in get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/magiqtouch/init.py", line 15, in from .magiqtouch import MagiQtouch_Driver File "/config/custom_components/magiqtouch/magiqtouch.py", line 15, in from mandate import Cognito ModuleNotFoundError: No module named 'mandate'

andrewleech commented 8 months ago

v3.0 is not the new work, that's the old version.

The new stuff just merged would need pre-release enabled I think to get installed.

Maybe the new stuff should be given a version number; it'd be good to know it works for someone else before I "formally" release it as such... though that really doesn't actually matter.

jmot205 commented 8 months ago

Ah sorry, thought that was the prerelease because I have beta enable and it just gives the options "v3.0" and "hacs". When selected, "hacs" just reverts to the 3.0 option. Screenshot_20240311_112407_Home Assistant

DeltaTangoLima commented 8 months ago

@andrewleech I merged your recent commit from the hacs branch, and it's all working again! Full control of ducted evap and heater. It could be my imagination, but I think it's faster/more responsive than previoously, too.

Thanks so much for your incredible work on this. I'm truly in awe.

andrewleech commented 8 months ago

I've just tagged the new stuff as v4.0 so it should be easier to install.

@DeltaTangoLima thanks for the feedback, that's great to hear the heater works!

Yeah it should be a bit more responsive, the websocket is a good improvement to the API really, though I might be also hitting it harder than necessary. :-)

jmot205 commented 8 months ago

Stellar - can confirm that v4.0 works on my end, thanks mate!

Dazzzwaa commented 8 months ago

Great work @andrewleech ! You are a champion! Looks like it's working great! Congrats on the new bubs also!

AlexPotterOnGit commented 8 months ago

+1 with huge thank you, all fixed on my side @andrewleech !

Dazzzwaa commented 8 months ago

Hey @andrewleech, There looks to be a new error now Stating the websocket is closed Screenshot_20240311-172753

Dazzzwaa commented 8 months ago

False alarm @andrewleech haha Looks like my magiqtouch controller had a spaz and I had to re connect it to my wifi It's all good now!

cat2devnull commented 8 months ago

Upgraded from 3.0 to 4.0 I no longer have any entities and get a number of errors in the logs (attached). I have a Seeley running firmware 1.7 with both and Evap cooler, Gas heater and a second zone. log.txt Any thoughts would be appreciated.

andrewleech commented 8 months ago

@Dazzzwaa Ah yes I've left a bunch of "debug" messages in the code that'll be showing a warning and error messages. I'll need to remove them!

@cat2devnull I don't have zones support yet because I haven't got any raw data on how to handle them. As a start, if you enable verbose logging and share another log file I might get something to start with. Go to the magiqtouch integration entry, hit the configure button and enable the setting. Screenshot_20240311-202335 Screenshot_20240311-202304

cat2devnull commented 8 months ago

I already had both enabled. I performed a reload of the integration and here are the logs. log.txt Happy to do any further digging if needed.

raym777 commented 8 months ago

Yeah it should be a bit more responsive, the websocket is a good improvement to the API really, though I might be also hitting it harder than necessary. :-)

Thank you so much for resolving this issue. Working well here now. Appreciate all your time and effort!

andrewleech commented 8 months ago

@cat2devnull thanks that log gave me one piece of the needed details, but the more important stuff will be in the "current state" json which happens after that exception / crash.

Could you try enabling beta versions (like https://github.com/andrewleech/ha_magiqtouch/issues/19#issuecomment-1987570636) and select hacs as the version to install - that should install the latest commit from that branch I believe.

I've changed the startup to always create the default / master entity and ignore zones so that it should get past the crash and then log all the state information needed.

cat2devnull commented 8 months ago

Ok, now on version 09de2ff. Here are the logs. log.txt

andrewleech commented 8 months ago

@cat2devnull thanks though though that log looks the same as the previous one. Could you try restarting home assistant completely? It looks like you tried reloading the integration but that doesn't actually load a new version annoyingly.

cat2devnull commented 8 months ago

I really thought I had reloaded, never the less I performed another complete reload, added the integration and got the following errors which seem the same as before. HACS says it's running ver 09de2ff. log2.txt

andrewleech commented 8 months ago

@cat2devnull sorry my mistake, the error is something slightly different.

I think I've fixed that and pushed to hacs branch if you'd like to update again thanks!

AschwinGehlen commented 8 months ago

Anyone else having the issue of MagIQtouch login not working?

No mater what version I install it keeps coming up with a 'Failed to connect' message. The login works from the phone and the controller but not from the integration.

Is is because the new version is pointing to a server in the US where my login is setup for AU/NZ?

This is from the logs:

Logger: homeassistant Source: runner.py:145 First occurred: 4:21:50 PM (4 occurrences) Last logged: 4:36:31 PM

Error doing job: Unclosed client session Error doing job: Unclosed connector

@andrewleech, IF I can get this login working and you are interested in getting the zones setup let me know. Happy to give you information etc from my setup.

andrewleech commented 8 months ago

Is is because the new version is pointing to a server in the US where my login is setup for AU/NZ?

Hi, nope I'm from Australia myself.

I don't know why yours isn't connecting; not sure exactly what / where this error message is coming from.

Is there definitely no other log messages from the integration?

AschwinGehlen commented 8 months ago

The only error/information I can see in HA is in the logs.

I have even setup an entire new login and I still get the same message. Even deleting the HACS integration and reloading it makes no difference. Also tried an entire shutdown of HA and all network switches and powering down the heater system.

As they say in IT, 'have you turned it off and on'? LOL

Don't think the integration will give any logs because it's not actually getting past the first set to login.

cat2devnull commented 8 months ago

I think I've fixed that and pushed to hacs branch if you'd like to update again thanks!

Ok, now we're getting somewhere. I have 3 entities now, climate.magiqtouch and int/ext temps. The values look good. I've been doing this over VPN from a hotel so I'll do some more testing when I get home in a few days, to make sure I can turn the unit on/of and adjust mode etc.

There are still a few errors in the logs attached. log.txt

Thanks for the help.

AschwinGehlen commented 8 months ago

Hi, nope I'm from Australia myself.

I don't know why yours isn't connecting; not sure exactly what / where this error message is coming from.

Is there definitely no other log messages from the integration?

OK, this might help. Just noticed that there are 4 errors that come up one after the other whenever I try to login.

First one: This error originated from a custom integration.

Logger: py.warnings Source: custom_components/opnsense/pyopnsense/init.py:167 integration: OPNsense (documentation, issues) First occurred: 4:17:52 PM (238 occurrences) Last logged: 6:24:38 PM

/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.xxx.xxx'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(

Second one: This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:159 integration: Seeley MagIQtouch (documentation, issues) First occurred: 4:21:50 PM (7 occurrences) Last logged: 6:24:56 PM

failed to query devices/system Traceback (most recent call last): File "/config/custom_components/magiqtouch/magiqtouch.py", line 159, in login self.current_system_state = SystemDetails.from_dict(system_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/structures.py", line 350, in from_dict dc.ACZones.Zones = [Zone(**d) for d in dc.ACZones.Zones] ^^^^^^^^^ TypeError: Zone.init() got an unexpected keyword argument 'Name'

Third one: This error originated from a custom integration.

Logger: custom_components.magiqtouch.config_flow Source: custom_components/magiqtouch/config_flow.py:45 integration: Seeley MagIQtouch (documentation, issues) First occurred: 4:21:50 PM (8 occurrences) Last logged: 6:24:56 PM

Could not connect: Zone.init() got an unexpected keyword argument 'Name' Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 39, in validate_input if not await hub.login(): ^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/magiqtouch.py", line 159, in login self.current_system_state = SystemDetails.from_dict(system_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/structures.py", line 350, in from_dict dc.ACZones.Zones = [Zone(**d) for d in dc.ACZones.Zones] ^^^^^^^^^ TypeError: Zone.init() got an unexpected keyword argument 'Name' Could not connect: Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 40, in validate_input raise InvalidAuth custom_components.magiqtouch.config_flow.InvalidAuth

Forth one: Logger: homeassistant Source: runner.py:145 First occurred: 4:21:50 PM (14 occurrences) Last logged: 6:24:56 PM

Error doing job: Unclosed client session Error doing job: Unclosed connector

There is about a 20 second delay from the first one to the other three. Two, Three and Four all within one second. Not sure if this helps.

cat2devnull commented 8 months ago

OK, this might help. Just noticed that there are 4 errors that come up one after the other whenever I try to login.

@AschwinGehlen Only error messages from magiqtouch are relevant. Have you upgraded to the latest beta version that Andrew posted 2 hours ago?