Closed jayneev closed 2 years ago
Hi @jayneev, we are remaking the BLE connector now. We will let you know when it is done.
Thanks for your interest in ThignsBoard IoT Gateway!
@samson0v I have this Broken pipe issue too and after this exception happens, gateway can't reconnect to device that has this exception anymore. The only way to connect to that device again is restart gateway process.
Do you have any recommended workaround for this issue while waiting for the new BLE connector?
Best regard
@ndrs-cwt, we fixed the problem, you can update your Gateway from the master branch and try to test it. But we are afraid that it does not help because of a very big waiting time for notification.
@samson0v, Thank you for the new BLE connector, but re-read approach doesn't fix my Broken pipe problem but maybe it works for OP case.
I just found some workaround for my problem by record the name of the Broken pipe device in some list
except BrokenPipeError:
log.exception('Broken Pipe. Device %s, wait for remake', device)
self.__remake_list.append(device)
continue
and delete all of its Peripheral relate objects and let's connector create all related objects again
if time.time() - self.__previous_read_time >= self.__check_interval_seconds:
self.__get_services_and_chars()
if len(self.__remake_list) > 0:
for device in self.__remake_list:
log.warning("Clear %s entry from __devices_around", device)
del self.__devices_around[device]["peripheral"]
del self.__devices_around[device]["services"]
self.__devices_around[device]["is_new_device"] = True # Trig the connector to remake all object
self.__remake_list.clear()
self.__previous_read_time = time.time()
this is from my custom BLE connector that almost exact copy from TB's BLE connector but remove notify support and always disconnect from device. This band-aid just makes my gw can reconnect to the Broken pipe device again but have to wait for next read interval to recreate device object and start reading data again.
Hi @ndrs-cwt, we did a remake of the BLE Connector yesterday, so you can install the new version of Gateway from the master branch and test the connector. Let us know if the new version of BLE Connector fixes your problem.
Thank you @samson0v and @zbeacon for sharing the ble connector remake, We are trying to find right way to get 'data notification updates from BLE peripheral devices, with latest checked out code. Below are few observations and queries , if provided feedback, will definitely help us to get notify data on gateway.
OBSERVATION: Below parameters in ble.json now removed from latest one. Are they replaced with new parameter ? Old parameters: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "rescanIntervalSeconds": 18000, "checkIntervalSeconds": 45, "scanTimeSeconds": 35, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< New parameters: (Is this suffice above requirements?) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "scanner": { "timeout": 10000, "deviceName": "Device name" <==== Is this 'Device name' needs to be replaced with gateway name at TB side? }, "devices": [ { ...... "pollPeriod": 500000, <==== per devices ..... } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
QUERY: Is the newly added above json parameter tag 'deviceName' value is the gateway name specified on Thingsboard?
QUERY: Once device connected to gateway, will they get added in TB dashboard as in previous versions?
QUERY: As in QUERY#3 above, are the below JSON parameters still serve purpose of identifying the device connected? "attributes": [ { "key": "name", "method": "read", "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB", "byteFrom": 0, "byteTo": -1 } ], "attributeUpdates": [ { "attributeOnThingsBoard": "sharedName", "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB" } ],
QUERY: Does server side RPC if not used, should the below feel be empty? "serverSideRpc": [ { "methodRPC": "rpcMethod1", "withResponse": true, "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB", "methodProcessing": "read" }, { "methodRPC": "rpcMethod2", "withResponse": true, "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB", "methodProcessing": "write" }, { "methodRPC": "rpcMethod3", "withResponse": true, "methodProcessing": "scan" } ]
QUERY: Does current configuration supports ACTIVE scan mode? If yes, then does setting "passiveScanMode": false, will suffice this requirement?
I appreciate you all for your valuable contribution and help.
Warm Regards, @jayneev
Was discussed and a new issue was opened.
Describe the bug ‘BrokenPipeError: [Errno 32] Broken pipe’ Steps:
Connector name (If bug in the some connector): BLE Connector
Versions (please complete the following information):