BLE observation to controll in- and outbounds (Raspberry Pi / Phyton)

Hi guys,

I´m pretty new at the “coding world” and need some help to design a pilot concept to track in- and outbound shipments within warehouses.

The concrete plan is to have beacons within shipping units and let them send out the BLE signal every minute. Within warehouses and / or other location a “listener” or “receptor” is installed (for the pilot it might be a raspberry pi). This receptor shall detect the BLE signal and send the information about detecting to a Email Address.

Detecting BLE signals with a raspberry is pretty easy. (sudo hcitool lescan)

But I struggle with getting this detection automated. The process might be like this:

  1. Raspberry searches for beacon signals

  2. Raspberry detects signal the first time -> Information to Email “Shipment arrived”

  3. Raspberry doesn´t detect the signal anymore -> Information to Email “Shipment gone”

Has someone an idea how this can be programmed?