############################################# # Common ############################################# substitutions: devicename: esp-attobat nice_devicename: "Atto Battery Monitor" ############################################# # ESPHome ############################################# esphome: name: $devicename ######################################## # Specific board for ESPHome device ######################################## esp8266: board: d1_mini ############################################# # ESPHome Logging Enable ############################################# logger: ######################################## # Enable the Home Assistant API ######################################## api: encryption: key: !secret esp-attobat_api_key ######################################## # Enable Over the Air Update Capability # Safe mode will detect boot loops ######################################## ota: safe_mode: true password: !secret esp-attobat_ota_pass ######################################## # Use Wifi # (credentials are in secrets file) ######################################## wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Details for fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Esp-attobat2 Fallback Hotspot" password: !secret fallback_ap_password # Static IP (for lower power/quicker on time) manual_ip: static_ip: !secret esp-attobat_static_ip gateway: !secret esp-attobat_gateway subnet: !secret esp-attobat_subnet ############################################# # Fallback captive portal ############################################# captive_portal: ######################################## # Web Portal for display and monitoring ######################################## web_server: port: 80 auth: username: !secret web_server_username password: !secret web_server_password ######################################## # MQTT Monitoring ######################################## mqtt: broker: !secret mqtt_server topic_prefix: esphome/esp-attobat username: !secret mqtt_username password: !secret mqtt_password # # Availability Topic #birth_message: # topic: esphome/esp-leafbat2/availability # payload: online #will_message: # topic: esphome/esp-leafbat2/availability # payload: offline # A way to prevent deep sleep using MQTT command on_message: - topic: viewroad-commands/attobat/deepsleepoff payload: 'ON' then: - deep_sleep.prevent: deep_sleep_1 - topic: viewroad-commands/attobat/deepsleepon payload: 'ON' then: - deep_sleep.enter: deep_sleep_1 ######################################## # Deep Sleep ######################################## deep_sleep: run_duration: 20s sleep_duration: 5min id: deep_sleep_1 ############################################# ############################################# # MAIN SENSORS ############################################# ############################################# sensor: # Quality of Wifi in dBm - platform: wifi_signal name: "WiFi Signal" update_interval: 10s retain: true # Analog sensor for voltage reading (A0) - platform: adc pin: A0 name: "Battery Voltage" update_interval: 10s retain: true filters: #- multiply: 18.52 # trial and error calc/measure - calibrate_linear: - 0.41 -> 6.00 - 0.48 -> 7.00 - 0.54 -> 8.00 - 0.61 -> 9.00 - 0.68 -> 10.00 - 0.75 -> 11.00 - 0.81 -> 12.00 - 0.88 -> 13.00 - 0.94 -> 13.99 - 0.99 -> 14.70