I managed to get a little display going with a D1 mini and thanks to the help on the forum it works amazingly well.
I’ve now tried to build a second one, source code almost identical, but there’s simply no HA sensor data going to it. If I look at the logs, I can see the blue reports of HA data arriving at ESP #1. If I look at ESP #2’s logs, there is no such data, and no errors either.
I’m probably missing something stupid, I’m still learning.
Any ideas how I can try to debug the issue? Herewith the code. There are some differences, I’m not sure how it happened but the one has an API key and the other (which is working fine) does NOT have an API key.
Device 1 (Working):
substitutions:
name: "esphome-micro-display"
friendly_name: ESPHome Micro Display
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
import_full_config: true
# To have a "next url" for improv serial
web_server:
# Example configuration entry
i2c:
scl: D1
sda: D2
#font:
# # gfonts://family[@weight]
# - file: "gfonts://Roboto"
# id: roboto_20
# size: 20
font:
- file: "gfonts://B612 Mono"
id: font_small
size: 10
- file: "gfonts://Reddit Mono"
id: font_mono_medium
size: 14
image:
- file: "mdi:battery"
id: img_batt
resize: 14x14
- file: "mdi:power-plug"
id: img_load
resize: 14x14
- file: "images/dollar_red.png"
id: img_grid
- file: "mdi:arrow-down-bold"
id: img_down
resize: 14x14
- file: "mdi:arrow-up-bold"
id: img_up
resize: 14x14
sensor:
- platform: homeassistant
id: sensor_soc
entity_id: sensor.deye_sunsynk_sol_ark_battery_state_of_charge
internal: true
- platform: homeassistant
id: sensor_load
entity_id: sensor.deye_sunsynk_sol_ark_load_power
internal: true
- platform: homeassistant
entity_id: sensor.deye_sunsynk_sol_ark_grid_power
id: sensor_grid
internal: true
- platform: homeassistant
entity_id: sensor.deye_sunsynk_sol_ark_battery_power
id: sensor_battery_power
internal: true
time:
- platform: homeassistant
id: esptime
display:
- platform: ssd1306_i2c
model: "SSD1306 64x48"
reset_pin: 0
address: 0x3C
lambda: |-
if (id(sensor_battery_power).state < -100) {
it.image(50,0,id(img_down));
}
if (id(sensor_battery_power).state > 100) {
it.image(50,0,id(img_up));
}
it.image(0,0,id(img_batt));
it.printf(14,0, id(font_small), "%.0f%%", id(sensor_soc).state);
it.image(0,15,id(img_load));
it.printf(14,15, id(font_small), "%.2f% KW", id(sensor_load).state/1000.0);
it.image(0,30,id(img_grid));
it.printf(14,30, id(font_small), "%.2f% KW", id(sensor_grid).state/1000.0);
# lambda: |-
# it.printf(0, 0, id(font_small), "BATT:%.0f%%", id(soc).state);
# it.printf(0, 15, id(font_small), "LOAD:%.1f%KW", id(load).state/1000.0);
Device 2 (Not working, only displaying glyphs):
esphome:
name: micro-display-2
friendly_name: Micro Display 2
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "+/tmvHqLdFLzAT/j3PktzstBIPrfges2kRyvRrfq+8E="
ota:
password: "c559deb501aa55f599ad496935a16b0d"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Micro-Display-2 Fallback Hotspot"
password: "abc0000000"
captive_portal:
i2c:
scl: D1
sda: D2
font:
- file: "gfonts://B612 Mono"
id: font_small
size: 10
- file: "gfonts://Reddit Mono"
id: font_mono_medium
size: 14
image:
- file: "mdi:battery"
id: img_batt
resize: 14x14
- file: "mdi:power-plug"
id: img_load
resize: 14x14
- file: "images/dollar_red.png"
id: img_grid
- file: "mdi:arrow-down-bold"
id: img_down
resize: 14x14
- file: "mdi:arrow-up-bold"
id: img_up
resize: 14x14
sensor:
- platform: homeassistant
id: sensor_soc
entity_id: sensor.deye_sunsynk_sol_ark_battery_state_of_charge
internal: true
- platform: homeassistant
id: sensor_load
entity_id: sensor.deye_sunsynk_sol_ark_load_power
internal: true
- platform: homeassistant
entity_id: sensor.deye_sunsynk_sol_ark_grid_power
id: sensor_grid
internal: true
- platform: homeassistant
entity_id: sensor.deye_sunsynk_sol_ark_battery_power
id: sensor_battery_power
internal: true
time:
- platform: homeassistant
id: esptime
display:
- platform: ssd1306_i2c
model: "SSD1306 64x48"
reset_pin: 0
address: 0x3C
lambda: |-
if (id(sensor_battery_power).state < -100) {
it.image(50,0,id(img_up));
}
if (id(sensor_battery_power).state > 100) {
it.image(50,0,id(img_down));
}
it.image(0,0,id(img_batt));
it.printf(14,0, id(font_small), "%.0f%%", id(sensor_soc).state);
it.image(0,15,id(img_load));
it.printf(14,15, id(font_small), "%.2f% KW", id(sensor_load).state/1000.0);
it.image(0,30,id(img_grid));
it.printf(14,30, id(font_small), "%.2f% KW", id(sensor_grid).state/1000.0);