107 lines
2.6 KiB
YAML
107 lines
2.6 KiB
YAML
---
|
|
|
|
substitutions:
|
|
pin_ssd1306_i2c_sda: GPIO33
|
|
pin_ssd1306_i2c_scl: GPIO35
|
|
frequency_ssd1306_i2c: 50000Hz
|
|
ssd1306_flip_x: "true"
|
|
ssd1306_flip_y: "true"
|
|
ssd1306_rotation: "0"
|
|
|
|
#packages:
|
|
# fonts: !include ../fonts.yaml
|
|
|
|
logger:
|
|
logs:
|
|
# ignore this:
|
|
# [W][component:214]: Component ssd1306_base took a long time for an operation (0.27 s).
|
|
# [W][component:215]: Components should block for at most 20-30ms.
|
|
component: ERROR
|
|
|
|
switch:
|
|
- platform: template
|
|
name: "${hostname} Display"
|
|
id: ssd1306_switch_display
|
|
optimistic: true
|
|
restore_mode: ALWAYS_ON
|
|
internal: false
|
|
disabled_by_default: false
|
|
#entity_category: "config"
|
|
|
|
i2c:
|
|
- sda: ${pin_ssd1306_i2c_sda}
|
|
scl: ${pin_ssd1306_i2c_scl}
|
|
frequency: ${frequency_ssd1306_i2c}
|
|
id: i2c_ssd1306
|
|
|
|
font:
|
|
- file: "../fonts/pixelmix.ttf"
|
|
id: pixelmix6
|
|
size: 6
|
|
- file: "../fonts/pixelmix.ttf"
|
|
id: pixelmix24
|
|
size: 24
|
|
|
|
- file: "../fonts/NotoSansMono-Regular.ttf"
|
|
id: notomono8
|
|
size: 8
|
|
|
|
- file: "../fonts/NotoSansMono-Regular.ttf"
|
|
id: notomono16
|
|
size: 16
|
|
|
|
- file: "../fonts/NotoSansMono-Regular.ttf"
|
|
id: notomono24
|
|
size: 24
|
|
|
|
|
|
#number:
|
|
# - platform: template
|
|
# id: "ssd1306_contrast"
|
|
# name: "${hostname} Display contrast"
|
|
# initial_value: 1.0
|
|
# min_value: -1.0
|
|
# max_value: 1.0
|
|
# step: 0.1
|
|
# entity_category: ""
|
|
# unit_of_measurement: "%"
|
|
# device_class: power_factor
|
|
# internal: false
|
|
# disabled_by_default: false
|
|
# restore_value: true
|
|
# update_interval: never
|
|
# optimistic: true
|
|
# mode: box
|
|
|
|
|
|
# 0, 60
|
|
# it.printf(0, 60, id(notomono16), TextAlign::BASELINE_LEFT, "DESK");
|
|
# it.printf(127, 60, id(notomono16), TextAlign::BASELINE_RIGHT, "%.0f W", id(hass_electric_w_study).state);
|
|
|
|
display:
|
|
- platform: ssd1306_i2c
|
|
model: "SSD1306 128x64"
|
|
address: 0x3C
|
|
i2c_id: i2c_ssd1306
|
|
update_interval: 50ms
|
|
flip_x: ${ssd1306_flip_x}
|
|
flip_y: ${ssd1306_flip_y}
|
|
#contrast: !lambda |-
|
|
# auto contrast = parse_number<float>(id(ssd1306_contrast).state);
|
|
# return contrast.has_value() ? n.value() : NAN;
|
|
#contrast: !lambda 'return id(ssd1306_contrast).state'
|
|
#contrast: !lambda |-
|
|
# return parse_numer<float>(id(ssd1306_contrast).state);
|
|
#contrast: !lambda |-
|
|
# char buf[256];
|
|
# sprintf(buf, "%.0f\%", id(ssd1606_contrast).state);
|
|
# return buf;
|
|
#contrast: !lambda |-
|
|
# return id(ssd1306_contrast).state;
|
|
#contrast: !lambda 'return "75.0%";'
|
|
rotation: "${ssd1306_rotation}°"
|
|
lambda: |-
|
|
if (id(ssd1306_switch_display).state) {
|
|
${ssd1306_lambda}
|
|
}
|