Hi,
I have same screen and I’m trying to make a MediaPlayer dashboard ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=10)
Here is my code:
esphome:
name: cxn
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "414ba6ff284ea38563287250f6f5940c"
encryption:
key: "x/hpkt5Dre2eCR5X0iPPqxhkksFLS+9/At8VuajiFl4="
ota:
password: "414ba6ff284ea38563287250f6f5940c"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Cxn Fallback Hotspot"
password: "Sy7tXPvPJsKt"
captive_portal:
time:
- platform: homeassistant
id: zaman
- platform: sntp
id: esptime
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 15s
id: sstrength
text_sensor:
- platform: homeassistant
id: albumname
entity_id: media_player.cambridge_cxn
attribute: media_album_name
internal: true
- platform: homeassistant
id: mediatitle
entity_id: media_player.cambridge_cxn
attribute: media_title
internal: true
- platform: homeassistant
id: mediaartist
entity_id: media_player.cambridge_cxn
attribute: media_artist
internal: true
- platform: homeassistant
id: mediatime
entity_id: media_player.cambridge_cxn
attribute: media_duration
internal: true
font:
- file: 'arial.ttf'
id: font1
size: 10
- file: 'Ubuntu-M.ttf'
id: font2
size: 14
- file: 'arial.ttf'
id: font3
size: 12
- file: 'BebasNeue-Regular.ttf'
id: font4
size: 24
- file: "Ubuntu-M.ttf"
id: sseg
size: 26
- file: "Ubuntu-M.ttf"
id: tiny
size: 12
- file: "Ubuntu-M.ttf"
id: teeny
size: 10
# Example configuration entry
spi:
clk_pin: D5
mosi_pin: D7
globals:
- id: coords
type: int
restore_value: no
initial_value: "1"
- id: length
type: int
restore_value: no
initial_value: "1"
interval:
- interval: 250ms
then:
lambda: |-
if (id(coords) < -(id(length))) {
id(coords) = 0;
}
else {
id(coords) -= 1;
}
display:
- platform: ssd1322_spi
model: "SSD1322 256x64"
reset_pin: D1
cs_pin: D8
dc_pin: D6
lambda: |-
if (id(albumname).has_state()) {
std::string printout = id(mediatitle).state;
int clength = printout.length();
id(length)=clength*5;
it.print(id(coords), 0, id(font2), printout.c_str());
it.printf(0, 20, id(font2), "%s", id(albumname).state.c_str());
it.printf(0, 40, id(font2), "%s", id(mediaartist).state.c_str());
int x=(int)id(sstrength).state;
{
if (x<0)
if ((x>-90) && (x<0)) it.filled_rectangle( 220,14,5,4); else it.rectangle( 220,14,5,4);
if ((x>-70) && (x<0)) it.filled_rectangle( 226,11,5,7); else it.rectangle( 226,11,5,7);
if ((x>-50) && (x<0)) it.filled_rectangle( 232, 8,5,10); else it.rectangle( 232, 8,5,10);
if ((x>-30) && (x<0)) it.filled_rectangle( 238,5,5,13); else it.rectangle( 238,5,5,13);
}
}
I was able to make this by combining some codes I found on the internet and playing on it.
My second goal is putting progress bar bottom of the screen. But I don’t know anything about how can I do ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=10)
Dou you have any suggestion?
Thank you.