暴露通知监听器
exposure_notifications 组件使用 Esp32 Ble Tracker 来发现附近运行 Google/Apple 暴露通知服务的手机发送的 COVID-19 暴露通知蓝牙消息。
# 示例配置条目esp32_ble_tracker:
exposure_notifications: on_exposure_notification: then: - lambda: | ESP_LOGD("main", "收到通知:"); ESP_LOGD("main", " RPI: %s", format_hex_pretty(x.rolling_proximity_identifier).c_str()); ESP_LOGD("main", " RSSI: %d", x.rssi);-
on_exposure_notification (可选, Automation): 收到暴露通知蓝牙消息时运行的自动化。
一个类型为 API Reference: exposure_notifications::ExposureNotification 的变量
x将传递给自动化。
暴露通知负载包含:
- 滚动邻近标识符(RPI):一个 16 字节长的值,用于在 10 分钟时间窗口内识别给定设备。
- 关联加密元数据(AEM):附加的加密元数据,如发射功率。
由于 GAEN 框架旨在防止追踪个人,此数据基本上只能用于检查是否有启用了暴露通知的设备在附近(以及在有限程度上统计它们的数量)。
暴露通知设备指示器
Section titled “暴露通知设备指示器”以下配置可用作指示附近是否有启用暴露通知的设备。只要在最后一分钟内收到了暴露通知,指示器就会亮起。
esp32_ble_tracker:
switch: - platform: gpio pin: GPIOXX 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", "收到通知:"); ESP_LOGD("main", " RPI: %s", format_hex_pretty(x.rolling_proximity_identifier).c_str()); ESP_LOGD("main", " RSSI: %d", x.rssi);
# 停止现有计时器,以免 turn_off 被调用 - script.stop: start_led - script.execute: start_led