From 9d4acb2fe5ef1dbf8d1ee1fbd562a4e545fb2e0e Mon Sep 17 00:00:00 2001 From: kev Date: Wed, 3 Jan 2024 18:42:13 +0800 Subject: [PATCH] update esphome --- esphome/README.md | 20 +++++++++++++++++++ esphome/data/ibeacon.yaml | 40 ++++++++++++++++++++++++++++++++++++++ esphome/data/secrets.yaml | 6 ++++++ esphome/docker-compose.yml | 8 +++++++- zigbee2mqtt/README.md | 2 +- 5 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 esphome/data/ibeacon.yaml create mode 100644 esphome/data/secrets.yaml diff --git a/esphome/README.md b/esphome/README.md index 517d883..97151b7 100644 --- a/esphome/README.md +++ b/esphome/README.md @@ -11,4 +11,24 @@ $ docker-compose up -d $ curl http://127.0.0.1:6052 ``` +## flashing new device + +```bash +$ udevadm info -q property -n /dev/ttyACM0 --property=ID_SERIAL +$ docker compose exec esphome bash +>>> cd /config +>>> esphome ibeacon.yaml run +====== [SUCCESS] Took 253.61 seconds ====== +INFO Successfully compiled program. +Found multiple options for uploading, please choose one: + [1] /dev/ttyACM0 (USB JTAG/serial debug unit) + [2] Over The Air (esphome-esp32c3-ibeacon.local) +(number): 1 +INFO Successfully uploaded program. +INFO Starting log output from /dev/ttyACM0 with baud rate 115200 +^C +>>> ping esphome-esp32c3-ibeacon.lan +>>> exit +``` + [1]: https://esphome.io/ diff --git a/esphome/data/ibeacon.yaml b/esphome/data/ibeacon.yaml new file mode 100644 index 0000000..f8be5ea --- /dev/null +++ b/esphome/data/ibeacon.yaml @@ -0,0 +1,40 @@ +# +# See: +# - https://esphome.io/components/esp32.html +# - https://esphome.io/components/esp32_ble_beacon.html +# - https://registry.platformio.org/platforms/platformio/espressif32/boards +# + +esphome: + name: esphome-esp32c3-ibeacon + platform: esp32 + board: dfrobot_beetle_esp32c3 + +logger: + +api: + password: !secret api_password + +ota: + password: !secret ota_password + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + domain: .lan + +mqtt: + broker: broker.hivemq.com + port: 1883 + #username: !secret mqtt_username + #password: !secret mqtt_password + +esp32_ble_beacon: + type: iBeacon + uuid: "00000000-0000-0000-0000-000000000000" + major: 11111 + minor: 22222 + min_interval: 100ms + max_interval: 100ms + measured_power: -59 + tx_power: 3 diff --git a/esphome/data/secrets.yaml b/esphome/data/secrets.yaml new file mode 100644 index 0000000..be96270 --- /dev/null +++ b/esphome/data/secrets.yaml @@ -0,0 +1,6 @@ +api_password: secret +ota_password: secret +wifi_ssid: OpenWrt +wifi_password: secret +mqtt_username: esphome +mqtt_password: secret diff --git a/esphome/docker-compose.yml b/esphome/docker-compose.yml index bcbb491..e3d9e1f 100644 --- a/esphome/docker-compose.yml +++ b/esphome/docker-compose.yml @@ -1,9 +1,15 @@ version: "3.8" services: esphome: - image: esphome/esphome + image: esphome/esphome:stable ports: - "6052:6052" volumes: - ./data:/config + environment: + - ESPHOME_DASHBOARD_USE_PING=true + ### FOR THE FIRST-TIME ONLY ### + #devices: # + # - /dev/ttyACM0 # + ############################### restart: unless-stopped diff --git a/zigbee2mqtt/README.md b/zigbee2mqtt/README.md index 61c7c3c..6cc47d6 100644 --- a/zigbee2mqtt/README.md +++ b/zigbee2mqtt/README.md @@ -20,7 +20,7 @@ chmod +x cc2538-bsl.py ./cc2538-bsl.py --help ls /dev/ttyUSB* -udevadm info -q property -n /dev/ttyUSB0 --property=ID_MODEL +udevadm info -q property -n /dev/ttyUSB0 --property=ID_SERIAL ./cc2538-bsl.py --bootloader-sonoff-usb -p /dev/ttyUSB0 -evw CC1352P2_CC2652P_launchpad_coordinator_20230507.hex ```