A media card like a phone's now playing, with the album cover on a Guition (0.2.77)
The card behind a media tile shows the album cover, the title, the artist and the album, a progress bar that runs while the track plays with the times at its ends, round keys for previous, play or pause and next, and a volume row with a mute key, a wide slider and the percentage. Keys the player lacks stay faded, an off player shows one power key, a stream without a length shows no bar, and the CYD shows the player's icon in the cover's place. A media tile over the whole page is the same card under the tile's head. media_card.h holds the geometry, tests/test_media_card.cpp checks every shape. The cover comes the way camera images do: the screen asks with the size and the colour behind the corners, the app fetches the picture from Home Assistant, cuts it square, rounds the corners over that colour and serves it on port 8098; the Guition loads it once and asks again only when the picture's mark in the state changes. Firmware 0.2.64. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,23 @@ The CYD has no memory for images (a 320×180 image needs 115 KB in one piece, th
|
||||
free block is about 45 KB). It shows the alert without the picture, and the editor doesn't offer
|
||||
camera tiles for it.
|
||||
|
||||
## The album cover on the media card
|
||||
|
||||
App 0.2.77 with firmware 0.2.64 uses the same road for a media player's picture. The media card
|
||||
(a tap on a media player's tile, or a media tile of size *Full page*) shows the album cover of
|
||||
what plays, with the title, the artist and the album, a progress bar and the keys under it.
|
||||
|
||||
- The screen asks ESP Screen Manager for the cover with the size it draws it at and the colour
|
||||
behind it (the event `esphome.screen_camera` with `size` and `bg`). The app fetches the
|
||||
picture where Home Assistant's state points (`entity_picture`), cuts it square, sizes it,
|
||||
rounds the corners over that colour and serves it on port 8098 as a BMP, like a camera image.
|
||||
- A cover is fetched once per picture: the state carries a short mark of the picture, and the
|
||||
screen asks again only when the mark changes (a new track), when the card opens again or
|
||||
when the page turns back to a full-page media tile. Nothing polls.
|
||||
- A player without a picture (a radio station, a player that is off) keeps the player's icon in
|
||||
the cover's place; the app answers with an empty link and the screen stops asking.
|
||||
- The CYD shows the same card without the picture: its icon stands in for the cover.
|
||||
|
||||
## A doorbell
|
||||
|
||||
```yaml
|
||||
|
||||
Reference in New Issue
Block a user