esphome device updates
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
##########################################################################################
|
||||
##########################################################################################
|
||||
# BYD ATTO3 12V Battery Monitor
|
||||
# Monitoring the status of a vehicle 12V battery with
|
||||
# an esp8266 (D1 Mini). It will obviously only
|
||||
# transmit when the vehicle is within wifi range.
|
||||
# Voltage is measured with a resistor voltage divider
|
||||
# into the analogue GPIO on the esp8266.
|
||||
# https://zorruno.com/2022/vehicle-12v-battery-monitoring/
|
||||
##########################################################################################
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
|
||||
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
|
||||
##########################################################################################
|
||||
substitutions:
|
||||
# Device Naming
|
||||
device_name: "esp-attobattery"
|
||||
friendly_name: "Atto3 12V Battery Monitor"
|
||||
description_comment: "Atto3 12V Battery Monitor (when home)"
|
||||
device_area: "Garage" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
|
||||
|
||||
# Project Naming
|
||||
project_name: "Generic ESP8266.D1 Mini" # Project Details
|
||||
project_version: "v1.0" # Project V denotes release of yaml file, allowing checking of deployed vs latest version
|
||||
|
||||
# Passwords & Secrets
|
||||
api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names
|
||||
ota_pass: !secret esp-ota_pass # unfortunately you can't use substitutions inside secrets names
|
||||
static_ip_address: !secret esp-attobattery_ip
|
||||
mqtt_command_main_topic: !secret mqtt_command_main_topic
|
||||
mqtt_status_main_topic: !secret mqtt_status_main_topic
|
||||
|
||||
# MQTT LOCAL Controls
|
||||
mqtt_device_name: "atto-battery"
|
||||
mqtt_local_command_topic: "${mqtt_command_main_topic}/${mqtt_device_name}" # Topic we will use to command this locally without HA
|
||||
mqtt_local_status_topic: "${mqtt_status_main_topic}/${mqtt_device_name}" # Topic we will use to view status locally without HA
|
||||
|
||||
# Device Settings
|
||||
#relay_icon: "mdi:lightbulb-group"
|
||||
log_level: "DEBUG" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
|
||||
update_interval: "60s" # update time for for general sensors etc
|
||||
|
||||
##########################################################################################
|
||||
# ESPHome
|
||||
# https://esphome.io/components/esphome.html
|
||||
##########################################################################################
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
friendly_name: ${friendly_name}
|
||||
comment: ${description_comment} #appears on the esphome page in HA
|
||||
min_version: 2024.6.0
|
||||
|
||||
##########################################################################################
|
||||
# ESP Platform and Framework
|
||||
# https://esphome.io/components/esp8266.html
|
||||
# https://esphome.io/components/esp32.html
|
||||
##########################################################################################
|
||||
esp8266:
|
||||
board: d1_mini
|
||||
framework:
|
||||
version: latest #recommended, latest or dev
|
||||
|
||||
##########################################################################################
|
||||
# ESPHome Logging Enable
|
||||
# https://esphome.io/components/logger.html
|
||||
##########################################################################################
|
||||
logger:
|
||||
level: "${log_level}" #INFO Level suggested, or DEBUG for testing
|
||||
#baud_rate: 0 #set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM)
|
||||
#esp8266_store_log_strings_in_flash: false
|
||||
#tx_buffer_size: 64
|
||||
|
||||
#############################################
|
||||
# Enable Over the Air Update Capability
|
||||
# https://esphome.io/components/ota.html?highlight=ota
|
||||
#############################################
|
||||
ota:
|
||||
- platform: web_server # Uncomment if you want to be able to do OTA with the web interface
|
||||
|
||||
##########################################################################################
|
||||
# PACKAGES: Included Common Packages
|
||||
# https://esphome.io/components/packages.html
|
||||
##########################################################################################
|
||||
packages:
|
||||
common_wifi: !include
|
||||
file: common/network_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
local_static_ip_address: "${static_ip_address}"
|
||||
local_ota_pass: "${ota_pass}"
|
||||
common_api: !include
|
||||
#file: common/api_common_noencryption.yaml
|
||||
file: common/api_common.yaml
|
||||
vars:
|
||||
local_api_key: "${api_key}"
|
||||
common_webportal: !include
|
||||
file: common/webportal_common.yaml
|
||||
common_mqtt: !include
|
||||
file: common/mqtt_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
#common_sntp: !include
|
||||
# file: common/sntp_common.yaml
|
||||
common_general_sensors: !include
|
||||
file: common/sensors_common_lite.yaml
|
||||
#file: common/sensors_common.yaml
|
||||
vars:
|
||||
local_friendly_name: "${friendly_name}"
|
||||
local_update_interval: "${update_interval}"
|
||||
|
||||
##########################################################################################
|
||||
# MQTT COMMANDS
|
||||
# This adds device-specific MQTT command triggers to the common MQTT configuration.
|
||||
##########################################################################################
|
||||
mqtt:
|
||||
|
||||
# Availability Topic
|
||||
birth_message:
|
||||
topic: ${mqtt_local_status_topic}/availability
|
||||
payload: online
|
||||
will_message:
|
||||
topic: ${mqtt_local_status_topic}/availability
|
||||
payload: offline
|
||||
|
||||
# A way to prevent deep sleep using MQTT command
|
||||
on_message:
|
||||
- topic: ${mqtt_local_command_topic}/deepsleep
|
||||
payload: "OFF"
|
||||
then:
|
||||
- deep_sleep.prevent: deep_sleep_1
|
||||
- topic: ${mqtt_local_command_topic}/deepsleep
|
||||
payload: "ON"
|
||||
then:
|
||||
- deep_sleep.enter: deep_sleep_1
|
||||
|
||||
##########################################################################################
|
||||
# Deep Sleep
|
||||
# https://esphome.io/components/deep_sleep.html
|
||||
##########################################################################################
|
||||
deep_sleep:
|
||||
run_duration: 20s
|
||||
sleep_duration: 5min
|
||||
id: deep_sleep_1
|
||||
|
||||
##########################################################################################
|
||||
# SENSOR COMPONENT
|
||||
# https://esphome.io/components/sensor/
|
||||
##########################################################################################
|
||||
sensor:
|
||||
#Quality of Wifi in dBm
|
||||
- platform: wifi_signal
|
||||
name: "WiFi Signal"
|
||||
update_interval: ${update_interval}
|
||||
retain: true #Retain this as you'll have no value between sleeps otherwise
|
||||
#Analog sensor for voltage reading (A0)
|
||||
- platform: uptime
|
||||
name: "Uptime"
|
||||
update_interval: ${update_interval}
|
||||
retain: true #Retain this as you'll have no value between sleeps otherwise
|
||||
- platform: adc
|
||||
pin: A0
|
||||
name: "Battery Voltage"
|
||||
update_interval: ${update_interval}
|
||||
retain: true #Retain this as you'll have no value between sleeps otherwise
|
||||
filters:
|
||||
- multiply: 3.3 #D1 mini V divider, 3.3V -> 1V on esp8266
|
||||
- calibrate_linear: #Read values with voltmeter and bench supply
|
||||
- 3.11 -> 14.00
|
||||
- 3.00 -> 13.50
|
||||
- 2.89 -> 13.00
|
||||
- 2.77 -> 12.50
|
||||
- 2.67 -> 12.00
|
||||
- 2.55 -> 11.50
|
||||
- 2.45 -> 11.00
|
||||
- 2.34 -> 10.50
|
||||
- 2.22 -> 10.00
|
||||
- 2.11 -> 09.50
|
||||
- 2.00 -> 09.00
|
||||
Reference in New Issue
Block a user