commit ab74256757e060c3537a3e3a127c55c4805abb22 Author: Stefan Ostermann Date: Mon May 20 23:37:37 2024 +0200 first diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..33a9299 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +secrets.yaml \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..05fbfcb --- /dev/null +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8e7da0c --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file diff --git a/mobile-sensor.yaml b/mobile-sensor.yaml new file mode 100644 index 0000000..85dcbec --- /dev/null +++ b/mobile-sensor.yaml @@ -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: + \ No newline at end of file