-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb48dc.example.yaml
More file actions
154 lines (136 loc) · 4.23 KB
/
Copy pathb48dc.example.yaml
File metadata and controls
154 lines (136 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
esphome:
name: espington
platformio_options:
build_flags:
- -fexceptions
- -std=c++17
- -DESP_PLATFORM
build_unflags: -fno-exceptions
# PUT THE CSV FILE FROM THE REPO NEXT TO THE ESPHome device YAML config FILE AND IT SHOULD WORK.
board_build.partitions: "/config/esphome/b48_partitions.csv"
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Use if mDNS is not working for you...
#use_address: 10.48.2.126
ota:
- platform: esphome
password: !secret ota_password
# Web server is required for the B48 web UI
web_server:
port: 80
api:
encryption:
key: !secret ota_key
services:
# Service to add a message to the display with simple duration-based classification
- service: add_display_message
variables:
priority: int
duration: int
tarif_zone: int
line_number: int
intro_text: string
message_text: string
hint_text: string
then:
- lambda: |-
ESP_LOGI("ha_service", "Adding message: text='%s', priority=%d, line=%d, zone=%d, duration=%d",
message_text.c_str(), priority, line_number, tarif_zone, duration);
// Simplified call to the unified add_message method
// The controller handles persistence/expiry based on duration internally.
// duration <= 0: permanent message (never expires)
// 0 < duration < 600: ephemeral message (displayed briefly, not stored in DB)
// duration >= 600: regular message with expiration
id(display_controller).add_message(
priority, line_number, tarif_zone,
intro_text, message_text, hint_text,
duration, // Pass duration directly
"HomeAssistant" // source_info
);
# Define services directly in the b48_display_controller component
logger:
level: DEBUG # Change to DEBUG to get more detailed logs
# Add time synchronization
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Prague
on_time_sync:
then:
- logger.log: "Time synchronized with Home Assistant"
- platform: sntp
id: sntp_time
timezone: Europe/Prague
servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
- 2.pool.ntp.org
on_time_sync:
then:
- logger.log: "Time synchronized with SNTP"
uart:
id: uart_bus
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 1200
data_bits: 7
parity: EVEN
stop_bits: 2
external_components:
- source:
type: git
url: https://github.com/Thebys/b48_display_controller.git
components: [b48_display_controller]
# Add your display controller component
b48_display_controller:
id: display_controller
uart_id: uart_bus
database_path: "/littlefs/messages.db"
transition_duration: 4
time_sync_interval: 60
emergency_priority_threshold: 95
run_tests_on_startup: false # Set to true to run display tests on boot
wipe_database_on_boot: false
display_enable_pin: 5 # Optional: GPIO pin to enable display power
purge_interval_hours: 24 # Purge disabled messages from database every 24 hours
message_queue_size_sensor: message_queue_size
# Web UI for CRUD administration of messages (requires web_server component)
web_ui:
enabled: true # Access at http://<device-ip>/b48/
sensor:
- platform: uptime
name: "Espington Uptime"
# Add message queue size sensor
- platform: template
name: "Espington Message Queue Size"
id: message_queue_size
accuracy_decimals: 0
unit_of_measurement: "messages"
state_class: "measurement"
# Add Text entities to display the controller status
text_sensor:
- platform: template
name: "Last Message"
id: last_message
button:
- platform: restart
name: "Espington Restart"
id: restart_button
- platform: template
name: "Dump Database"
id: dump_database_button
on_press:
- lambda: |-
id(display_controller).dump_database_for_diagnostics();
- platform: template
name: "Refresh Display Cache"
id: refresh_cache_button
on_press:
- lambda: |-
id(display_controller).trigger_cache_refresh();