Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device binding fails because of camel case in bind response #113

Open
hindenbyte opened this issue Nov 30, 2024 · 1 comment
Open

Device binding fails because of camel case in bind response #113

hindenbyte opened this issue Nov 30, 2024 · 1 comment

Comments

@hindenbyte
Copy link

I have an AC unit that apparently has firmware version 3.0.0


{
    "t": "pack",
    "i": 1,
    "uid": 0,
    "cid": "XXX",
    "tcid": "",
    "pack": {
        "t": "dev",
        "cid": "",
        "bc": "gree",
        "catalog": "gree",
        "mid": "60",
        "model": "gree",
        "name": "GR-ACUnit_6400_02_XXX_EC",
        "series": "gree",
        "vender": "2",
        "ver": "V3.0.0",
        "brand": "gree",
        "mac": "XXX",
        "ModelType": "0",
        "lock": 0,
        "subCnt": 1
    }
}

When trying to bind to it I'm getting an warning and the binding fails, apparently because "bindOK" is not a valid response

greeclimate.network - DEBUG - Received packet from 192.168.1.36:
<- {"t": "pack", "i": 1, "uid": 0, "cid": "XXX", "tcid": "", "pack": {"t": "bindOk", "mac": "XXX", "r": 200, "key": "XXX"}}
greeclimate.network - WARNING - Received unknown packet from 192.168.1.36:
{"t": "pack", "i": 1, "uid": 0, "cid": "XXX", "tcid": "", "pack": {"t": "bindOk", "mac": "XXX", "r": 200, "key": "XXX"}}

in network.py it seems you're only checking for "bindok" as a valid response

class Response(Enum):
    BIND_OK = "bindok"
    DATA = "dat"
    RESULT = "res"

To work around it I changed line 233 to this:

resp = str.lower(obj.get("pack", {}).get("t"))

But there's probably a more elegant way to fix this

@CiyLei
Copy link

CiyLei commented Dec 18, 2024

I also encountered this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants