HclX / WyzeSensePy

A python script communicating with WyzeSense gateway
MIT License
91 stars 15 forks source link

Support for hiddev #7

Open mgriffin13 opened 4 years ago

mgriffin13 commented 4 years ago

Some devices, like a Synology NAS, mount the Wyze Bridge as a hiddev device because they don't contain the hidraw drivers. Would it be possible to support both hiddev and hidraw devices?

HclX commented 4 years ago

The library accepts a device path, which can be anything. Have you tried passing it the path to the "hiddev" device?

jdesai61 commented 4 years ago

I tried it using --device, and here is what I get

[[/tmp/WyzeSensePy-master] # ./sample.py --device /dev/usb/hiddev0 -d -v Openning wyzesense gateway ['/dev/usb/hiddev0'] DEBUG 2020-04-04 18:20:11,012 Start Inquiry... DEBUG 2020-04-04 18:20:11,013 ===> Sending: Packet: Cmd=4327, Payload= DEBUG 2020-04-04 18:20:11,014 Sending: aa55430327016c Traceback (most recent call last): File "./sample.py", line 134, in sys.exit(main(docopt(usage))) File "./sample.py", line 48, in main ws = wyzesense.Open(device, on_event) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 551, in Open return Dongle(device, event_handler) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 295, in init self._Start() File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 482, in _Start self._Inquiry() File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 388, in _Inquiry resp = self._DoSimpleCommand(Packet.Inquiry()) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 383, in _DoSimpleCommand self._DoCommand(pkt, cmd_handler, timeout) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 369, in _DoCommand self._SendPacket(pkt) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 326, in _SendPacket pkt.Send(self.__fd) File "/tmp/WyzeSensePy-master/wyzesense/gateway.py", line 105, in Send ss = os.write(fd, pkt) OSError: [Errno 22] Invalid argument

HclX commented 4 years ago

I did a quick look with my synology and it seems hiddev is not possible with this: hidraw reports more information than hiddev. With hiddev, those information will never gets to the code.

jdesai61 commented 4 years ago

Thanks for a quick response - I am moving on to running it on Raspberry Pi.