Binding does not work with Gree Clivia
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.
Could you show the full debug logs please. @gliter .
This may be solved in #92
@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.
@cmroche Hi!, i have tested PR https://github.com/cmroche/greeclimate/pull/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
@scharfi49 There was a bug, as you found :) Would you please test again and report any other issue over here https://github.com/cmroche/greeclimate/pull/92#issuecomment-2227112679