Cleanup documentation, examples and repo

This commit is contained in:
2026-05-11 18:22:24 +02:00
parent 018555268a
commit 5936fbf9ae
9 changed files with 160 additions and 603 deletions
+18 -18
View File
@@ -1,8 +1,8 @@
# Base module # Base module V2
## Controller ## Controller
Brand: Espressif Brand: Espressif
Type: ESP32-S3-WROOM-1 Type: ESP32-S3-WROOM-1-N16R8
Driver IC: ST7735S (ESPHome compatible) Driver IC: ST7735S (ESPHome compatible)
[Datasheet](../Datasheets/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf) [Datasheet](../Datasheets/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf)
@@ -16,7 +16,7 @@ Driver IC: ST7735S (ESPHome compatible)
4 IO4 Neopixel LED's 4 IO4 Neopixel LED's
5 IO5 SPI MOSI 5 IO5 SPI MOSI
6 IO6 SPI SCK 6 IO6 SPI SCK
7 IO7 7 IO7 SPI Register select
8 IO15 8 IO15
9 IO16 9 IO16
10 IO17 10 IO17
@@ -39,7 +39,7 @@ Driver IC: ST7735S (ESPHome compatible)
27 IO0 27 IO0
28 IO35 28 IO35
29 IO36 29 IO36
30 IO37 SPI Register select 30 IO37
31 IO38 31 IO38
32 IO39 32 IO39
33 IO40 33 IO40
@@ -47,8 +47,8 @@ Driver IC: ST7735S (ESPHome compatible)
35 IO42 35 IO42
36 TXD0 36 TXD0
37 RXD0 37 RXD0
38 IO1 I2C SDA > Temperature Sensor 38 IO1 I2C SDA > Temperature & Ambient Sensor
39 IO2 I2S SCL > Temperature Sensor 39 IO2 I2S SCL > Temperature & Ambient Sensor
40 GND 40 GND
``` ```
@@ -64,11 +64,11 @@ PIN Description Destination
2 +3.3V 2 +3.3V
3 Reset ESP32 #3 EN 3 Reset ESP32 #3 EN
4 I2C SDA ESP32 #24 IO47 4 I2C SDA ESP32 #24 IO47
5 SPI MOSI ESP32 #28 IO35 5 SPI MOSI ESP32 #5 IO5
6 I2C SCK ESP32 #25 IO48 6 I2C SCK ESP32 #25 IO48
7 SPI SCK ESP32 #29 IO36 7 SPI SCK ESP32 #6 IO6
8 I2C Address MSP A0 GND 8 I2C Address MSP A0 GND
9 SPI Register select ESP32 #30 IO37 9 SPI Register select ESP32 #7 IO7
10 I2C Address MSP A1 GND 10 I2C Address MSP A1 GND
11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor)
12 I2C Address MSP A2 GND 12 I2C Address MSP A2 GND
@@ -89,11 +89,11 @@ PIN Description Destination
2 +3.3V 2 +3.3V
3 Reset ESP32 #3 EN 3 Reset ESP32 #3 EN
4 I2C SDA ESP32 #24 IO47 4 I2C SDA ESP32 #24 IO47
5 SPI MOSI ESP32 #28 IO35 5 SPI MOSI ESP32 #5 IO5
6 I2C SCK ESP32 #25 IO48 6 I2C SCK ESP32 #25 IO48
7 SPI SCK ESP32 #29 IO36 7 SPI SCK ESP32 #6 IO6
8 I2C Address MSP A0 3.3V 8 I2C Address MSP A0 3.3V
9 SPI Register select ESP32 #30 IO37 9 SPI Register select ESP32 #7 IO7
10 I2C Address MSP A1 GND 10 I2C Address MSP A1 GND
11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor)
12 I2C Address MSP A2 GND 12 I2C Address MSP A2 GND
@@ -114,11 +114,11 @@ PIN Description Destination
2 +3.3V 2 +3.3V
3 Reset ESP32 #3 EN 3 Reset ESP32 #3 EN
4 I2C SDA ESP32 #24 IO47 4 I2C SDA ESP32 #24 IO47
5 SPI MOSI ESP32 #28 IO35 5 SPI MOSI ESP32 #5 IO5
6 I2C SCK ESP32 #25 IO48 6 I2C SCK ESP32 #25 IO48
7 SPI SCK ESP32 #29 IO36 7 SPI SCK ESP32 #6 IO6
8 I2C Address MSP A0 GND 8 I2C Address MSP A0 GND
9 SPI Register select ESP32 #30 IO37 9 SPI Register select ESP32 #7 IO7
10 I2C Address MSP A1 3.3V 10 I2C Address MSP A1 3.3V
11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor)
12 I2C Address MSP A2 GND 12 I2C Address MSP A2 GND
@@ -139,11 +139,11 @@ PIN Description Destination
2 +3.3V 2 +3.3V
3 Reset ESP32 #3 EN 3 Reset ESP32 #3 EN
4 I2C SDA ESP32 #24 IO47 4 I2C SDA ESP32 #24 IO47
5 SPI MOSI ESP32 #28 IO35 5 SPI MOSI ESP32 #5 IO5
6 I2C SCK ESP32 #25 IO48 6 I2C SCK ESP32 #25 IO48
7 SPI SCL ESP32 #29 IO36 7 SPI SCL ESP32 #6 IO6
8 I2C Address MSP A0 3.3V 8 I2C Address MSP A0 3.3V
9 SPI Register select ESP32 #30 IO37 9 SPI Register select ESP32 #7 IO7
10 I2C Address MSP A1 3.3V 10 I2C Address MSP A1 3.3V
11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor)
12 I2C Address MSP A2 GND 12 I2C Address MSP A2 GND
Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

-7
View File
@@ -1,7 +0,0 @@
# ESPHome Button+ Integration
*work in progress*
## Introduction
TODO
+14 -1
View File
@@ -1,7 +1,7 @@
# Getting Started # Getting Started
In order to get started with a 3 bar module, you should In order to get started with a 3 bar module, you should
1. Make sure you have [ESPHome](https://esphome.io) installed 1. Make sure you have [ESPHome](https://esphome.io) installed
2. Copy the file [3pages_TotalExample.yml](/examples/3pages_TotalExample.yml) to the root of the repository 2. Copy the file [3BAR_1Display.yml](/Examples/3BAR_1Display.yml) to the root of the repository
3. Create a file secrets.yaml and add the following 3. Create a file secrets.yaml and add the following
``` ```
wifi_ssid: "YOUR_SSID" wifi_ssid: "YOUR_SSID"
@@ -12,3 +12,16 @@ wifi_password: "YOUR_PASSWORD"
7. Connect the B+ to your computer 7. Connect the B+ to your computer
8. Open a compatible browser such as Chrome and visit https://web.esphome.io 8. Open a compatible browser such as Chrome and visit https://web.esphome.io
9. Load the downloaded file to your device and enjoy 9. Load the downloaded file to your device and enjoy
# Generating different events / pages
If you want a different number of pages, and you want the matching events, you can generate a new [3bar_1display_events.yaml](/package/3bar_1display_events.yaml) file using python.
The python file is called [generate_events.py](/generate/generate_events.py). The top of the file has three configuration options:
```python
NR_OF_PAGES = 3
INCLUDE_DISPLAY_EXTRA = True # Enable Double, Triple, Hold for main display buttons
LED_CONFIRMATION = True # Flash LED on press
```
Set these to your preferred config before running. Then run `python generate_events.py`. Copy the output file to the package folder, and use that package in your main config. Make sure the number of pages in your main config and the generated file are the same.
+103 -6
View File
@@ -34,12 +34,18 @@ wifi:
packages: packages:
remote_package_files: remote_package_files:
url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2
files:
path: 'package/3bar_1display.yaml'
vars:
nr_of_pages: '2'
page_names: '{"Start","Page 2"}'
ref: main ref: main
files:
- path: 'package/3bar_1display.yaml'
vars:
nr_of_pages: '3'
page_names: '{"Start", "Music", "Page 3"}'
- path: 'package/cards/music.yaml'
vars:
music_card_entity_id: 'media_player.spotifyplus_kennyboy44'
music_card_text_color: FFFFFF
music_card_icon_main_color: FF7F00
music_card_icon_bar_color: FF7F00
font: font:
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
@@ -105,9 +111,16 @@ display:
# data_rate: 40MHz # data_rate: 40MHz
lambda: |- lambda: |-
id(all_pages_main).execute(); id(all_pages_main).execute();
switch (id(actual_page)){ switch (id(actual_page)){
case 0: case 0:
it.print(100, 160, id(font_arial20), "This is page 0!"); it.print(100, 150, id(font_arial20), "Hooray, it works!");
break;
case 1:
id(music_card).execute(20, 125);
break;
case 2:
it.print(100, 150, id(font_arial20), "Last Page");
break; break;
} }
@@ -119,6 +132,9 @@ script:
id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(red)); id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(red));
id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(red)); id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(red));
// //
//>>> Page name
id(main_display).print(100, 208, id(font_arial20), id(active_page_name).c_str());
//
//>>> temperature inside: //>>> temperature inside:
id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(red)); id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(red));
id(main_display).printf(36, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(buttonplus_temperature).state); id(main_display).printf(36, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(buttonplus_temperature).state);
@@ -137,6 +153,9 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("volume_down");
break;
} }
- id: !extend bar1_right_draw - id: !extend bar1_right_draw
then: then:
@@ -145,6 +164,9 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("volume_up");
break;
} }
- id: !extend bar2_left_draw - id: !extend bar2_left_draw
then: then:
@@ -153,6 +175,9 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("prev");
break;
} }
- id: !extend bar2_right_draw - id: !extend bar2_right_draw
then: then:
@@ -161,6 +186,9 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("next");
break;
} }
- id: !extend bar3_left_draw - id: !extend bar3_left_draw
then: then:
@@ -169,6 +197,9 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("power");
break;
} }
- id: !extend bar3_right_draw - id: !extend bar3_right_draw
then: then:
@@ -177,4 +208,70 @@ script:
case 0: case 0:
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red));
break; break;
case 1:
id(music_card_bar).execute("playpause");
break;
} }
event:
- id: !extend bar1_btn_left_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR1LEFT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_vol_down).execute();
ESP_LOGD("main", "VOL DOWN");
}
- id: !extend bar1_btn_right_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR1RIGHT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_vol_up).execute();
ESP_LOGD("main", "VOL UP");
}
- id: !extend bar2_btn_left_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR2LEFT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_prev).execute();
ESP_LOGD("main", "PREV");
}
- id: !extend bar2_btn_right_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR2RIGHT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_next).execute();
ESP_LOGD("main", "NEXT");
}
- id: !extend bar3_btn_left_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR3LEFT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_power).execute();
ESP_LOGD("main", "POWER");
}
- id: !extend bar3_btn_right_event
on_event:
then:
- lambda: |-
ESP_LOGD("main", "BAR3RIGHT event %s triggered.", event_type.c_str());
- lambda: |-
if (event_type == "click page 1"){
id(music_card_playpause).execute();
ESP_LOGD("main", "PLAY PAUSE");
}
+12 -29
View File
@@ -1,26 +1,25 @@
# ESPhome_ButtonPlus > Forked from [https://github.com/dixi83/ESPhome_ButtonPlus](https://github.com/dixi83/ESPhome_ButtonPlus), all initial effort for this was done by [dixi83](https://github.com/dixi83) and [balk77](https://github.com/balk77)
*ESPHome documentation and examples to make ESPHome working on the Button+* # ESPhome_ButtonPlus V2
*ESPHome documentation and examples to make ESPHome working on the Button+ with the V2 PCB*
_(not yet tested with the V2 display module and buttons, only with the V2 PCB with the old display and bars)_
<img src="./Docs/ButtonPlusImage.png" alt="Buttonplus running ESPhome" width="300" height="397"/> <img src="./Docs/ButtonPlusImage.png" alt="Buttonplus running ESPhome" width="300" height="397"/>
## Button+ ## Changes compared to V1
This project was intended for the Button+ V1. Now that the V2 is out, I wanted to also try this out. However, the original project did not work out of the box. This version is currently only for the 1Display+3Bars version. It now uses the esp-idf framework instead of arduino. PSRAM is configured. The GPIO pins have been updated to match the V2 PCB, and the ambient light sensor has been added.
### Generating events for all pages
I also added an events yaml generator, written in python (mostly by AI). It can be used to generate a `3bar_1display_events.yaml` file that defines events for all buttons for the number of pages you want.
## Button+ (V2)
The Button+ is a modular control panel for home automation systems. It is designed to work with MQTT. It has several modules: a "Base module", a "Main display" and "BAR modules" where the position and amount can be changed according your needs. The Button+ is a modular control panel for home automation systems. It is designed to work with MQTT. It has several modules: a "Base module", a "Main display" and "BAR modules" where the position and amount can be changed according your needs.
__You can order the Button+ on there [website](https://button.plus).__ this is also the place to find the original firmware, in case you want to revert back. __You can order the Button+ on there [website](https://button.plus).__ this is also the place to find the original firmware, in case you want to revert back.
To make the Button+ work with ESPHome we needed at least a list of used components and a pinout/IO-list. I spend a couple of evenings with my multimeter, making my wife crazy with the beeps, googled and collected data sheets of the components, broke a the display of 1 BAR module and did a trail-on-error to make stuf work with ESPHome. Here in this repo you'll find the [results](./Components) of my journy.
The ESPHome integration adds more flexebility and features, but also add some more complexity. To minimize the complexity I started this repo to collect examples and improve my work.
> Want to help? Pull requests are welcome!
[Dutch support topic on Tweakers.net](https://gathering.tweakers.net/forum/list_messages/2270086) [Dutch support topic on Tweakers.net](https://gathering.tweakers.net/forum/list_messages/2270086)
<!--
[English support topic on Home Assistant Community:](https://)
TODO
-->
## Usefull Links ## Usefull Links
@@ -31,19 +30,3 @@ TODO
## Documentation ## Documentation
The documentaion of the Button+ ESPHome integration can befound in the [Docs directory](./Docs) The documentaion of the Button+ ESPHome integration can befound in the [Docs directory](./Docs)
## Status
All the features, i the Buton+ has to offer should work with the [`basic_example.yaml`](./Examples/basic_example.yaml). Please reffer the ESPHome documentaion for more information on how to build your own menu or ... (?)
The documentaion is yet to be made... Again If you want to help... Pull requests are welcome!
## TODO:
- [x] Neonleds
- [x] figure out how to control them individually. [> maybe with Light Partition](https://esphome.io/components/light/partition)
- [x] find correct [type](https://esphome.io/components/light/neopixelbus.html#configuration-variables)
- [x] Temperature sensor STS35
- [ ] Make a basic [package](https://esphome.io/components/packages.html) so there is less initial code to be copied.
- [ ] Documentation
- [ ] More examples
-529
View File
@@ -1,529 +0,0 @@
esphome:
name: buttonplus-test
friendly_name: ButtonPlus_test
on_boot:
priority: -100
then:
- script.execute: setup_bar_displays
- script.execute: update_bar1_left
- script.execute: update_bar1_right
- script.execute: update_bar2_left
- script.execute: update_bar2_right
- script.execute: update_bar3_left
- script.execute: update_bar3_right
esp32:
board: esp32-s3-devkitc-1
flash_size: 16MB
framework:
type: arduino
debug:
update_interval: 5s
text_sensor:
- platform: debug
device:
name: "Device Info"
reset_reason:
name: "Reset Reason"
# Logger must be at least debug (default)
logger:
level: debug
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
- platform: esphome
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: 15.5dB
i2c:
- id: temperature_sensor
sda: GPIO1
scl: GPIO2
- id: buttons
sda: GPIO47
scl: GPIO48
frequency: 400khz
spi:
clk_pin: GPIO36
mosi_pin: GPIO35
mcp23008:
- id: base_J0
i2c_id: buttons
address: 0x20
- id: base_J1
i2c_id: buttons
address: 0x21
- id: base_J2
i2c_id: buttons
address: 0x22
- id: base_J3
i2c_id: buttons
address: 0x23
output:
- platform: ledc
pin: GPIO3
id: display_main_backlight_pwm
inverted: True
max_power: 1.0
frequency: 500Hz
- platform: ledc
pin: GPIO46
id: displays_mini_backlight_pwm
inverted: True
max_power: 0.6
frequency: 500Hz
- id: cs_pin_bar1_left
platform: gpio
pin:
mcp23xxx: base_J1
number: 5
mode:
output: true
inverted: true
- id: cs_pin_bar1_right
platform: gpio
pin:
mcp23xxx: base_J1
number: 1
mode:
output: true
inverted: true
- id: cs_pin_bar2_left
platform: gpio
pin:
mcp23xxx: base_J2
number: 5
mode:
output: true
inverted: true
- id: cs_pin_bar2_right
platform: gpio
pin:
mcp23xxx: base_J2
number: 1
mode:
output: true
inverted: true
- id: cs_pin_bar3_left
platform: gpio
pin:
mcp23xxx: base_J3
number: 5
mode:
output: true
inverted: true
- id: cs_pin_bar3_right
platform: gpio
pin:
mcp23xxx: base_J3
number: 1
mode:
output: true
inverted: true
sensor:
- platform: sts3x
id: inside_temperature
i2c_id: temperature_sensor
name: "Temperature"
address: 0x4A
update_interval: 10s
- platform: homeassistant
entity_id: sensor.gw1100a_outdoor_temperature
id: outside_temperature
- platform: debug
free:
name: "Heap Free"
block:
name: "Heap Max Block"
loop_time:
name: "Loop Time"
psram:
name: "Free PSRAM"
time:
- platform: homeassistant
id: datetime
font:
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: font_arial20
size: 20
bpp: 4
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: font_arial15
size: 15
bpp: 4
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
id: font_arial40
size: 40
bpp: 4
- file: "https://torinak.com/font/7segment.ttf"
id: font_clock
size: 80
bpp: 4
- file: "https://torinak.com/font/7segment.ttf"
id: font_date
size: 30
bpp: 4
image:
- file: mdi:lightbulb
id: lightbulb
resize: 80x80
- file: mdi:alert
id: alert
resize: 80x80
- file: mdi:chevron-right
id: icon_next_page
resize: 30x30
- file: mdi:chevron-left
id: icon_prev_page
resize: 30x30
- file: mdi:sun-thermometer-outline
id: icon_temp_outside
resize: 40x40
- file: mdi:home-thermometer-outline
id: icon_temp_inside
resize: 40x40
color:
- id: red
hex: FF0000
- id: blue
hex: 0000FF
- id: yellow
hex: FFFF00
- id: green
hex: 00FF00
- id: orange
hex: FF7F00
- id: white
hex: FFFFFF
binary_sensor:
- platform: gpio
id: 'main_display_btn_left'
name: "Main Display button Left"
pin:
mcp23xxx: base_J2
number: 6
mode: INPUT_PULLUP
inverted: true
on_click:
- script.execute: prev_page_all
- platform: gpio
id: 'main_display_btn_right'
name: "Main Display button Right"
pin:
mcp23xxx: base_J2
number: 2
mode: INPUT_PULLUP
inverted: true
on_click:
- script.execute: next_page_all
- platform: gpio
id: 'bar1_btn_left'
name: "BAR 1 button Left"
pin:
mcp23xxx: base_J3
number: 6
mode: INPUT_PULLUP
inverted: true
- platform: gpio
id: 'bar1_btn_right'
name: "BAR 1 button Right"
pin:
mcp23xxx: base_J3
number: 2
mode: INPUT_PULLUP
inverted: true
light:
- platform: neopixelbus
id: neopixels
type: RGB
variant: WS2812
pin: GPIO4
num_leds: 5
- platform: monochromatic
output: display_main_backlight_pwm
gamma_correct : 2.2
name: "Main Display Backlight"
id: display_main_backlight
restore_mode: ALWAYS_ON
- platform: monochromatic
output: displays_mini_backlight_pwm
gamma_correct : 2.2
name: "Mini Display Backlight"
id: displays_mini_backlight
restore_mode: ALWAYS_ON
- platform: partition
name: "BAR 1 Left RGB Front"
id: bar1_left_rgb_front
segments:
- id: neopixels
from: 0
to: 0
- platform: partition
name: "BAR 1 Left RGB Back"
id: bar1_left_rgb_back
segments:
- id: neopixels
from: 1
to: 1
- platform: partition
name: "BAR 1 Right RGB Front"
id: bar1_right_rgb_front
segments:
- id: neopixels
from: 2
to: 2
- platform: partition
name: "BAR 1 Right RGB Back"
id: bar1_right_rgb_back
segments:
- id: neopixels
from: 3
to: 3
display:
- id: main_display
platform: ili9xxx
model: ili9341
color_order: rgb
update_interval: 30s
invert_colors: false
dc_pin:
number: GPIO37
allow_other_uses: true
cs_pin:
mcp23xxx: base_J0
number: 5
mode:
output: true
inverted: false
show_test_card: false
dimensions:
height: 240
width: 320
rotation: 180
pages:
- id: page1
lambda: |-
id(all_pages).execute();
it.print(100, 160, id(font_arial20), "This is page 1!");
- id: bar_display
platform: ili9xxx
model: ST7735
color_order: bgr
update_interval: never
dc_pin:
number: GPIO37
allow_other_uses: true
invert_colors: false
show_test_card: false
auto_clear_enabled: false
dimensions:
height: 160
width: 80
offset_width: 24
script:
- id: update_bar1_left
then:
- lambda: |-
id(cs_pin_bar1_left).turn_on(); // <<
id(cs_pin_bar1_right).turn_off();
id(cs_pin_bar2_left).turn_off();
id(cs_pin_bar2_right).turn_off();
id(cs_pin_bar3_left).turn_off();
id(cs_pin_bar3_right).turn_off();
id(bar_display).clear();
id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES);
id(bar1_left_page1).execute();
id(bar_display).update();
delay(1);
id(cs_pin_bar1_left).turn_off();
- id: update_bar1_right
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_on(); // <<
id(cs_pin_bar2_left).turn_off();
id(cs_pin_bar2_right).turn_off();
id(cs_pin_bar3_left).turn_off();
id(cs_pin_bar3_right).turn_off();
id(bar_display).clear();
id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES);
id(bar1_right_page1).execute();
id(bar_display).update();
delay(1);
id(cs_pin_bar1_right).turn_off();
- id: update_bar2_left
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_off();
id(cs_pin_bar2_left).turn_on(); // <<
id(cs_pin_bar2_right).turn_off();
id(cs_pin_bar3_left).turn_off();
id(cs_pin_bar3_right).turn_off();
//
id(bar_display).fill(id(orange));
id(bar_display).update();
delay(1);
id(cs_pin_bar2_left).turn_off();
- id: update_bar2_right
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_off();
id(cs_pin_bar2_left).turn_off();
id(cs_pin_bar2_right).turn_on(); // <<
id(cs_pin_bar3_left).turn_off();
id(cs_pin_bar3_right).turn_off();
//
id(bar_display).fill(id(orange));
id(bar_display).update();
delay(1);
id(cs_pin_bar2_right).turn_off();
- id: update_bar3_left
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_off();
id(cs_pin_bar2_left).turn_off();
id(cs_pin_bar2_right).turn_off();
id(cs_pin_bar3_left).turn_on(); // <<
id(cs_pin_bar3_right).turn_off();
//
id(bar_display).fill(id(orange));
id(bar_display).update();
delay(1);
id(cs_pin_bar3_left).turn_off();
- id: update_bar3_right
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_off();
id(cs_pin_bar2_left).turn_off();
id(cs_pin_bar2_right).turn_off();
id(cs_pin_bar3_left).turn_off();
id(cs_pin_bar3_right).turn_on();
//
id(bar_display).fill(id(orange));
id(bar_display).update();
delay(1);
id(cs_pin_bar3_right).turn_off();
- id: bar1_left_page1
then:
- lambda: |-
id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(orange));
- id: bar1_right_page1
then:
- lambda: |-
id(bar_display).image(80, 0, id(alert), ImageAlign::TOP_CENTER, id(red));
- id: setup_bar_displays
then:
- lambda: |-
id(cs_pin_bar1_left).turn_on();
id(bar_display).setup();
id(cs_pin_bar1_left).turn_off();
delay(5);
id(cs_pin_bar1_right).turn_on();
id(bar_display).setup();
id(cs_pin_bar1_right).turn_off();
delay(5);
id(cs_pin_bar2_left).turn_on();
id(bar_display).setup();
id(cs_pin_bar2_left).turn_off();
delay(5);
id(cs_pin_bar2_right).turn_on();
id(bar_display).setup();
id(cs_pin_bar2_right).turn_off();
delay(5);
id(cs_pin_bar3_left).turn_on();
id(bar_display).setup();
id(cs_pin_bar3_left).turn_off();
delay(5);
id(cs_pin_bar3_right).turn_on();
id(bar_display).setup();
id(cs_pin_bar3_right).turn_off();
- id: update_main
then:
- component.update: main_display
- id: update_all
then:
- component.update: main_display
- script.execute: update_bar1_left
- script.execute: update_bar1_right
- script.execute: update_bar2_left
- script.execute: update_bar2_right
- script.execute: update_bar3_left
- script.execute: update_bar3_right
- id: next_page_main
then:
- display.page.show_next: main_display
- script.execute: update_main
- id: next_page_all
then:
- display.page.show_next: main_display
- script.execute: update_all
- id: prev_page_main
then:
- display.page.show_previous: main_display
- script.execute: update_main
- id: prev_page_all
then:
- display.page.show_previous: main_display
- script.execute: update_all
- id: all_pages
then:
- lambda: |-
//>>> make a border arround the display
id(main_display).filled_rectangle( 0, 0, 320, 3, id(red));
id(main_display).filled_rectangle( 0, 0, 3, 240, id(red));
id(main_display).filled_rectangle( 0, 237, 320, 3, id(red));
//id(main_display).filled_rectangle( 0, 206, 320, 3, id(red));
id(main_display).filled_rectangle(317, 0, 3, 240, id(red));
//
//>>> prev/next icons next to butotns
id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(orange));
id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(orange));
//
//>>> temperature inside:
id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(orange));
id(main_display).printf(36, 85, id(font_arial20), id(white), TextAlign::BASELINE_CENTER , "%.1f°", id(inside_temperature).state);
//
//>>> vertical line:
id(main_display).filled_rectangle(70, 0, 3, 115, id(red));
//
//>>> print time and date
id(main_display).strftime(160, 5, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(datetime).now());
id(main_display).strftime(160, 80, id(font_date), TextAlign::TOP_CENTER, "%d-%m-%Y", id(datetime).now());
//
//>>> vertical line:
id(main_display).filled_rectangle(250, 0, 3, 115, id(red));
//
//>>> outside temperature
id(main_display).image(285, 15, id(icon_temp_outside), ImageAlign::TOP_CENTER, id(orange));
id(main_display).printf(285, 85, id(font_arial20), id(white), TextAlign::BASELINE_CENTER , "%.1f°", id(outside_temperature).state);
//
//>>> horizontal line:
id(main_display).filled_rectangle(0, 115, 320, 3, id(red));
+11 -11
View File
@@ -6,7 +6,7 @@
## players current state ## players current state
## USAGE: ## USAGE:
## substitutions: ## substitutions:
## music_card_enity_id: 'media_player.media_keuken_2' ## music_card_entity_id: 'media_player.media_keuken_2'
## package: ## package:
## remote_package_files: ## remote_package_files:
## url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 ## url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2
@@ -110,25 +110,25 @@ color:
text_sensor: text_sensor:
- platform: homeassistant - platform: homeassistant
id: music_album id: music_album
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
attribute: media_album_name attribute: media_album_name
on_value: on_value:
- delay: 500ms - delay: 500ms
- script.execute: update_main - script.execute: update_main
- platform: homeassistant - platform: homeassistant
id: music_artist id: music_artist
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
attribute: media_artist attribute: media_artist
- platform: homeassistant - platform: homeassistant
id: music_title id: music_title
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
attribute: media_title attribute: media_title
on_value: on_value:
- delay: 500ms - delay: 500ms
- script.execute: update_main - script.execute: update_main
- platform: homeassistant - platform: homeassistant
id: music_playerstate id: music_playerstate
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
on_value: on_value:
- script.execute: update_all - script.execute: update_all
@@ -194,34 +194,34 @@ script:
- homeassistant.action: - homeassistant.action:
action: media_player.volume_up action: media_player.volume_up
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
- id: music_card_vol_down - id: music_card_vol_down
then: then:
- homeassistant.action: - homeassistant.action:
action: media_player.volume_down action: media_player.volume_down
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
- id: music_card_next - id: music_card_next
then: then:
- homeassistant.action: - homeassistant.action:
action: media_player.media_next_track action: media_player.media_next_track
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
- id: music_card_prev - id: music_card_prev
then: then:
- homeassistant.action: - homeassistant.action:
action: media_player.media_previous_track action: media_player.media_previous_track
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
- id: music_card_playpause - id: music_card_playpause
then: then:
- homeassistant.action: - homeassistant.action:
action: media_player.media_play_pause action: media_player.media_play_pause
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}
- id: music_card_power - id: music_card_power
then: then:
- homeassistant.action: - homeassistant.action:
action: media_player.toggle action: media_player.toggle
data: data:
entity_id: ${music_card_enity_id} entity_id: ${music_card_entity_id}