mirror of
https://github.com/esphome/esphome.git
synced 2026-10-04 10:09:13 +00:00
[snapshot][SDL] Display headless mode and snapshots (#17917)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
co-authored by
Claude Opus 5
Jesse Hills
parent
567f7f9196
commit
f0e2eb96bd
@@ -14,6 +14,15 @@ display:
|
||||
position:
|
||||
x: 100
|
||||
y: 100
|
||||
snapshot_key: SDLK_F12
|
||||
|
||||
- platform: sdl
|
||||
id: headless_display
|
||||
headless: true
|
||||
show_test_card: true
|
||||
dimensions:
|
||||
width: 320
|
||||
height: 240
|
||||
|
||||
- platform: sdl
|
||||
id: second_display
|
||||
@@ -46,3 +55,21 @@ binary_sensor:
|
||||
sdl_id: sdl_sdl_display
|
||||
id: key_enter
|
||||
key: SDLK_RETURN
|
||||
|
||||
esphome:
|
||||
# A name of your own is only good for one snapshot - a second one under the same name fails
|
||||
# rather than writing over the first - so these run once rather than on a repeating interval.
|
||||
on_boot:
|
||||
- delay: 2s
|
||||
- snapshot.take:
|
||||
id: headless_display
|
||||
filename: test_card.bmp
|
||||
- snapshot.take:
|
||||
id: headless_display
|
||||
filename: !lambda 'return "shot.bmp";'
|
||||
|
||||
interval:
|
||||
# A generated name has the time in it, so this one can repeat.
|
||||
- interval: 10s
|
||||
then:
|
||||
- snapshot.take: sdl_sdl_display
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# Config-only test for the headless and screenshot options. The combinations that must be
|
||||
# rejected are covered by tests/component_tests/sdl/test_sdl.py; this file checks that the
|
||||
# accepted forms validate together.
|
||||
host:
|
||||
mac_address: "62:23:45:AF:B3:DD"
|
||||
|
||||
display:
|
||||
- platform: sdl
|
||||
id: headless_display
|
||||
headless: true
|
||||
dimensions: 320x240
|
||||
|
||||
- platform: sdl
|
||||
id: windowed_display
|
||||
dimensions: 320x240
|
||||
snapshot_key: SDLK_F12
|
||||
|
||||
binary_sensor:
|
||||
- platform: sdl
|
||||
sdl_id: windowed_display
|
||||
id: key_up
|
||||
key: SDLK_UP
|
||||
|
||||
interval:
|
||||
- interval: 10s
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: headless_display
|
||||
filename: periodic.bmp
|
||||
@@ -0,0 +1,34 @@
|
||||
display:
|
||||
- platform: snapshot
|
||||
id: snapshot_display
|
||||
update_interval: 1s
|
||||
show_test_card: true
|
||||
# An odd width exercises the row padding in the BMP writer
|
||||
dimensions:
|
||||
width: 101
|
||||
height: 64
|
||||
|
||||
- platform: snapshot
|
||||
id: snapshot_rotated
|
||||
rotation: 90
|
||||
dimensions: 320x240
|
||||
lambda: |-
|
||||
it.filled_rectangle(0, 0, 40, 20, Color(0xFF, 0x80, 0x00));
|
||||
|
||||
esphome:
|
||||
# A name of your own is only good for one snapshot - a second one under the same name fails
|
||||
# rather than writing over the first - so these run once rather than on a repeating interval.
|
||||
on_boot:
|
||||
- delay: 2s
|
||||
- snapshot.take:
|
||||
id: snapshot_display
|
||||
filename: test_card.bmp
|
||||
- snapshot.take:
|
||||
id: snapshot_rotated
|
||||
filename: !lambda 'return "rotated.bmp";'
|
||||
|
||||
interval:
|
||||
# A generated name has the time in it, so this one can repeat.
|
||||
- interval: 10s
|
||||
then:
|
||||
- snapshot.take: snapshot_display
|
||||
@@ -0,0 +1,5 @@
|
||||
host:
|
||||
mac_address: "62:23:45:AF:B3:DE"
|
||||
|
||||
packages:
|
||||
snapshot: !include common.yaml
|
||||
Reference in New Issue
Block a user