ソースを参照

BLE scanner test

Patryk M. Gutowski 2 年 前
コミット
a2a74d0ed4
1 ファイル変更44 行追加3 行削除
  1. 44 3
      gf-bt-proxy-01.yaml

+ 44 - 3
gf-bt-proxy-01.yaml

@@ -38,10 +38,51 @@ esp32_ble_tracker:
     # enable the built-in coexistence logic in ESP-IDF
     active: true
 
-bluetooth_proxy:
-  active: true
+# bluetooth_proxy:
+#  active: true
+
+external_components:
+  - source: github://myhomeiot/esphome-components
+
+ble_gateway:
+  id: blegateway
+  on_ble_advertise:
+    then:
+      homeassistant.event:
+        event: esphome.on_ble_advertise
+        data:
+          packet: !lambda return packet;
+#          gateway_id: ${device_id}
+binary_sensor:
+  - platform: homeassistant
+    id: ble_gateway_discovery
+    entity_id: binary_sensor.ble_gateway
+    attribute: discovery
+    on_state:
+      then:
+        lambda: id(blegateway).set_discovery(x);
+
+text_sensor:
+  - platform: homeassistant
+    id: ble_gateway_devices
+    entity_id: binary_sensor.ble_gateway
+    attribute: devices
+    on_value:
+      then:
+        lambda: id(blegateway).set_devices(x);
+
+switch:
+  - platform: template
+    id: switch_ble_gateway_discovery
+    name: BLE Gateway Discovery
+    icon: mdi:bluetooth-connect
+    lambda: return id(blegateway).get_discovery();
+    turn_on_action: [lambda: id(blegateway).set_discovery(true);]
+    turn_off_action: [lambda: id(blegateway).set_discovery(false);]
+    disabled_by_default: true
+    entity_category: config
 
 button:
 - platform: safe_mode
   name: Safe Mode Boot
-  entity_category: diagnostic
+  entity_category: diagnostic