暴露通知监听器
exposure_notifications 组件使用 Esp32 Ble 跟踪器来发现
运行 Google/Apple 暴露通知服务的手机发送的附近 COVID-19 暴露通知蓝牙消息。
# Example configuration entryesp32_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);-
on_exposure_notification (Required, Automation): 在收到暴露通知蓝牙消息时运行的自动化。
一个类型为 API 参考: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", "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