This commit is contained in:
Stefan Ostermann 2024-05-20 23:37:37 +02:00
commit ab74256757
4 changed files with 85 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
secrets.yaml

32
README.md Normal file
View File

@ -0,0 +1,32 @@
# Mobile Temp and Humidity Sensor with ESPHome
Use with a ESP8266, e.g. a D1 mini
## Secrets
Create secrets.yaml and store the wifi password:
wifi_password: "XXXX"
## Hardware
Sensor Pins, Front = grill
1=Vin (3.3-5V)
2=Data
3=Not used
4=GND
Connect Data to D2 and via 4,7 kOhm to Vin
## Flash
sudo docker run --rm --privileged -v "${PWD}":/config --device=/dev/ttyUSB0 -it ghcr.io/esphome/esphome run mobile-sensor.yaml
## HomeAssistant
Add integration "ESPHome", use IP of flashed device.
## Links
https://esphome.io/guides/getting_started_command_line

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: '3'
services:
esphome:
container_name: esphome
image: ghcr.io/esphome/esphome
volumes:
- ./config:/config
- /etc/localtime:/etc/localtime:ro
restart: always
privileged: true
network_mode: host
environment:
- USERNAME=test
- PASSWORD=ChangeMe

38
mobile-sensor.yaml Normal file
View File

@ -0,0 +1,38 @@
esphome:
name: temp
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "heim"
password: "0ggnWLS."
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Temp Fallback Hotspot"
# secrets.yml: wifi_password: "xxx"
password: !secret wifi_password
sensor:
- platform: dht
pin: D2
temperature:
name: "Mobile Sensor Temperature"
humidity:
name: "Mobile Sensor Humidity"
update_interval: 30s
captive_portal: