Skip to content

Commit

Permalink
Added interface selection
Browse files Browse the repository at this point in the history
  • Loading branch information
JsBergbau authored Mar 29, 2020
1 parent 82f1654 commit c09040c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion LYWSD03MMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def handleNotification(self, cHandle, data):
# Initialisation -------

def connect():
p = btle.Peripheral(adress)
#print("Interface: " + str(args.interface))
p = btle.Peripheral(adress,iface=args.interface)
val=b'\x01\x00'
p.writeCharacteristic(0x0038,val,True) #enable notifications of Temperature, Humidity and Battery voltage
p.writeCharacteristic(0x0046,b'\xf4\x01\x00',True)
Expand All @@ -198,6 +199,8 @@ def connect():
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')
parser.add_argument("--battery","-b", help="Get estimated battery level", metavar='', type=int, nargs='?', const=1)
parser.add_argument("--count","-c", help="Read/Receive N measurements and then exit script", metavar='N', type=int)
parser.add_argument("--interface","-i", help="Specifiy the interface number to use, e.g. 1 for hci1", metavar='N', type=int, default=0)


rounding = parser.add_argument_group("Rounding and debouncing")
rounding.add_argument("--round","-r", help="Round temperature to one decimal place",action='store_true')
Expand Down

0 comments on commit c09040c

Please sign in to comment.