From 85ba705e1bb14dccf0b015160e8ad9c56549cd42 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 3 Jan 2024 21:15:15 +0800 Subject: [PATCH] update --- esphome/README.md | 14 +++++++++++++- esphome/data/ibeacon.yaml | 8 ++++++++ esphome/docker-compose.yml | 7 +++++++ hass/arm/ibeacon.service | 11 ++++++----- hass/arm/ibeacon.timer | 9 +++++++++ 5 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 hass/arm/ibeacon.timer diff --git a/esphome/README.md b/esphome/README.md index 97151b7..d9f23f4 100644 --- a/esphome/README.md +++ b/esphome/README.md @@ -17,18 +17,30 @@ $ curl http://127.0.0.1:6052 $ udevadm info -q property -n /dev/ttyACM0 --property=ID_SERIAL $ docker compose exec esphome bash >>> cd /config ->>> esphome ibeacon.yaml run +>>> esphome run ibeacon.yaml ====== [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 +Dependency Graph +|-- AsyncTCP-esphome @ 2.0.1 +|-- WiFi @ 2.0.0 +|-- FS @ 2.0.0 +|-- Update @ 2.0.0 +|-- ESPAsyncWebServer-esphome @ 3.1.0 +|-- DNSServer @ 2.0.0 +|-- ESPmDNS @ 2.0.0 +|-- ArduinoJson @ 6.18.5 +|-- NeoPixelBus @ 2.7.3 INFO Successfully uploaded program. INFO Starting log output from /dev/ttyACM0 with baud rate 115200 ^C >>> ping esphome-esp32c3-ibeacon.lan >>> exit +$ curl http://esphome-esp32c3-ibeacon.lan/ +$ curl -X POST 'http://esphome-esp32c3-ibeacon.lan/light/neopixel_light/turn_on?brightness=255&r=255&g=192&b=203&white_value=0&effect=None' ``` [1]: https://esphome.io/ diff --git a/esphome/data/ibeacon.yaml b/esphome/data/ibeacon.yaml index f8be5ea..90bd8c1 100644 --- a/esphome/data/ibeacon.yaml +++ b/esphome/data/ibeacon.yaml @@ -22,6 +22,14 @@ wifi: ssid: !secret wifi_ssid password: !secret wifi_password domain: .lan + ap: + ssid: "ESPHome" + password: "configesp" + +captive_portal: + +web_server: + port: 80 mqtt: broker: broker.hivemq.com diff --git a/esphome/docker-compose.yml b/esphome/docker-compose.yml index e3d9e1f..37e988c 100644 --- a/esphome/docker-compose.yml +++ b/esphome/docker-compose.yml @@ -1,3 +1,7 @@ +# +# See: https://esphome.io/guides/getting_started_command_line.html +# + version: "3.8" services: esphome: @@ -6,7 +10,10 @@ services: - "6052:6052" volumes: - ./data:/config + - /etc/localtime:/etc/localtime:ro environment: + - USERNAME=admin + - PASSWORD=admin - ESPHOME_DASHBOARD_USE_PING=true ### FOR THE FIRST-TIME ONLY ### #devices: # diff --git a/hass/arm/ibeacon.service b/hass/arm/ibeacon.service index b78abcf..a80599d 100644 --- a/hass/arm/ibeacon.service +++ b/hass/arm/ibeacon.service @@ -19,11 +19,12 @@ ExecStart=/bin/hciconfig hci0 noscan ExecStart=/usr/bin/hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 $UUID $MAJOR $MINOR $POWER 00 ExecStart=/usr/bin/hcitool -i hci0 cmd 0x08 0x0006 $MIN_INTERVAL $MAX_INTERVAL $ADV_MODE 00 00 00 00 00 00 00 00 07 00 ExecStart=/usr/bin/hcitool -i hci0 cmd 0x08 0x000a 01 + # See: http://stackoverflow.com/questions/21124993/ # ExecStart=/bin/hciconfig hci0 leadv 3 # IT WILL OVERWRITE ADV RATE -ExecStop=/bin/hciconfig hci0 noleadv -ExecStop=/bin/hciconfig hci0 reset -RemainAfterExit=yes +#ExecStop=/bin/hciconfig hci0 noleadv +#ExecStop=/bin/hciconfig hci0 reset +#RemainAfterExit=yes -[Install] -WantedBy=multi-user.target +#[Install] +#WantedBy=multi-user.target diff --git a/hass/arm/ibeacon.timer b/hass/arm/ibeacon.timer new file mode 100644 index 0000000..bc563eb --- /dev/null +++ b/hass/arm/ibeacon.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Hourly restart ibeacon + +[Timer] +OnCalendar=hourly +Persistent=true + +[Install] +WantedBy=timers.target