Skip to content

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

@hindenbyte

Description

@hindenbyte

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions