diff --git a/fonts/DejaVuSans.ttf b/fonts/DejaVuSans.ttf new file mode 100644 index 0000000..e5f7eec Binary files /dev/null and b/fonts/DejaVuSans.ttf differ diff --git a/fonts/danube__.ttf b/fonts/danube__.ttf new file mode 100644 index 0000000..b211454 Binary files /dev/null and b/fonts/danube__.ttf differ diff --git a/test_esplan.yaml b/test_esplan.yaml new file mode 100644 index 0000000..f29fe03 --- /dev/null +++ b/test_esplan.yaml @@ -0,0 +1,180 @@ +substitutions: + devicename: wt32 + +esphome: + name: ${devicename} + platform: ESP32 + board: esp-wrover-kit + on_boot: + then: + ds1307.read_time: + + +ethernet: + type: LAN8720 + mdc_pin: GPIO23 + mdio_pin: GPIO18 + clk_mode: GPIO0_IN + phy_addr: 1 + power_pin: GPIO16 + id: eth + +external_components: + - source: github://ell249/esphome-PCT2075@master + components: [ pct2075 ] + - source: github://btomala/esphome-LM75@v1 + components: [ lm75 ] + +font: + - file: "fonts/DejaVuSans.ttf" + id: fontSmall + size: 9 + - file: "fonts/danube__.ttf" + id: danube + size: 15 + +logger: + level: DEBUG + baud_rate: 0 #Important. You can't use serial port + +api: +ota: + +web_server: + port: 80 + +i2c: + - id: bus_b + sda: 14 + scl: 15 + scan: true + +time: + - platform: ds1307 + update_interval: never + - platform: homeassistant + on_time_sync: + then: + ds1307.write_time: + + +display: + - platform: ssd1306_i2c + model: "SH1106 128x64" + address: 0x3C + id: my_display + pages: + - id: page1 + lambda: |- + it.print(3, 3, id(danube), "bone"); + it.print(53, 3, id(danube), "iO"); + it.print(3, 22, id(fontSmall), "Host: ${devicename}"); + int seconds = round(id(uptime_sensor).raw_state); + int days = seconds / (24 * 3600); + seconds = seconds % (24 * 3600); + int hours = seconds / 3600; + seconds = seconds % 3600; + int minutes = seconds / 60; + seconds = seconds % 60; + it.printf(3, 32, id(fontSmall), "IP Address: 192.168.1.1"); + it.printf(3, 42, id(fontSmall), "Uptime: %s", ( + (days ? to_string(days) + "d " : "") + + (hours ? to_string(hours) + "h " : "") + + (minutes ? to_string(minutes) + "m " : "") + + (to_string(seconds) + "s") + ).c_str()); + - id: page2 + lambda: |- + it.printf(0, 0, id(fontSmall), "MCP1_1: %s", id(switch_mcp_out1_1).state ? "ON" : "OFF"); + it.print(0, 10, id(fontSmall), "This is page 2!"); +sensor: + - platform: mcp9808 + name: "Living Room Temperature" + update_interval: 60s + - platform: uptime + id: uptime_sensor + - platform: lm75 + id: temperature + name: "Board temperature measurement" + update_interval: 60s + address: 0x48 +# sensor: + # it.printf(3, 32, id(fontSmall), "Wi-Fi: %.1s", id(eth).state); +# - platform: pct2075 +# address: 0x18 +# temperature: +# name: "PCT2075 Temperature" +# update_interval: 30s + + +mcp23017: + - id: 'mcp23017_out1' + address: 0x20 + - id: 'mcp23017_out2' + address: 0x21 + - id: 'mcp23017_out3' + address: 0x22 + - id: 'mcp23017_out4' + address: 0x23 + +# # Individual outputs +switch: + - platform: gpio + id: switch_mcp_out1_1 + name: "MCP23017 Pin A0" + pin: + mcp23xxx: mcp23017_out1 + number: 0 + mode: + output: true + inverted: false + - platform: gpio + name: "MCP23017_1 Pin A0" + pin: + mcp23xxx: mcp23017_out2 + number: 0 + mode: + output: true + inverted: false + - platform: gpio + name: "MCP23017_2 Pin A0" + pin: + mcp23xxx: mcp23017_out3 + number: 0 + mode: + output: true + inverted: false + - platform: gpio + name: "MCP23017_3 Pin A0" + pin: + mcp23xxx: mcp23017_out4 + number: 0 + mode: + output: true + inverted: false + +# # Individual inputs +binary_sensor: + - platform: gpio + id: internal_button + pin: + number: GPIO4 + mode: + input: true + pullup: true + inverted: true + filters: + - delayed_on: 10ms + on_press: + then: + - display.page.show_next: my_display +# name: "MCP23017 Pin B7" +# pin: +# mcp23xxx: mcp23017_hub +# # Use pin B7 +# number: 15 +# # One of INPUT or INPUT_PULLUP +# mode: +# input: true +# pullup: true +# inverted: false