140 lines
2.4 KiB
YAML
140 lines
2.4 KiB
YAML
substitutions:
|
|
esp_name: "esp8266-p1-meter"
|
|
|
|
esphome:
|
|
name: ${esp_name}
|
|
comment: ${esp_name}
|
|
|
|
esp8266:
|
|
board: esp01_1m
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: !secret esp_P1_api
|
|
|
|
ota:
|
|
password: !secret esp_P1_ota
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: ${esp_name} fallback
|
|
password: !secret fallback_password
|
|
|
|
captive_portal:
|
|
|
|
font:
|
|
- file: 'fonts/GothamRnd-Book.ttf'
|
|
id: font5
|
|
size: 18
|
|
- file: 'fonts/GothamRnd-Bold.ttf'
|
|
id: font_time
|
|
size: 30
|
|
glyphs: [' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':']
|
|
|
|
# uart:
|
|
# rx_pin: GPIO13
|
|
# baud_rate: 115200
|
|
# rx_buffer_size: 1700
|
|
|
|
status_led:
|
|
pin:
|
|
number: GPIO2
|
|
inverted: true
|
|
|
|
# dsmr:
|
|
|
|
# sensor:
|
|
# - platform: dsmr
|
|
# energy_delivered_tariff1:
|
|
# name: Energy Consumed Tariff 1
|
|
|
|
# text_sensor:
|
|
# - platform: dsmr
|
|
# identification:
|
|
# name: "DSMR Identification"
|
|
# p1_version:
|
|
# name: "DSMR Version"
|
|
|
|
output:
|
|
- platform: gpio
|
|
pin: GPIO4
|
|
id: lcdbacklight
|
|
|
|
switch:
|
|
- platform: output
|
|
name: "LCD LED"
|
|
output: lcdbacklight
|
|
id: switch_lcdbacklight
|
|
|
|
spi:
|
|
clk_pin: GPIO14
|
|
mosi_pin: GPIO13
|
|
|
|
time:
|
|
- platform: homeassistant
|
|
id: esptime
|
|
|
|
display:
|
|
- platform: st7735
|
|
model: INITR_MINI160X80
|
|
reset_pin: GPIO16
|
|
cs_pin: GPIO5
|
|
dc_pin: GPIO15
|
|
rotation: 270
|
|
device_width: 82
|
|
device_height: 161
|
|
col_start: 0
|
|
row_start: 0
|
|
eight_bit_color: true
|
|
update_interval: 5s
|
|
lambda: |-
|
|
//it.rectangle(0, 2, 160, 80, id(my_red));
|
|
it.strftime(2, 2, id(font_time), TextAlign::BASELINE_RIGHT, "%H:%M", id(esptime).now());
|
|
// this line = the text is centered 80 pixels in from left and 59 pixels down
|
|
|
|
|
|
color:
|
|
- id: my_red
|
|
red: 100%
|
|
green: 100%
|
|
blue: 0%
|
|
- id: my_yellow
|
|
red: 100%
|
|
green: 0%
|
|
blue: 0%
|
|
- id: my_green
|
|
red: 100%
|
|
green: 0%
|
|
blue: 100%
|
|
- id: my_blue
|
|
red: 0%
|
|
green: 100%
|
|
blue: 100%
|
|
- id: my_cyan
|
|
red: 0%
|
|
green: 0%
|
|
blue: 100%
|
|
- id: my_magenta
|
|
red: 0%
|
|
green: 100%
|
|
blue: 0%
|
|
- id: my_white
|
|
red: 0%
|
|
green: 0%
|
|
blue: 0%
|
|
- id: my_gray
|
|
red: 50%
|
|
green: 50%
|
|
blue: 50%
|
|
- id: my_black
|
|
red: 100%
|
|
green: 100%
|
|
blue: 100% |