gf-bt-proxy-01.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. substitutions:
  2. devicename: gf-bt-proxy-01
  3. low_devicename: gf_bt_proxy_01
  4. friendly_devicename: GF Bluetooth Proxy
  5. esphome:
  6. name: $devicename
  7. friendly_name: $friendly_devicename
  8. esp32:
  9. board: esp32dev
  10. framework:
  11. type: esp-idf
  12. # Enable logging
  13. logger:
  14. # Enable Home Assistant API
  15. api:
  16. encryption:
  17. key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
  18. ota:
  19. password: "2c27af3ab81f992e23745c20ab5dfc02"
  20. wifi:
  21. ssid: !secret iot_ssid
  22. password: !secret iot_password
  23. domain: .int.mmax.cloud
  24. # Enable fallback hotspot (captive portal) in case wifi connection fails
  25. ap:
  26. ssid: "Gf-Bt-Proxy-01 Fallback Hotspot"
  27. password: "Ry3eaIb2vmf1"
  28. improv_serial:
  29. esp32_ble_tracker:
  30. scan_parameters:
  31. # We currently use the defaults to ensure Bluetooth
  32. # can co-exist with WiFi In the future we may be able to
  33. # enable the built-in coexistence logic in ESP-IDF
  34. active: true
  35. # bluetooth_proxy:
  36. # active: true
  37. external_components:
  38. - source: github://myhomeiot/esphome-components
  39. ble_gateway:
  40. id: blegateway
  41. on_ble_advertise:
  42. then:
  43. homeassistant.event:
  44. event: esphome.on_ble_advertise
  45. data:
  46. packet: !lambda return packet;
  47. # gateway_id: ${device_id}
  48. binary_sensor:
  49. - platform: homeassistant
  50. id: ble_gateway_discovery
  51. entity_id: binary_sensor.ble_gateway
  52. attribute: discovery
  53. on_state:
  54. then:
  55. lambda: id(blegateway).set_discovery(x);
  56. text_sensor:
  57. - platform: homeassistant
  58. id: ble_gateway_devices
  59. entity_id: binary_sensor.ble_gateway
  60. attribute: devices
  61. on_value:
  62. then:
  63. lambda: id(blegateway).set_devices(x);
  64. switch:
  65. - platform: template
  66. id: switch_ble_gateway_discovery
  67. name: BLE Gateway Discovery
  68. icon: mdi:bluetooth-connect
  69. lambda: return id(blegateway).get_discovery();
  70. turn_on_action: [lambda: id(blegateway).set_discovery(true);]
  71. turn_off_action: [lambda: id(blegateway).set_discovery(false);]
  72. disabled_by_default: true
  73. entity_category: config
  74. button:
  75. - platform: safe_mode
  76. name: Safe Mode Boot
  77. entity_category: diagnostic