Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Mips2648 committed Jan 15, 2025
1 parent 6ed3a82 commit eb6265b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
12 changes: 6 additions & 6 deletions resources/beagled/blescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ def parse_events(sock, loop_count=100):
for i in range(0, num_reports):
Adstring = packed_bdaddr_to_string(pkt[report_pkt_offset + 3:report_pkt_offset + 9])
Adstring += ","
Adstring += returnstringpacket(pkt[report_pkt_offset -32: report_pkt_offset - 1])
Adstring += returnstringpacket(pkt[report_pkt_offset - 32: report_pkt_offset - 1])
Adstring += ","
Adstring += "%i" % returnnumberpacket(pkt[report_pkt_offset -6: report_pkt_offset - 4])
Adstring += "%i" % returnnumberpacket(pkt[report_pkt_offset - 6: report_pkt_offset - 4])
Adstring += ","
Adstring += "%i" % returnnumberpacket(pkt[report_pkt_offset -4: report_pkt_offset - 2])
Adstring += "%i" % returnnumberpacket(pkt[report_pkt_offset - 4: report_pkt_offset - 2])
Adstring += ","
Adstring += "%i" % struct.unpack("b", bytes([pkt[report_pkt_offset -2]]))
Adstring += "%i" % struct.unpack("b", bytes([pkt[report_pkt_offset - 2]]))
Adstring += ","
Adstring += "%i" % struct.unpack("b", bytes([pkt[report_pkt_offset -1]]))
trame = returnstringpacket(pkt[report_pkt_offset -32: report_pkt_offset - 1])
Adstring += "%i" % struct.unpack("b", bytes([pkt[report_pkt_offset - 1]]))
trame = returnstringpacket(pkt[report_pkt_offset - 32: report_pkt_offset - 1])
mac = packed_bdaddr_to_string(pkt[report_pkt_offset + 3:report_pkt_offset + 9])
Beagle(trame, mac).parse()
sock.setsockopt(bluez.SOL_HCI, bluez.HCI_FILTER, old_filter)
Expand Down
51 changes: 44 additions & 7 deletions resources/beagled/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
LEARN_MODE = False
IFACE_DEVICE = 0
LEARN_BEGIN = int(time.time())
lastevent={}
lastdata={}
lastevent = {}
lastdata = {}
donglemac = ''


Expand All @@ -18,12 +18,49 @@
uniquekey = '9f5b9cced150d9d051b0b7da4c4e2de6'
jeedomkey = ''

ac = {'off' : '00', 'on' : '01' , 'toggle' : '02','up':'05','down':'06','stop':'07', 'goto':'20', 'customerScenes' : '0C','schneiderScenes' : '0D' , 'groups' : '0B'}
ac = {
'off': '00',
'on': '01',
'toggle': '02',
'up': '05',
'down': '06',
'stop': '07',
'goto': '20',
'customerScenes': '0C',
'schneiderScenes': '0D',
'groups': '0B'
}

cftarget = {'switch' : '0F', 'dcl' : '1F' , 'generic' : '2F' ,'shutter':'3F','plug' : '4F','dimmer' : '5F','scene' : 'FF','groupdcl' :'1F','groupshutter':'3F','groupplug':'4F','groupdimmer':'5F'}
cftarget = {
'switch': '0F',
'dcl': '1F',
'generic': '2F',
'shutter': '3F',
'plug': '4F',
'dimmer': '5F',
'scene': 'FF',
'groupdcl': '1F',
'groupshutter': '3F',
'groupplug': '4F',
'groupdimmer': '5F'
}

types = {'shutter':'8f44','dcl' : '9844', 'generic' : '9244','switch' : '8e44', 'plug' : '9044', 'dimmer' : '9144', 'gateway' : 'A244' }
types = {
'shutter': '8f44',
'dcl': '9844',
'generic': '9244',
'switch': '8e44',
'plug': '9044',
'dimmer': '9144',
'gateway': 'A244'
}

gateway = {'advertisement' : 'A0' , 'binding' : 'A1'}
gateway = {
'advertisement': 'A0',
'binding': 'A1'
}

scenes = {'schneider' : 'FD' , 'custom' : 'FC'}
scenes = {
'schneider': 'FD',
'custom': 'FC'
}

0 comments on commit eb6265b

Please sign in to comment.