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

Binding does not work with Gree Clivia #76

Open
gliter opened this issue Jun 22, 2024 · 5 comments
Open

Binding does not work with Gree Clivia #76

gliter opened this issue Jun 22, 2024 · 5 comments
Labels
question Further information is requested

Comments

@gliter
Copy link

gliter commented Jun 22, 2024

Binding does not work with Gree Clivia. The AC does respond to scan package but then does not respond to bind package.
Wireshark shows no response.

@cmroche
Copy link
Owner

cmroche commented Jun 26, 2024

Could you show the full debug logs please. @gliter .

@cmroche cmroche added the question Further information is requested label Jun 27, 2024
@cmroche
Copy link
Owner

cmroche commented Jul 6, 2024

This may be solved in #92

@gliter
Copy link
Author

gliter commented Jul 6, 2024

@cmroche sorry for late response. There is really nothing to share.
It does respond to scan package with:

{"t":"dev","cid":"","bc":"00000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"<Redacted MAC>","mid":"10001","model":"gree","name":"","lock":0,"series":"gree","vender":"1","ver":"V3.2.M","hid":"362001068254+U-4MWB65VRV2.08.bin","ModelType":"16752730"}

but when you send the bind package there is no data received back on socket.

Thats great about #92 personally I am using OpenHab with Java binding but if this is work I hope you dont mind me or someone porting it there.

@scharfi49
Copy link

scharfi49 commented Jul 11, 2024

@cmroche Hi!, i have tested PR #92, but discovery is not working there.
in the datagram_received() is a type Error, self._cipher can "None" => it do not have method decrypt.
Also updating this method:

def datagram_received(self, data: bytes, addr: IPAddr) -> None:
        """Handle an incoming datagram."""
        if len(data) == 0:
            return

        obj = json.loads(data)

        if obj.get("pack"):
            if self._cipher is None:
                _LOGGER.error("Cipher object not set, cannot decrypt data")
                return

            obj["pack"] = self._cipher.decrypt(obj["pack"])

        _LOGGER.debug("Received packet from %s:\n<- %s", addr[0], json.dumps(obj))
        self.packet_received(obj, addr)

Throws greeclimate.network - ERROR - Cipher object not set, cannot decrypt data.

During testing i discovered that the discovery process should be processed as before. But using bind() method when we have a discovered device/devices we should use another GCM encryption to communicate with.

We can simply provide cipher in search_on_interface() method:
await self.send({"t": "scan"}, (str(bcast_iface), 7000), cipher=CipherV1(b'a3K8Bx%2r8Y7#xDh'))

also we need to declare him in send() method:

if obj.get("t") == "scan":
            self._cipher = cipher

this way on the first case -> discovery we will always use CipherV1 for discover devices

@cmroche
Copy link
Owner

cmroche commented Jul 13, 2024

@scharfi49 There was a bug, as you found :) Would you please test again and report any other issue over here #92 (comment)

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

No branches or pull requests

3 participants