-
Notifications
You must be signed in to change notification settings - Fork 479
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
Add support for the FastCon technology #669
base: dev
Are you sure you want to change the base?
Conversation
How to testBuild the environmentLinux
WIndows
Run the codepython3 The Python Interpreter is open. Let's write some code and check the response. >>> import broadlink as blk
>>> device = blk.hello("192.168.0.16") # Example IP address
>>> device.auth()
>>> subdevices = device.get_subdevices()
>>> did = subdevices[0].get("did")
>>> device.get_state(did)
>>> device.set_state(did, pwr=1)
>>> device.set_state(did, pwr=0) |
Hi @felipediel , |
Thank you! I forgot to mention, you need to have a sub-device connected to the device to test. |
I have 2 devices and one of them must be connecting as a sub-device as it doesn't respond to ping but I can control it thorugh Home Assistant and the Broadlink app, which woulod indicate it's part of the FastCon mesh. However, in the Broadlink app it doesn't specifically appear as a sub-device. |
@OMVMMG what type of sub devices do you have? If you would like to test with: Instructions here: https://community.home-assistant.io/t/broadlink-s3-hub-support/319832/18?u=stevendodd Noticed you are potentially using an SP4 device .. I'm not sure how that works but you might just be able to add the device ID into the Python library under an S3 hub for testing |
If you can control it with Home Assistant, it's not a subdevice, we don't support this feature yet. |
If you can control it with Home Assistant, it's not a subdevice, we don't support this feature yet. I can control one of them, as soon as I integrate the second device I lose control of the other. |
Are you using the process I described to create a Docker image? |
@felipediel hi state = {"count": step, "index": index}
print(state) # {'count': 5, 'index': 0}
packet = self._encode(14, state)
print(packet) # bytearray(b'!\x00\xa5\xa5ZZ\xa1\xc7\x0e\x0b\x15\x00\x00\x00{"count":5,"index":0}')
resp = self.send_packet(0x6A, packet)
print(resp) # b'Z\xa5\xaaUZ\xa5\xaaU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>\xe9\x00\x00\x8ba\xee\x03m\x94e8\x00\xb0C\xa0\x01\x00\x00\x00\x96\xcf\x00\x00\xfe\x10X\x995\xd2\xbcp\xe7\xe9\x8b\x1b\xc2\x95F\xd9\xec3\x07\x11\xe5\xf2\xc2\x93\x7fn \x02(\xb1\x1d@AM\x8c\xe7\xbf\x82\xf5h\x85heZ\xaa\xdd\x9b\x92^\x9dB5\xb7\xaf\x18\xddu\xa6\xb7Ez\x843E'
e.check_error(resp[0x22:0x24])
resp = self._decode(resp)
print(resp) # {'status': 0, 'total': 0, 'index': 0, 'list': []} Is there anything else I can help? |
Thank you! Maybe the communication is a bit different. I will do some research. If anyone can make it work, please let me know. |
We are making progress here: home-assistant/core/pull/69338. Everyone with subdevices is welcome to help capture and decode this packet: import socket
def discover(ip_addr):
conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
conn.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
conn.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
conn.settimeout(10)
packet = bytearray(0x30)
packet[0x26] = 6
checksum = sum(packet, 0xBEAF) & 0xFFFF
packet[0x20:0x22] = checksum.to_bytes(2, "little")
conn.sendto(packet, (ip_addr, 80))
resp = conn.recvfrom(1024)
conn.close()
return resp
resp = discover("192.168.0.16") # Example device IP address
print(resp)
unknown_bytes = resp[0x80:]
print(unknown_bytes) So the mission is to capture and understand the unknown bytes. This part of the packet contains the MAC address and product id (2 bytes) of the subdevices. |
@felipediel are you wanting someone to try and connect directly to a sub device? I don't think that's possible; I have to talk via the hub. The hub then sends UDP traffic to each sub device via a broadcast message. |
No, it's via hub, the devices can work as hubs too. They have subdevices that can be discovered with the function above. |
192.168.1.99 = S3 Hub
|
Would it help if we specify the DID (device unique identifier) in the integration? We can get the DID from Device Info from the Broadlink App. |
Proposed change
Add support for the FastCon technology. SP4 devices can now communicate with sub-devices.
Credits
@stevendodd helped us integrate the S3 hub recently. It's the same protocol.
Type of change
Additional information
Checklist