Exposure Notification Listener

The exposure_notifications component uses the ESP32 Bluetooth Low Energy Tracker Hub to discover nearby COVID-19 exposure notification bluetooth messages sent by phones running the Google/Apple Exposure Notification service.

# Example configuration entry
esp32_ble_tracker:

exposure_notifications:
  on_exposure_notification:
    then:
      - lambda: |
          ESP_LOGD("main", "Got notification:");
          ESP_LOGD("main", "  RPI: %s", format_hex_pretty(x.rolling_proximity_identifier).c_str());
          ESP_LOGD("main", "  RSSI: %d", x.rssi);

Configuration variables:

An exposure notification payload contains:

  • Rolling proximity identifier (RPI): A 16-byte long value used to identify a given device in a 10-minute window.

  • Associated encrypted metadata (AEM): Additional encrypted metadata, like transmit power.

Because the GAEN framework is designed to prevent tracking an individual, this data can essentially only be used to check whether a device with enabled exposure notifications is nearby (and to limited degree also count them).

Indicator of device with exposure notifications

The following configuration can be used as an indicator whether an exposure-notifications enabled device is nearby. As long as an exposure notification has been received in the last minute, the indicator will be on.

esp32_ble_tracker:

switch:
  - platform: gpio
    pin: GPIO22
    id: led

script:
  - id: start_led
    then:
      - switch.turn_on: led
      - delay: 1min
      - switch.turn_off: led

exposure_notifications:
  on_exposure_notification:
    then:
      - lambda: |
          ESP_LOGD("main", "Got notification:");
          ESP_LOGD("main", "  RPI: %s", format_hex_pretty(x.rolling_proximity_identifier).c_str());
          ESP_LOGD("main", "  RSSI: %d", x.rssi);

      # Stop existing timer so that turn_off doesn't get called
      - script.stop: start_led
      - script.execute: start_led

See Also