gazoodle / geckolib

Library to interface with Gecko Alliance spa pack systems via in.touch2 module
GNU General Public License v3.0
62 stars 24 forks source link

Run time error: Spa took too long to connect #12

Closed eranjo closed 2 years ago

eranjo commented 3 years ago

Hi,

Not able to connect to my spa so attaching my log file in case it will help to identify the issue. Looking forward to get this up and running already in HA :)

I'd like to start tracking temperature change vs. weather forecast -> The idea is to set rules to get my spa heating started at the right time based on the time I want to go in.

"I want my spa ready @6pm" --> calculate heating time based on the data collected vs. temp or Turn heating off if pump 2 not used for x hours or Reset due reminders after pushing IoT button etc.

client.log

Thanks, eranjo

gazoodle commented 3 years ago

@brandonmartin Did you get any more info on downloading from /api/spapackstructure?

NorthernMunkey commented 3 years ago

I got it from someone else on here. V33 if you ping me your mail I will forward it to you

On Thu, 8 Jul 2021, 17:49 gazoodle, @.***> wrote:

@brandonmartin https://github.com/brandonmartin Did you get any more info on downloading from /api/spapackstructure?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gazoodle/geckolib/issues/12#issuecomment-876591852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMKM6US4ZR3N4O26X5RFQPDTWXJKLANCNFSM4U2NQS6A .

maegibbons commented 3 years ago

@brandonmartin Did you get any more info on downloading from /api/spapackstructure?

Welcome back!!!

gazoodle commented 3 years ago

I got it from someone else on here. V33 if you ping me your mail I will forward it to you On Thu, 8 Jul 2021, 17:49 gazoodle, @.***> wrote: @brandonmartin https://github.com/brandonmartin Did you get any more info on downloading from /api/spapackstructure? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#12 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMKM6US4ZR3N4O26X5RFQPDTWXJKLANCNFSM4U2NQS6A .

I'll take the file from you, but what I'm really interested in getting the lib to download from the URL which I'm investigating too. You can email it to me at gazoodle@hash.fyi. Thanks

TomK commented 3 years ago

@gazoodle I've also got the same issue. Went to do the XML extract but I saw someone already sent it to you. Happy to spin up a Windows machine to extract it if needed.

App about page (click to enlarge):

Spa technical info page (click to enlarge):

Please let me know how I can help.

TomK commented 3 years ago

I've written a quick (🤔) C# project to extract SpaPackStruct.xml from an APK. It should be cross platform (works on my mac), instructions in the readme.

It decompresses the Xamarin compressed DLL on the fly and then writes out the XML file.

https://github.com/TomK/gecko-spapack-extract

maegibbons commented 3 years ago

Sounds excellent. Well done!

However that will only extract the embedded dll.

The APK then downloads the latest. Currently v33

TomK commented 3 years ago

Yeah, extracting outside of linq/windows environment was my first task. I can't see that anyone has a URL for the latest version as yet? I can see a few people with wireshark screenshots, and also some rooted android extractions (it2). I will keep my eyes peeled and consider how I can best help with this next step.

TomK commented 3 years ago

I've updated this slightly with binaries for (x64) linux, windows and macos available on the releases page. You can now pass the path to the file you want to extract the XML from. Should also work on the it2 file. It doesn't.

feens commented 2 years ago

@TomK @maegibbons or @gazoodle just got my new hot tub and working on getting this working. I got the error mentioned here, and noticed that in my About page it says it's using v33 of Spa Pack Structure. Looks like you guys have it available, so would someone be able to send it my way?

maegibbons commented 2 years ago

@TomK @maegibbons or @gazoodle just got my new hot tub and working on getting this working. I got the error mentioned here, and noticed that in my About page it says it's using v33 of Spa Pack Structure. Looks like you guys have it available, so would someone be able to send it my way?

Send me an email to mgibbons at the website domain in my profile.

Krs

Mark

feens commented 2 years ago

@maegibbons thanks...done!

maegibbons commented 2 years ago

@maegibbons thanks...done!

Just check it was mgibbons that it was sent to as not received.

feens commented 2 years ago

@maegibbons thanks...done!

Just check it was mgibbons that it was sent to as not received.

Double checked, and that's what I used. I wonder if it got caught in spam filters. Tried again with a different subject line to see if that helps.

maegibbons commented 2 years ago

Sent to you just now.

Krs

Mark

feens commented 2 years ago

@maegibbons got it, and was able to get everything working in HA. Thanks again!

Friseurazubi commented 2 years ago

Hi there, thanks a lot for the work on this. I have tried to get this working but get this: Exception: Cannot find XML configuraton for inYT v65

So I think, that I have to use a V33 .XML.

Could someone send me the XML?

Thanks a lot!

maegibbons commented 2 years ago

You need to send someone else or me an email as described In other posts.

mgibbons@ domain in profile

Krs

Mark

Friseurazubi commented 2 years ago

:) Done

Jeffke22 commented 2 years ago

Hi Maegibbons; i also send you a request for sending the v33 .xml file :) I hope this fixes the issue ;)

maegibbons commented 2 years ago

You need to email me. Instructions given above.

Krs

Mark

Jeffke22 commented 2 years ago

You need to email me. Instructions given above.

Krs

Mark

Done :)

maegibbons commented 2 years ago

Hmm..

Not received. You did do it to mgibbons?

Krs

Mark

Jeffke22 commented 2 years ago

yes, I just send another email :)

pcsmith811 commented 2 years ago

Hi @maegibbons - sent you an email about that file last week. Sent another today just in case - thank you!

ceddy441 commented 2 years ago

Hi @maegibbons - Sent an email.. Thanks in advance!

maegibbons commented 2 years ago

Hi @maegibbons - Sent an email.. Thanks in advance!

And I have already sent you the file.

obaceski commented 2 years ago

For reference, I have a 2020 hottub and after copying the spastruct v33, it worked fine. Is there any legal reason or otherwise why we couldn't add the updated file to the git repository?

laatzu commented 2 years ago

v33, where I can have it?

maegibbons commented 2 years ago

v33, where I can have it?

Instructions on emailing me at my domain have been given previously.

ubestbsteppin commented 2 years ago

Any update on getting an official, updated SpaPackStruct.xml without a workaround? Has Gecko commented on it?

maegibbons commented 2 years ago

The v33 is official. It is extracted from the app.

If you mean a sponsored download location from gecko, then no.

Krs

Mark

JohnMcLear commented 2 years ago

Email sent @maegibbons lemme know if you don't get it :)

gazoodle commented 2 years ago

As I commented in Issue #26 I'm thinking of adding the XML to the repo and downloading it from there which at least should put us at V33 as @maegibbons has kindly provided to many folk here.

gazoodle commented 2 years ago

Also wondering if @brandonmartin you managed to get further downloading from the API?

brandonmartin commented 2 years ago

Hey everyone, apologies for disappearing, lost track of this. Here is a script that gets the file from the API (it is still at v33 as of this writing).

Linky: https://gist.github.com/brandonmartin/18c6a89386aacfdef8e0db507d3b8570

There is a super secure top secret in the Intouch2.Droid.Generic assembly that I redacted from the script but will send privately to @gazoodle. I don't currently have the time to determine the ramifications (if any) of publishing this obfuscation non-anonymously.. Alternatively, it can be attained by decompressing and decompiling the dll (it is not encrypted).

JohnMcLear commented 2 years ago

@brandonmartin it might be worth describing the "secret" and we can ask legal council @ SFC/EFF et al on the legalities of publishing it.

brandonmartin commented 2 years ago

it is a 30 character ascii printable (ascii 32-126 inclusive) seemingly randomly generated static plaintext string. it is declared as a public override variable as part of a configuration class embedded within the generated application assembly and is present in the published, publicly distributed software.

it is a shared "secret" that allows the generation of the unique 'request id' so that presumably the 'request id' can be validated on the server side, presumably for debugging purposes.

it is not used for authorization for privileged API calls, however, a valid x-request-id field needs to be present in order for any (privileged or unprivileged) API call to succeed, a http 400 or 401 error code is returned otherwise. A bearer token is generated on the server side upon valid authentication of credentials which is used for privileged API calls, such as retrieving the SpaPackStruct xml.

gazoodle commented 2 years ago

It’s worth pointing out that you still need a valid account (email and password) with Gecko to generate the bearer token that @brandonmartin’s script uses to access the API. I’m not convinced that the “secret” isn’t semantically the same as a public key, given that it is held unencrypted in publicly available resources.

That said, if Gecko have gone to such peculiar lengths to make this tough to access, there can be little confusion around their intent.

I’ve got several ideas on how to mitigate this ranging from adding the download script to the library to redacting the XML to just the data needed to make the library work as required.

… still thinking 🤔

gazoodle commented 2 years ago

Oh, and I’m still trying to engage Gecko … 🤷‍♂️

JohnMcLear commented 2 years ago

I imagine Gecko at the moment don't want to support this as part of a "commercial offering" and therefore don't intend to provide any form of long term support around this.

It could be that we agree that this key can be made public and then Gecko drop this method of auth and we're back hacking something horrible together so I'm +1 engaging Gecko to provide an official/supported API method w/ LTS.

Let's give Gecko till the end of February for a decision and if they decide not to then let's put this thread in front of some legal council that can advise if we can publicly publish the "30 character ascii printable (ascii 32-126 inclusive) seemingly randomly generated static plaintext string".

If Gecko do agree to provide some form of commercial/long term supported solution I'd be +1 baking around that.

Final question, is there any commercial agreement/license that mentions not being able to publish/redistribute any of the consumed APIs that might include this string? If so, does anyone have a link to these agreements/licenses?

gazoodle commented 2 years ago

@JohnMcLear I've pointed out to them that I don't expect any support on this and don't want to interfere with their commercial stance. I've had one response from their CIO (who used to be the CTO) saying he's passed my request on to the R&D team, but that was last Feb and I've not heard anything since. I nudged a couple of times and I've tried a couple of other folk that I dug up on their LinkedIn page but they've not responded yet.

All this leads me to think that a) they're simply not interested in engaging with a bunch of home hackers and enthusiasts or b) I've not found the correct person yet.

For quite a while I've been thinking about ways around this, and while I think the best way would be to have some coherent API from them to allow local control of the SPA, I don't think they have the bandwidth or inclination to build this.

I'm sure there is nothing in the .XML file that contains any trade secrets, but I've shied away from added it to the repo since a) it can and has changed and it would be nice to dynamically update it and b) I'm also unsure of the legality of this (despite the file not having any copyright warning).

I don't have any problem using the data in there to generate some custom code which is the path I'm currently exploring, this having the side effect of only using data that the library is interested in (which I have demonstrated can be determined by watching communication between the iOS app and the in.touch2 module, so I have no problem with adding this to the repo) and it's all original work and substantially different so doesn't seem to exhibit any copyright infringement although IANAL.

The only downside is that if/when Gecko release a new version of the file the code will need to be updated, but that's where we are right now so I don't really see this as a big issue at the moment and at least we'll be able to support packs that are described in v33 of the XML which we've been struggling with since this library was first released ...

gazoodle commented 2 years ago

Ok folks, I've just pushed a bunch of code to the repo that removes the requirement to access SpaPackStruct.xml. It should be able to handle any spa that was listed in v33 of the file, but before I release it to PyPI where it'll get automatically consumed by the HA integration, can you take a quick look and see if it works for you.

So to be clear, you've got to get this repo locally and in a command prompt

gazoodle@devbox:~/Source/geckolib/tests$ python3 client.py

        <Disclaimer>
        ----------------------------- USE AT YOUR OWN RISK -----------------------------

        This code will allow you to make changes to your spa configuration that is
        outside of what the app, top panel and side panel settings allow. I've not
        tested every setting and it might be that you prevent your spa pack from
        operating as it used to do.

        I strongly suggest dumping the configuration values with the "config" command
        and recording them somewhere safe.

        </Disclaimer>

Starting discovery process...Found 1 spas
Connecting to spa `Spa` at 1.2.3.4 ... connected!
Heater: Temperature 39.5°C, SetPoint 39.5°C, Real SetPoint 39.5°C, Operation Idle
Pump 1: OFF
Pump 2: OFF
Blower: OFF
Lights: OFF
WaterCare: Waiting...
Smart Winter Mode:Risk = NO
Circulating Pump = OFF
Pump Run = False
Ozone = OFF
Smart Winter Mode:Active = False
Filter Status:Clean = False
Filter Status:Purge = False
Welcome to the Gecko shell. Type help or ? to list commands.

Spa$ version
geckolib version 0.3.21
SpaPackStruct.xml revision 33.00
intouch version EN 88 v15.0
intouch version CO 89 v11.0
Spa pack inXM 186 v3.0
Low level configuration # 4
Config version 9
Log version 9
Pack type 6
Spa$ exit

Questions, please ask and I'll try to fix breaking changes quickly.

gazoodle commented 2 years ago

Ok, sad as I am to be closing this issue :-) but I think that all the points in here are now resolved, in v0.3.22 and consumed in the HA integration v0.0.8 onwards.

Thanks to everyone who's contributed here, it's been a wild ride but I think that the current solution will fix the plethora of issues that folk have been experiencing around versions of SpaPackStruct.xml and even though there is no automatic update mechanism, the previous codebase didn't update either because Gecko left v19 on the end of the previous URL ... sigh.

jimbodude commented 2 years ago

Sorry for the slow confirmation - I confirm this is fixed for me. Thanks for your efforts on this.

$ version
geckolib version 0.3.24
SpaPackStruct.xml revision 33.00
intouch version EN 70 v14.0
intouch version CO 69 v11.0
Spa pack inYT 565 v11.0
Low level configuration # 2
Config version 64
Log version 64
Pack type 10