Add substitutions and sensor info

This commit is contained in:
2026-05-11 12:29:04 +02:00
parent af054eea04
commit a8b0107c44
2 changed files with 29 additions and 17 deletions
@@ -37,12 +37,9 @@ packages:
files: files:
- 'package/3bar_1display.yaml' - 'package/3bar_1display.yaml'
ref: main ref: main
vars:
globals: nr_of_pages: '1'
- id: !extend nr_of_pages page_names: '{"Start"}'
initial_value: '1'
- id: !extend page_names
initial_value: '{"Start"}'
font: font:
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
+26 -11
View File
@@ -36,16 +36,20 @@ spi:
clk_pin: GPIO6 clk_pin: GPIO6
mosi_pin: GPIO5 mosi_pin: GPIO5
substituions:
nr_of_pages: 1
page_names: '{"Page 1"}'
globals: globals:
- id: nr_of_pages - id: nr_of_pages
type: int type: int
initial_value: '1' initial_value: '${nr_of_pages}'
- id: actual_page - id: actual_page
type: int type: int
initial_value: '0' initial_value: '0'
- id: page_names - id: page_names
type: std::vector<std::string> type: std::vector<std::string>
initial_value: '{"Page 1"}' initial_value: ${page_names}
- id: active_page_name - id: active_page_name
type: std::string type: std::string
initial_value: "" initial_value: ""
@@ -69,24 +73,37 @@ sensor:
address: 0x4A address: 0x4A
id: buttonplus_temperature id: buttonplus_temperature
i2c_id: sensors i2c_id: sensors
name: "Button+ Temperature" name: "Temperature"
update_interval: 10s update_interval: 10s
unit_of_measurement: "°C"
icon: "mdi:thermometer"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
- platform: ltr_als_ps - platform: ltr_als_ps
address: 0x29 address: 0x29
id: buttonplus_ambientlight
i2c_id: sensors i2c_id: sensors
ambient_light: "Button+ Ambient Light"
update_interval: 10s update_interval: 10s
type: ALS # or ALS or PS type: ALS
auto_mode: true auto_mode: true
ambient_light:
name: "Ambient Light"
id: buttonplus_ambientlight
unit_of_measurement: "lx"
icon: "mdi:brightness-percent"
device_class: "illuminance"
state_class: "measurement"
accuracy_decimals: 0
- platform: template - platform: template
name: "Active Page ID" name: "Active Page ID"
icon: "mdi:order-numeric-ascending"
id: active_page_id_ha id: active_page_id_ha
update_interval: never update_interval: never
text_sensor: text_sensor:
- platform: template - platform: template
name: "Active Page Name" name: "Active Page Name"
icon: "mdi:order-alphabetical-ascending"
id: active_page_name_ha id: active_page_name_ha
update_interval: never update_interval: never
@@ -106,7 +123,7 @@ light:
- platform: monochromatic - platform: monochromatic
output: displays_mini_backlight_pwm output: displays_mini_backlight_pwm
gamma_correct : 2.2 gamma_correct : 2.2
name: "Mini Display Backlight" name: "Bars Display Backlight"
id: displays_mini_backlight id: displays_mini_backlight
restore_mode: ALWAYS_ON restore_mode: ALWAYS_ON
@@ -121,8 +138,8 @@ number:
name: "Menu Selector" name: "Menu Selector"
id: menuselector id: menuselector
optimistic: true optimistic: true
min_value: 0 # keep at 0 min_value: 0
max_value: 10 # TODO replace page numbers with substitution max_value: ${nr_of_pages}
step: 1 step: 1
on_value: on_value:
then: then:
@@ -132,8 +149,6 @@ number:
} else { } else {
id(actual_page) = id(menuselector).state; id(actual_page) = id(menuselector).state;
} }
# # Refresh the screen
# - script.execute: update_page <<< this ends in an loop...
script: script:
###################### ######################