You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for Qingping/Cleargrass advertisements and fix support for custom format (#105)
* Added HTTP callback support
* Add support for Qingping/ClearGrass advertisements
* Fix support for custom format
* Qingping/ClearGrass now tested with CGG1 and CGDK2
* Restored commented out code requested by JsBergbau
* Fixed missing influxdb timestamp code for ATC mode
* Renamed ATC to Passive mode and improved README
* Improved Qingping docs in README a bit further
* Updated version to 5.0
parser.add_argument("--device","-d", help="Set the device MAC-Address in format AA:BB:CC:DD:EE:FF",metavar='AA:BB:CC:DD:EE:FF')
324
-
parser.add_argument("--battery","-b", help="Get estimated battery level, in ATC-Mode: Get battery level from device", metavar='', type=int, nargs='?', const=1)
324
+
parser.add_argument("--battery","-b", help="Get estimated battery level, in passive mode: Get battery level from device", metavar='', type=int, nargs='?', const=1)
325
325
parser.add_argument("--count","-c", help="Read/Receive N measurements and then exit script", metavar='N', type=int)
326
326
parser.add_argument("--interface","-i", help="Specifiy the interface number to use, e.g. 1 for hci1", metavar='N', type=int, default=0)
327
327
parser.add_argument("--unreachable-count","-urc", help="Exit after N unsuccessful connection tries", metavar='N', type=int, default=0)
328
328
parser.add_argument("--mqttconfigfile","-mcf", help="specify a configurationfile for MQTT-Broker")
329
329
330
330
331
331
rounding=parser.add_argument_group("Rounding and debouncing")
332
-
rounding.add_argument("--round","-r", help="Round temperature to one decimal place (and in ATC mode humidity to whole numbers)",action='store_true')
332
+
rounding.add_argument("--round","-r", help="Round temperature to one decimal place (and in passive mode humidity to whole numbers)",action='store_true')
333
333
rounding.add_argument("--debounce","-deb", help="Enable this option to get more stable temperature values, requires -r option",action='store_true')
callbackgroup.add_argument("--skipidentical","-skip", help="N consecutive identical measurements won't be reported to callbackfunction",metavar='N', type=int, default=0)
350
350
callbackgroup.add_argument("--influxdb","-infl", help="Optimize for writing data to influxdb,1 timestamp optimization, 2 integer optimization",metavar='N', type=int, default=0)
351
351
352
-
atcgroup=parser.add_argument_group("ATC mode related arguments")
353
-
atcgroup.add_argument("--atc","-a", help="Read the data of devices with custom ATC firmware flashed, use --battery to get battery level additionaly in percent",action='store_true')
354
-
atcgroup.add_argument("--watchdogtimer","-wdt",metavar='X', type=int, help="Re-enable scanning after not receiving any BLE packet after X seconds")
355
-
atcgroup.add_argument("--devicelistfile","-df",help="Specify a device list file giving further details to devices")
356
-
atcgroup.add_argument("--onlydevicelist","-odl", help="Only read devices which are in the device list file",action='store_true')
357
-
atcgroup.add_argument("--rssi","-rs", help="Report RSSI via callback",action='store_true')
352
+
passivegroup=parser.add_argument_group("Passive mode related arguments")
353
+
passivegroup.add_argument("--passive","-p","--atc","-a", help="Read the data of devices based on BLE advertisements, use --battery to get battery level additionaly in percent",action='store_true')
354
+
passivegroup.add_argument("--watchdogtimer","-wdt",metavar='X', type=int, help="Re-enable scanning after not receiving any BLE packet after X seconds")
355
+
passivegroup.add_argument("--devicelistfile","-df",help="Specify a device list file giving further details to devices")
356
+
passivegroup.add_argument("--onlydevicelist","-odl", help="Only read devices which are in the device list file",action='store_true')
357
+
passivegroup.add_argument("--rssi","-rs", help="Report RSSI via callback",action='store_true')
print("In this mode all devices within reach are read out, unless a devicelistfile and --onlydevicelist is specified.")
543
543
print("Also --name Argument is ignored, if you require names, please use --devicelistfile.")
544
544
print("In this mode debouncing is not available. Rounding option will round humidity and temperature to one decimal place.")
545
-
print("ATC mode usually requires root rights. If you want to use it with normal user rights, \nplease execute \"sudo setcap cap_net_raw,cap_net_admin+eip $(eval readlink -f `which python3`)\"")
545
+
print("Passive mode usually requires root rights. If you want to use it with normal user rights, \nplease execute \"sudo setcap cap_net_raw,cap_net_admin+eip $(eval readlink -f `which python3`)\"")
546
546
print("You have to redo this step if you upgrade your python version.")
if(atcIdentifier=="1A18" ) andnotargs.onlydevicelistor (atcIdentifier=="1A18"andmacinsensors) and (len(atcData_str) ==26orlen(atcData_str) ==16orlen(atcData_str) ==22): #only Data from ATC devices
623
-
globalmeasurements
624
-
measurement=Measurement(0,0,0,0,0,0,0,0)
625
-
iflen(atcData_str) ==30: #custom format, next-to-last ist adv number
626
-
advNumber=atcData_str[-4:-2]
627
-
else:
628
-
advNumber=atcData_str[-2:] #last data in paket is adv number
629
610
611
+
if(dataIdentifier=="1A18") andnotargs.onlydevicelistor (dataIdentifier=="1A18"andmacinsensors) and (len(strippedData_str) in (16, 22, 26, 30)): #only Data from ATC devices
612
+
iflen(strippedData_str) ==30: #custom format, next-to-last ist adv number
613
+
advNumber=strippedData_str[-4:-2]
614
+
else:
615
+
advNumber=strippedData_str[-2:] #last data in paket is adv number
0 commit comments