All B+ features working

This commit is contained in:
Martijn
2024-10-25 10:22:22 +02:00
parent fb05958970
commit 0448c4e792
+120 -20
View File
@@ -1,9 +1,14 @@
###
### This is a basic example, showing all features of the Button+
###
esphome:
name: buttonplus-test
friendly_name: ButtonPlus_test
esp32:
board: esp32-s3-devkitc-1
flash_size: 16MB
framework:
type: arduino
@@ -22,23 +27,22 @@ ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Buttonplus-Test Fallback Hotspot"
password: "m8FaRl2yzalt"
captive_portal:
i2c:
sda: GPIO47
scl: GPIO48
scan: true
frequency: 400khz
- id: temperature_sensor
sda: GPIO1
scl: GPIO2
scan: true
- id: buttons
sda: GPIO47
scl: GPIO48
scan: true
frequency: 400khz
spi:
clk_pin: GPIO36
mosi_pin: GPIO35
# miso_pin: GPIOXX
mcp23008:
# - id: 'base_J0'
@@ -46,8 +50,10 @@ mcp23008:
# - id: 'base_J1'
# address: 0x21
- id: 'base_J2'
i2c_id: buttons
address: 0x22
- id: 'base_J3'
i2c_id: buttons
address: 0x23
# Define a PWM output on the ESP32
@@ -98,6 +104,18 @@ binary_sensor:
mode: INPUT_PULLUP
inverted: true
sensor:
- platform: sts3x
id: inside_temperature
i2c_id: temperature_sensor
name: "Temperature"
address: 0x4A
update_interval: 10s
- platform: homeassistant
id: outside_temperature
entity_id: sensor.gw1100a_outdoor_temperature
internal: true
light:
- platform: monochromatic
output: displays_mini_backlight_pwm
@@ -109,6 +127,74 @@ light:
name: "Main Display Backlight"
id: display_main_backlight
restore_mode: ALWAYS_ON
- platform: neopixelbus
id: neopixels
type: RGB
variant: WS2812
pin: GPIO4
num_leds: 8
- platform: partition
name: "BAR J3 Left RGB Front"
id: bar_j3_left_rgb_front
segments:
- id: neopixels
from: 0
to: 0
- platform: partition
name: "BAR J3 Left RGB Back"
id: bar_j3_left_rgb_back
segments:
- id: neopixels
from: 1
to: 1
- platform: partition
name: "BAR J3 Right RGB Front"
id: bar_j3_right_rgb_front
segments:
- id: neopixels
from: 2
to: 2
- platform: partition
name: "BAR J3 Right RGB Back"
id: bar_j3_right_rgb_back
segments:
- id: neopixels
from: 3
to: 3
time:
- platform: homeassistant
id: esptime
font:
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: my_font20
size: 20
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: my_font15
size: 15
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: my_font40
size: 40
image:
- file: mdi:lightbulb
id: lightbulb
resize: 80x80
- file: mdi:alert
id: alert
resize: 80x80
- file: "https://i.postimg.cc/CMXFmZ5n/henk.png"
id: henk
resize: 120x100
type: RGBA
use_transparency: true
color:
- id: red
hex: 0000FF
- id: blue
hex: FF0000
display:
- id: display_j2_main
@@ -124,14 +210,32 @@ display:
mode:
output: true
inverted: false
update_interval: 1s
update_interval: 100ms
show_test_card: false
dimensions:
height: 240
width: 320
rotation: 180
lambda: |-
it.print(0, 25, id(my_font), "Hello World! From ESPHome");
// Print inside temperature (from homeassistant sensor)
if (id(inside_temperature).has_state()) {
it.printf(2, 60, id(my_font20), id(blue), TextAlign::BASELINE_LEFT , "%.1f°", id(inside_temperature).state);
}
it.printf(2, 80, id(my_font15), id(blue), TextAlign::BASELINE_LEFT, "Binnen");
// Print time and date
it.strftime(160, 60, id(my_font40), TextAlign::BASELINE_CENTER, "%H:%M", id(esptime).now());
it.strftime(160, 80, id(my_font20), id(red), TextAlign::BASELINE_CENTER, "%d-%m-%Y", id(esptime).now());
// Print outside temperature (from homeassistant sensor)
if (id(outside_temperature).has_state()) {
it.printf(316, 60, id(my_font20), id(blue), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
}
it.printf(316, 80, id(my_font15), id(blue), TextAlign::BASELINE_RIGHT, "Buiten");
// Draw the image my_online_image at position
it.image(160, 100, id(henk), ImageAlign::TOP_CENTER);
- id: display_j3_Left
platform: ili9xxx
model: ST7735
@@ -153,7 +257,7 @@ display:
rotation: 270
update_interval: 1s
lambda: |-
it.print(0, 25, id(my_font), "Hello World! From ESPHome");
it.image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
- id: display_j3_Right
platform: ili9xxx
model: ST7735
@@ -175,9 +279,5 @@ display:
rotation: 90
update_interval: 1s
lambda: |-
it.print(0, 25, id(my_font), "Hello World! From ESPHome");
font:
- file: "gfonts://Roboto"
id: my_font
size: 20
//it.print(0, 25, id(my_font15), "Hello B+! From ESPHome");
it.image(80, 0, id(alert), ImageAlign::TOP_CENTER);