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:
- 'package/3bar_1display.yaml'
ref: main
globals:
- id: !extend nr_of_pages
initial_value: '1'
- id: !extend page_names
initial_value: '{"Start"}'
vars:
nr_of_pages: '1'
page_names: '{"Start"}'
font:
- 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
mosi_pin: GPIO5
substituions:
nr_of_pages: 1
page_names: '{"Page 1"}'
globals:
- id: nr_of_pages
type: int
initial_value: '1'
initial_value: '${nr_of_pages}'
- id: actual_page
type: int
initial_value: '0'
- id: page_names
type: std::vector<std::string>
initial_value: '{"Page 1"}'
initial_value: ${page_names}
- id: active_page_name
type: std::string
initial_value: ""
@@ -69,24 +73,37 @@ sensor:
address: 0x4A
id: buttonplus_temperature
i2c_id: sensors
name: "Button+ Temperature"
name: "Temperature"
update_interval: 10s
unit_of_measurement: "°C"
icon: "mdi:thermometer"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
- platform: ltr_als_ps
address: 0x29
id: buttonplus_ambientlight
i2c_id: sensors
ambient_light: "Button+ Ambient Light"
update_interval: 10s
type: ALS # or ALS or PS
type: ALS
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
name: "Active Page ID"
icon: "mdi:order-numeric-ascending"
id: active_page_id_ha
update_interval: never
text_sensor:
- platform: template
name: "Active Page Name"
icon: "mdi:order-alphabetical-ascending"
id: active_page_name_ha
update_interval: never
@@ -106,7 +123,7 @@ light:
- platform: monochromatic
output: displays_mini_backlight_pwm
gamma_correct : 2.2
name: "Mini Display Backlight"
name: "Bars Display Backlight"
id: displays_mini_backlight
restore_mode: ALWAYS_ON
@@ -121,8 +138,8 @@ number:
name: "Menu Selector"
id: menuselector
optimistic: true
min_value: 0 # keep at 0
max_value: 10 # TODO replace page numbers with substitution
min_value: 0
max_value: ${nr_of_pages}
step: 1
on_value:
then:
@@ -132,8 +149,6 @@ number:
} else {
id(actual_page) = id(menuselector).state;
}
# # Refresh the screen
# - script.execute: update_page <<< this ends in an loop...
script:
######################