bmork / defogger

D-Link DCS-8000LH usage info and defogging tools
264 stars 37 forks source link

Does this run on a Raspberry Pi? #15

Open jack10768 opened 4 years ago

jack10768 commented 4 years ago

I'm attempting this on the 8600LH. I managed to install bluepy and Python 3.7. However, when running I get this error:

python dcs8000lh-configure.py 00:11:22:33:44:55 123456 --survey [real MAC and pin redacted]

Connecting to 00:11:22:33:44:55... Verifying IPCam service Traceback (most recent call last): File "dcs8000lh-configure.py", line 152, in cam = BleCam(args.address, args.pincode) File "dcs8000lh-configure.py", line 30, in init self.name = self.periph.getCharacteristics(uuid=0x2a00)[0].read().decode() # wellknown name characteristic File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 508, in getCharacteristics rsp = self._getResp('find') File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 368, in _waitResp raise BTLEGattError("Bluetooth command failed", resp) bluepy.btle.BTLEGattError: Bluetooth command failed (code: 10, error: No attribute found within the given range)

Is this because I'm running off a raspberry pi? Is there something else I'm missing? I've checked that the bluetooth agent is on and active and the pi is able to see the reset camera as a bluetooth device.

bmork commented 4 years ago

jack10768 notifications@github.com writes:

I'm attempting this on the 8600LH. I managed to install bluepy and Python 3.7. However, when running I get this error:

python dcs8000lh-configure.py 00:11:22:33:44:55 123456 --survey [real MAC and pin redacted]

Connecting to 00:11:22:33:44:55... Traceback (most recent call last): File "dcs8000lh-configure.py", line 152, in cam = BleCam(args.address, args.pincode) File "dcs8000lh-configure.py", line 28, in init self.periph = Peripheral(address) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in init self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 00:11:22:33:44:55, addr type: public

Is this because I'm running off a raspberry pi? Is there something else I'm missing? I've checked that the bluetooth agent is on and active and the pi is able to see the reset camera as a bluetooth device.

I believe this should work as long as the RPi has BLE support.

Can you connect using e.g gatttool? See https://elinux.org/RPi_Bluetooth_LE for an example using RPi. Running

hcitool lescan

should show your camere. And

gatttol -I -b 00:11:22:33:44:55

followed by

connect characteristics

should result in somthing like

gatttool -I -b 00:11:22:33:44:55

[00:11:22:33:44:55][LE]> connect Attempting to connect to 00:11:22:33:44:55 Connection successful [00:11:22:33:44:55][LE]> characteristics handle: 0x0004, char properties: 0x02, char value handle: 0x0006, uuid: 00002a00-0000-1000-8000-00805f9b34fb handle: 0x0007, char properties: 0x02, char value handle: 0x0008, uuid: 00002a01-0000-1000-8000-00805f9b34fb

If this works, then there is some problem with the python script or libs. If it doesn't work, then there is some issue with the RPi BLE support or camera.

Bjørn

dave-code-ruiz commented 4 years ago

I have a raspberry and it works perfectly. I have ever received this message and I think it is a distance or coverage problem. Unplug the camera and connect it near to the raspberry and try again. Luck

sambal0 commented 2 years ago

I´ve got a similar problem and stuck with the recent firmware 2.07.01:

sudo python dcs8000lh-configure.py 00:11:22:33:44:55 123456 --survey [real MAC and pin redacted]

Connecting to 00:11:22:33:44:55... Verifying IPCam service Traceback (most recent call last): File "dcs8000lh-configure.py", line 152, in cam = BleCam(args.address, args.pincode) File "dcs8000lh-configure.py", line 29, in init self._ipcamservice() File "dcs8000lh-configure.py", line 38, in _ipcamservice except BTLEEException: NameError: global name 'BTLEEException' is not defined

Tested: gatttol -I -b 00:11:22:33:44:55

it connects to the camera, but doesn´t react to the commands characteristics or primary. Any ideas? Thanks a lot in advance.