Help with packages: override
First, I can’t find this in the docs. I know they are there, but I can’t find it again.
I use a couple of packages that contain code common to most of my ESPHome devices. It reduces 60 lines to two. It makes the YAML file very clean.
Below is an example of how I use it:
#kim-bedroom-light.yaml
#Sonoff Basic Module
substitutions:
device_name: kim-bedroom-light
friendly_name: kim_bedroom_light
packages:
wifi: !include common/wifi.yaml
device_base: !include common/esp8266.yaml
#Override the default board type.
esp8266:
board: esp01_1m #Sonoff Basic and Mini
As shown, I can override the board type by setting it in the device YAML file. (Yes, I know that esp01_m
is redundant, but this is an example).
Here for reference is my common/esp8266.yaml file:
esphome:
name: ${device_name}
project:
name: steve.${project_name}
version: ${project_version}
esp8266:
board: esp01_1m
framework:
version: recommended
# Logger level "debug" is needed to get 1-Wire addresses, like the ds18b20.
logger:
level: DEBUG
# Set the log level for the light component to info
logs:
light: info
ota:
safe_mode: True
# Enable Home Assistant API
api:
Now, here’s my question…
Here is my wifi-Static.yaml file:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.211
gateway: 192.168.1.1
subnet: 255.255.255.0
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi Level
id: ${friendly_name}_WiFi_level
update_interval: 300s
# Get the WiFi details
text_sensor:
- platform: wifi_info
ip_address:
name: ${friendly_name} IP
ssid:
name: ${friendly_name} SSID
mac_address:
name: ${friendly_name} Mac Address
# to remove the Web Server, Add this line: "web_server: !remove" to the device YAML file.
web_server:
port: 80
I want to override static_ip: 192.168.1.211
Can anyone help me with the syntax?