Python Forum
Creating a list of RSSI value and send it to the server.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a list of RSSI value and send it to the server.
#1
Hi there.

I'm trying to create an Indoor Positioning System using iBeacon signal, Bluepy and Raspberry Pi Zero W. Basically my Python code (which I refer tutorial on the Internet) can read the RSSI value from my BLE beacon. Below is my python code to scan and print the RSSI value of iBeacon:

#!/usr/bin/python3

import time
from bluepy.btle import Scanner, DefaultDelegate

class ScanDelegate(DefaultDelegate):
    def __init__(self):
        DefaultDelegate.__init__(self)


    def HandleDiscovery(self,dev,new_dev,new_dat):
        if new_dev:
            pass
        if new_dat:
            pass
        
scanner = Scanner().withDelegate(ScanDelegate())

time_diff = 0
first_time = 1
while 1:
    try:
        devices = scanner.scan(0.35)
##        print("Amount of Devices = "+str(len(devices)))
        for ii in devices:
##            print(ii.addr)
            if ii.addr == '50:51:a9:fe:b4:c6':

                print("Device %s, RSSI=%d dB" % (ii.addr,ii.rssi))
                if first_time == 1:
                    first_time = 0
                    pass
                else:
                    time_diff = time.time()-time_prev
                    

                
                time_prev = time.time()
                rssi_prev = ii.rssi
                continue

    except:
        continue
So now, I need to create a list of this RSSI value, UUID and all the data related before I can send them to a server. Since I'm new to this Python programming, so I don't know how to put all the informations that I get in a list.

Thanks in advance for help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  creating python server and client in a pc kucingkembar 4 1,955 Nov-29-2021, 01:37 PM
Last Post: kucingkembar
  Class-Aggregation and creating a list/dictionary IoannisDem 1 1,880 Oct-03-2021, 05:16 PM
Last Post: Yoriz
  How to take the tar backup files form remote server to local server sivareddy 0 1,871 Jul-14-2021, 01:32 PM
Last Post: sivareddy
  Creating list of lists from generator object t4keheart 1 2,161 Nov-13-2020, 04:59 AM
Last Post: perfringo
  Creating a dictionary from a list Inkanus 5 3,106 Nov-06-2020, 06:11 PM
Last Post: DeaD_EyE
  Creating a list of dictionaries while iterating pythonnewbie138 6 3,194 Sep-27-2020, 08:23 PM
Last Post: pythonnewbie138
  server selects Runners from list and sends model alex80 2 2,012 Sep-07-2020, 09:08 AM
Last Post: alex80
  creating a list of dictionaries from API calls AndrewEnglsh101 5 3,010 Apr-03-2020, 02:21 PM
Last Post: AndrewEnglsh101
  Creating new list based on exact regex match in original list interjectdirector 1 2,251 Mar-08-2020, 09:30 PM
Last Post: deanhystad
  Python script Server list - if condition error razor04 12 5,068 Jan-27-2020, 09:05 PM
Last Post: razor04

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020