On MacOS:
brew install esphome
esphome run ht_station.yaml
Then go to Home Assistant: the device is automatically discovered.
substitutions: | |
device_name: "H&T Station" | |
amin_password: "changeMe" | |
dallas_hub_1_pin: GPIO22 | |
dallas_hub_2_pin: GPIO23 | |
esphome: | |
name: ht_station | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# https://esphome.io/components/logger.html | |
logger: | |
level: INFO | |
# https://esphome.io/components/api.html | |
api: | |
encryption: | |
key: 2YXk4wWO4ynjvuqTaawCxiOKSVOvvLnDj977unQeCBs= | |
# https://esphome.io/components/ota.html | |
ota: | |
password: ${amin_password} | |
# https://esphome.io/components/wifi.html | |
wifi: | |
ssid: "IoT" | |
password: "" | |
manual_ip: | |
static_ip: 192.168.125.89 | |
gateway: 192.168.125.1 | |
subnet: 255.255.255.0 | |
dns1: 192.168.125.1 | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "${device_name}" | |
password: ${amin_password} | |
# https://esphome.io/components/captive_portal.html | |
captive_portal: | |
# https://esphome.io/components/web_server.html | |
web_server: | |
local: true | |
port: 80 | |
auth: | |
username: "admin" | |
password: ${amin_password} | |
# https://esphome.io/components/time.html | |
# https://esphome.io/components/time/homeassistant.html | |
time: | |
- platform: homeassistant | |
timezone: "Europe/Paris" | |
id: homeassistant_time | |
# https://esphome.io/components/binary_sensor/status.html | |
binary_sensor: | |
- platform: status | |
name: "${device_name} Status" | |
# https://esphome.io/components/button/restart.html | |
button: | |
- platform: restart | |
name: "${device_name} Restart" | |
# https://esphome.io/components/sensor/dallas.html | |
# Note: when having just a few sensors, it is easier to use one hub per | |
# sensor in order to avoid going through the address search mechanism | |
dallas: | |
- id: dallas_hub_1 | |
pin: ${dallas_hub_1_pin} | |
update_interval: 10s | |
- id: dallas_hub_2 | |
pin: ${dallas_hub_2_pin} | |
update_interval: 10s | |
sensor: | |
# WiFi | |
- platform: wifi_signal | |
name: "${device_name} WiFi Signal" | |
unit_of_measurement: dB | |
device_class: signal_strength | |
accuracy_decimals: 0 | |
update_interval: 10s | |
# Uptime | |
- platform: uptime | |
name: "${device_name} Uptime" | |
unit_of_measurement: s | |
device_class: duration | |
accuracy_decimals: 0 | |
update_interval: 5s | |
# Dallas | |
- platform: dallas | |
dallas_id: dallas_hub_1 | |
index: 0 | |
name: "${device_name} Temperature 1" | |
- platform: dallas | |
dallas_id: dallas_hub_2 | |
index: 0 | |
name: "${device_name} Temperature 2" | |
text_sensor: | |
- platform: wifi_info | |
ip_address: | |
name: "${device_name} IP Address" | |
mac_address: | |
name: "${device_name} Mac Address" | |
ssid: | |
name: "${device_name} Wifi SSID" | |
bssid: | |
name: "${device_name} Wifi BSSID" |