Skip to content
Snippets Groups Projects
Commit 5f9b8fd7 authored by Jan Grewe's avatar Jan Grewe
Browse files

add ESPHome config

parent d2f30c98
No related branches found
No related tags found
No related merge requests found
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
/secrets.yaml
# BILLament # BILLament - IKEA BILLY Filament Storage
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://git.faked.org/jan/billament.git
git branch -M master
git push -uf origin master
```
## Integrate with your tools
- [ ] [Set up project integrations](https://git.faked.org/jan/billament/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
esphome:
name: $devicename
comment: $comment
project:
name: "billament.controller"
version: "0.1"
on_boot:
- priority: -100
then:
- lambda: |-
id(sntp_time).update();
- priority: 800
then:
- switch.turn_on: display_active
- delay: 3s
- lvgl.widget.hide: boot_screen
substitutions:
devicename: "billabox"
comment: "BILLament Controller"
domain: !secret domain
timezone: !secret timezone
esp32:
board: esp32dev
framework:
type: arduino
preferences:
flash_write_interval: 15s
logger:
level: DEBUG
api:
password: !secret api_password
reboot_timeout: 0s
ota:
platform: esphome
password: !secret ota_password
time:
- platform: sntp
id: sntp_time
timezone: ${timezone}
update_interval: 1h
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
fast_connect: on
reboot_timeout: 1min
domain: .${domain}
use_address: ${devicename}.${domain}
web_server:
port: 80
local: true
# include_internal: true
prometheus:
include_internal: true
relabel:
rssi:
id: rssi
name: RSSI
device_uptime:
id: uptime
name: Uptime
debug:
update_interval: 5s
i2c:
sda: 21
scl: 22
#frequency: 10kHz
sensor:
- platform: wifi_signal
id: rssi
name: "Wifi Signal"
update_interval: 60s
- platform: uptime
id: device_uptime_seconds
update_interval: 15s
internal: true
- platform: bme280_i2c
id: bme280_0
address: 0x76
temperature:
name: "Temperature 0"
pressure:
name: "Pressure 0"
humidity:
name: "Humidity 0"
- platform: bme280_i2c
id: bme280_1
address: 0x77
temperature:
name: "Temperature 1"
pressure:
name: "Pressure 1"
humidity:
name: "Humidity 1"
- platform: rotary_encoder
id: encoder
name: "Rotary Encoder"
pin_a: GPIO04
pin_b: GPIO16
resolution: 2
restore_mode: ALWAYS_ZERO
publish_initial_value: true
on_clockwise:
- then:
- switch.turn_on: display_active
- lvgl.indicator.update:
id: val_needle
value: !lambda 'return id(encoder).state + 1;'
on_anticlockwise:
- then:
- switch.turn_on: display_active
- lvgl.indicator.update:
id: val_needle
value: !lambda 'return id(encoder).state - 1;'
binary_sensor:
- platform: gpio
id: encoder_button
name: "Rotary Encoder Button"
pin:
number: GPIO17
inverted: true
mode:
input: true
pullup: true
on_click:
then:
- switch.turn_on: display_active
- platform: gpio
id: door_left
name: "Door Left"
pin:
number: GPIO18
mode:
input: true
pullup: true
on_press:
then:
- switch.turn_on: display_active
on_release:
then:
- switch.turn_off: display_active
- platform: gpio
id: door_right
name: "Door Right"
pin:
number: GPIO19
mode:
input: true
pullup: true
on_press:
then:
- switch.turn_on: display_active
on_release:
then:
- switch.turn_off: display_active
switch:
- platform: template
id: display_active
name: "Display Active"
optimistic: true
restore_mode: ALWAYS_ON
on_turn_on:
then:
- light.turn_on:
id: display_backlight
brightness: !lambda 'return id(display_brightness).state / 100.0;'
- delay: !lambda 'return id(display_timeout).state * 1000;'
- light.turn_on:
id: display_backlight
brightness: !lambda 'return id(display_brightness_dimmed).state / 100.0;'
- switch.turn_off: display_active
on_turn_off:
then:
- light.turn_on:
id: display_backlight
brightness: !lambda 'return id(display_brightness_dimmed).state / 100.0;'
text_sensor:
- platform: version
name: "ESPHome Version"
hide_timestamp: true
- platform: debug
#device:
# name: "Device: Info"
reset_reason:
name: "Device: Reset Reason"
- platform: template
id: device_uptime
name: "Device: Uptime"
update_interval: 15s
lambda: |-
uint32_t dur = id(device_uptime_seconds).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[38];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
button:
- platform: restart
id: device_reset
name: "Device: Reset"
spi:
- id: spi_bus
clk_pin: GPIO32
mosi_pin: GPIO33
# miso_pin:
interface: hardware
display:
- platform: ili9xxx
model: GC9A01A
dc_pin: GPIO26
cs_pin: GPIO27
reset_pin: GPIO25
invert_colors: true
transform:
swap_xy: true
mirror_x: true
mirror_y: true
auto_clear_enabled: false
update_interval: never
#show_test_card: true
output:
- platform: ledc
pin: GPIO14
id: backlight_pwm
light:
- platform: monochromatic
id: display_backlight
name: "Display Backlight"
internal: true
output: backlight_pwm
restore_mode: ALWAYS_ON
- platform: fastled_clockless
id: upper_left
name: "Lightbars"
chipset: WS2813
pin: GPIO13
num_leds: 180
rgb_order: BRG
number:
- platform: template
name: "Display Timeout"
optimistic: true
id: display_timeout
unit_of_measurement: "s"
initial_value: 30
restore_value: true
min_value: 10
max_value: 180
step: 5
mode: box
- platform: template
name: "Display Backlight"
optimistic: true
id: display_brightness
unit_of_measurement: "%"
initial_value: 100
restore_value: true
min_value: 0
max_value: 100
step: 5
on_value:
- switch.turn_on: display_active
- light.turn_on:
id: display_backlight
brightness: !lambda 'return x/100.0;'
- platform: template
name: "Display Backlight (Dimmed)"
optimistic: true
id: display_brightness_dimmed
unit_of_measurement: "%"
initial_value: 20
restore_value: true
min_value: 0
max_value: 100
step: 5
on_value:
then:
- if:
condition:
switch.is_off: display_active
then:
- light.turn_on:
id: display_backlight
brightness: !lambda 'return x/100.0;'
image:
- file: https://esphome.io/_static/favicon-512x512.png
id: boot_logo
resize: 128x128
type: RGB565
use_transparency: true
lvgl:
buffer_size: 25%
theme:
label:
text_color: 0xffffff
top_layer:
widgets:
- obj:
id: boot_screen
x: 0
y: 0
width: 100%
height: 100%
bg_color: 0x000000
bg_opa: COVER
radius: 0
pad_all: 0
border_width: 0
widgets:
- image:
align: CENTER
src: boot_logo
y: -40
- spinner:
align: CENTER
y: 80
height: 50
width: 50
spin_time: 1s
arc_length: 60deg
arc_width: 8
arc_rounded: true
bg_color: 0xfcfcfc
indicator:
arc_color: 0x18bcf2
arc_width: 8
pages:
- id: main_page
bg_color: 0x000000
widgets:
- obj:
height: 240
width: 240
align: CENTER
bg_color: 0x000000
border_width: 0
pad_all: 4
widgets:
- meter:
height: 100%
width: 100%
border_width: 0
bg_opa: TRANSP
align: CENTER
scales:
- range_from: -10
range_to: 10
angle_range: 180 # sets the total angle to 180 = starts mid left and ends mid right
ticks:
count: 0
indicators:
- line:
id: val_needle
width: 8
r_mod: 12 # sets line length by this much difference from the scale default radius
value: -2
- arc: # first half of the scale background
color: 0xFF3000
r_mod: 10 # radius difference from the scale default radius
width: 31
start_value: -10
end_value: 0
- arc: # second half of the scale background
color: 0x00FF00
r_mod: 10
width: 31
start_value: 0
end_value: 10
- obj: # to cover the middle part of meter indicator line
height: 146
width: 146
radius: 73
align: CENTER
border_width: 0
bg_color: 0x000000
pad_all: 0
- label: # gauge numeric indicator
id: val_text
text_font: montserrat_48
align: CENTER
y: -5
text: "0"
- label: # lower range indicator
text_font: montserrat_18
align: CENTER
y: 8
x: -90
text: "-10"
- label: # higher range indicator
text_font: montserrat_18
align: CENTER
y: 8
x: 90
text: "+10"
wifi_ssid: MyWifiSsid
wifi_password: MyWifiPassword
ota_password: MyOtaPassword
api_password: MyApiPassword
domain: mydomain.lan
timezone: Europe/Berlin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment