Hi.
i’ve got multiple oled1306 i2c displays. if connected to same i2c pins on the same nodemcu, they all work fine and display the same text (which is expected because they have the same i2c address).
I cannot change the displays i2c addresses so need to put them on seperate i2c buses. The nodemcu esp8266 uses software defined i2c, i should be able to use a maximum of ten buses.
trying to work through this i found that each time i try to compile, i get the error, ID page(no) redefined! Check display->0->pages->0->id.
so for example
pages:
-
ID page1 redefined! Check display->0->pages->0->id.
id: page1
lambda: !lambda |-
it.printf(10, 9, id(my_font_14), “Pump1 Low: %s A”, id(Tas_sensor2_thing_Pump1_low_current).state.c_str());
-
ID page2 redefined! Check display->0->pages->1->id.
id: page2
lambda: !lambda |-
it.printf(10, 9, id(my_font_14), “Pump1 High: %s A”, id(Tas_sensor2_thing_Pump1_high_current).state.c_str());
-
ID page3 redefined! Check display->0->pages->2->id.
id: page3
lambda: !lambda |-
it.printf(10, 9, id(my_font_14), “Pump2: %s A”, id(Tas_sensor2_thing_Pump2_current).state.c_str());
- id: page4
lambda: !lambda |-
it.printf(10, 9, id(my_font_14), “Solar Pump: %s A”, id(Tas_sensor2_thing_Solar_Pump_current).state.c_str());
brightness: 1.
so it looks like i need to change the way i write the page id’s. does anyone know how to assign pages to specific displays?
Current config using the latest ESPHOME firmware below. thanks
esphome:
name: tas_sensor3
platform: ESP8266
board: nodemcuv2
wifi:
ssid: “blah blah blah”
password: “blah blah blah”
fast_connect: false
reboot_timeout: 0s
domain: .home.local
power_save_mode: none
Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: “Tas Sensor3 Fallback Hotspot”
password: “blah blah blah”
web_server:
port: 80
Enable logging
logger:
level: VERBOSE
i2c:
- id: bus1
sda: D2
scl: D1
scan: false - id: bus2
sda: D4
scl: D3
scan: false
font:
- file: “arial.ttf”
id: my_font_16
size: 16 - file: “arial.ttf”
id: my_font_14
size: 14
image:
- file: “coolant-temperature.png”
id: water_temp
resize: 16x16
display:
- platform: ssd1306_i2c
i2c_id: bus1
address: 0x3C
model: “SSD1306 128x32”
id: oled1
reset_pin: D0
update_interval: 30s
pages:- id: page1
lambda: |-
it.printf(10, 9, id(my_font_16), “Hot Tub : %s °C”, id(Tas_Sensor1_Hot_Tub).state.c_str()); - id: page2
lambda: |-
it.printf(10, 9, id(my_font_14), “Solar Out : %s °C”, id(Tas_Sensor1_Solar_In).state.c_str()); - id: page3
lambda: |-
it.printf(10, 9, id(my_font_14), “Solar In : %s °C”, id(Tas_Sensor1_Solar_Out).state.c_str());
- id: page1
- platform: ssd1306_i2c
i2c_id: bus2
address: 0x3C
model: “SSD1306 128x32”
id: oled2
reset_pin: D0
update_interval: 30s
pages:- id: page1
lambda: |-
it.printf(10, 9, id(my_font_14), “Pump1 Low: %s A”, id(Tas_sensor2_thing_Pump1_low_current).state.c_str()); - id: page2
lambda: |-
it.printf(10, 9, id(my_font_14), “Pump1 High: %s A”, id(Tas_sensor2_thing_Pump1_high_current).state.c_str()); - id: page3
lambda: |-
it.printf(10, 9, id(my_font_14), “Pump2: %s A”, id(Tas_sensor2_thing_Pump2_current).state.c_str()); - id: page4
lambda: |-
it.printf(10, 9, id(my_font_14), “Solar Pump: %s A”, id(Tas_sensor2_thing_Solar_Pump_current).state.c_str());
- id: page1
interval:
- interval: 5s
then:- display.page.show_next: oled1
- component.update: oled1
- display.page.show_next: oled2
- component.update: oled2
mqtt:
broker: openhab
discovery: true
username: blah blah blah
password: blah blah blah
reboot_timeout: 0s
keepalive: 15s
client_id: tas_sensor3
topic_prefix: tas_sensor3
birth_message:
topic: myavailability/topic
payload: online
will_message:
topic: myavailability/topic
payload: offline
text_sensor:
- platform: mqtt_subscribe
name: “Tas_Sensor1_Hot_Tub”
id: Tas_Sensor1_Hot_Tub
topic: tas_sensor1/sensor/hot_tub/state - platform: mqtt_subscribe
name: “Tas_Sensor1_Solar_In”
id: Tas_Sensor1_Solar_In
topic: tas_sensor1/sensor/solar_heater_in/state - platform: mqtt_subscribe
name: “Tas_Sensor1_Solar_Out”
id: Tas_Sensor1_Solar_Out
topic: tas_sensor1/sensor/solar_heater_out/state - platform: mqtt_subscribe
name: “Tas_sensor2_thing_Pump1_low_current”
id: Tas_sensor2_thing_Pump1_low_current
topic: tas_sensor2/sensor/pump1_low_current/state - platform: mqtt_subscribe
name: “Tas_sensor2_thing_Pump1_high_current”
id: Tas_sensor2_thing_Pump1_high_current
topic: tas_sensor2/sensor/pump1_high_current/state - platform: mqtt_subscribe
name: “Tas_sensor2_thing_Pump2_current”
id: Tas_sensor2_thing_Pump2_current
topic: tas_sensor2/sensor/pump2_current/state - platform: mqtt_subscribe
name: “Tas_sensor2_thing_Solar_Pump_current”
id: Tas_sensor2_thing_Solar_Pump_current
topic: tas_sensor2/sensor/solar_pump_current/state
api:
password: “blah blah blah”
reboot_timeout: 0s
ota:
password: “blah blah blah”
time:
- platform: sntp
id: sntp_time