Seeing as I am building stuff daily and I have15 of the 4" units, one of which I have as a test unit - is there a way I could date/timestamp a build and use it in a label so that I know which unit has which version in it???
I think you could leverage the project version ESPHome Core Configuration — ESPHome
I think you’ll have to maintain the version yourself though.
Other than that you could try using a global text set to the date/time
Yeah just write a little bash script to put the build date and time in a file then include it in your code.
If you always update via OTA you could use an on_end:
trigger to set a datetime sensor to “now”?
Guess you’d need to check how updating sensors at that point will work and be restored.
- label:
text:
format: "%s %s"
args: [__DATE__, __TIME__]
2 Likes
That’s cool! I just added it to my LVGL boot screen.
# Boot Screen
widgets:
- obj:
id: boot_screen
layout:
type: flex
flex_flow: COLUMN_WRAP
height: ${screen_hight}px
width: ${screen_width}px
text_font: $text_font
scrollbar_mode: 'off'
bg_color: White
bg_opa: COVER
radius: 0
pad_all: 5
widgets:
- image:
src: boot_logo
antialias: true
pad_bottom: 10
- label:
text:
format: "ESPHome Version: %s"
args: [ 'id(esphome_version).state.c_str()' ]
- label:
text:
format: "Build Date: %s - %s"
args: [__DATE__, __TIME__]
- label:
id: connected_mac_label
text: "MAC Address: Not Connected"
- label:
id: ip_address_label
text: "IP Address: Not Connected"
- label:
id: connected_ssid_label
text: "Connected SSID: Not Connected"
- label:
id: wifi_signal_db_percent_label
text: "WiFi Strength: Not Connected"
- obj:
radius: 0
pad_all: 0
width: ${screen_width}px
flex_grow: 1
widgets:
- button:
align: bottom_right
x: -10
radius: 15
width: 100
height: 60
checkable: true
widgets:
- label:
text_color: White
align: center
text: "OK"
on_press:
- lvgl.widget.hide: boot_screen
1 Like
Thanks Clyde. This is PERFECT!