This commit is contained in:
TJ Horner
2023-02-25 12:15:27 -08:00
parent 16792d6954
commit 273dd62d9a
9 changed files with 149 additions and 86 deletions

View File

@@ -20,7 +20,7 @@ jobs:
- name: Compile Release Firmware
working-directory: firmware
run: |
esphome compile config.yaml
esphome compile stock.yaml
mkdir -p bin
cp .esphome/build/upsy-desky/.pioenvs/upsy-desky/firmware-factory.bin bin/firmware-factory.bin
cp .esphome/build/upsy-desky/.pioenvs/upsy-desky/firmware.bin bin/firmware.bin

16
firmware/README.md Normal file
View File

@@ -0,0 +1,16 @@
# Firmware Configs
This directory contains [ESPHome](https://esphome.io) config files for the Upsy Desky.
It is organized like so:
- `base.yaml`: The base essential configuration, which contains components for reading the desk height, preset buttons, etc.
- `stock.yaml`: Inherits everything from `base.yaml` and adds components which are useful on stock firmware, such as the WiFi hotspot, web server, and Improv Serial
- `debug.yaml`: Inherits everything from `stock.yaml` and adds components which are useful for debugging
## Addons
Major parts of the config are separated into "addons" so they can be easily included or excluded. The following addons are available:
- `presets.yaml`: Adds support for recalling and setting presets on the desk control box
- `runtime-config.yaml`: Adds support for runtime configuration options (you might want to remove this if you are configuring everything via ESPHome yaml)

View File

@@ -0,0 +1,35 @@
# This file provides stable entity IDs for various components, in order to be used in the HTTP API.
# ESPHome derives entity IDs (internally called "object IDs") from the component name, which is
# used as the ID in the HTTP API endpoints. Unfortunately there is no way to control them so they
# are set independently of the name, so this is a weird workaround for that.
sensor:
- platform: copy
source_id: desk_height
internal: true
name: "desk_height"
number:
- platform: copy
source_id: target_desk_height
internal: true
name: "target_desk_height"
button:
- platform: copy
source_id: recall_preset_1
internal: true
name: "preset_1"
- platform: copy
source_id: recall_preset_2
internal: true
name: "preset_2"
- platform: copy
source_id: recall_preset_3
internal: true
name: "preset_3"
- platform: copy
source_id: recall_preset_4
internal: true
name: "preset_4"

68
firmware/base.yaml Normal file
View File

@@ -0,0 +1,68 @@
# Essential ESPHome config options
esphome:
name: "${name}"
name_add_mac_suffix: true
on_boot:
then:
# Wakes up the desk and reports height
- uart.write:
id: handset_tx
data: [ 0x0 ]
project:
name: tj_horner.upsy_desky
version: "0.3.1"
uart:
id: handset_tx
tx_pin: 16
baud_rate: 9600
esp32:
board: esp32dev
# Configurable options
substitutions:
name: "upsy-desky"
friendly_name: "Upsy Desky"
desk_height_name: "${friendly_name} Desk Height"
target_desk_height_name: "${friendly_name} Target Desk Height"
# Standing Desk Component Config
standing_desk_uart_rx_pin: "17"
standing_desk_up_pin: "21"
standing_desk_down_pin: "22"
standing_desk_variant: "uplift"
standing_desk_min_height: "25.2"
standing_desk_max_height: "50.8"
# Presets Addon Config
button_bit1_pin: "21"
button_bit2_pin: "22"
button_bit4_pin: "19"
button_m_pin: "18"
# Runtime Config Defaults
default_height_units: "in" # Must be "in" or "cm"
packages:
standing_desk: github://tjhorner/esphome-standing-desk/configs/template.yaml@master
addon_presets: !include addons/presets.yaml
addon_stable_ids: !include addons/stable-ids.yaml
addon_runtime_config: !include addons/runtime-config.yaml
button:
- platform: restart
name: "${friendly_name} Restart"
light:
- platform: status_led
id: upsy_desky_status_led
name: "${friendly_name} Status LED"
pin: GPIO23
restore_mode: RESTORE_DEFAULT_ON
# Everything below this line is mostly for the benefit of the stock firmware
# and the
dashboard_import:
package_import_url: github://tjhorner/upsy-desky/firmware/base.yaml@v0.3.1
import_full_config: true

View File

@@ -1,87 +1,8 @@
# Essential ESPHome config options
esphome:
name: "${name}"
name_add_mac_suffix: true
on_boot:
then:
# Wakes up the desk and reports height
- uart.write:
id: handset_tx
data: [ 0x0 ]
project:
name: tj_horner.upsy_desky
version: "0.3.0"
# This file is here for reverse compatibility. Older versions of the firmware
# pointed to `config.yaml` instead of `base.yaml`. That file also included the
# config found in `stock.yaml`, which is why it's being included here.
uart:
id: handset_tx
tx_pin: 16
baud_rate: 9600
esp32:
board: esp32dev
# Configurable options
substitutions:
name: "upsy-desky"
friendly_name: "Upsy Desky"
desk_height_name: "${friendly_name} Desk Height"
target_desk_height_name: "${friendly_name} Target Desk Height"
# Standing Desk Component Config
standing_desk_uart_rx_pin: "17"
standing_desk_up_pin: "21"
standing_desk_down_pin: "22"
standing_desk_variant: "uplift"
standing_desk_min_height: "25.2"
standing_desk_max_height: "50.8"
# Presets Addon Config
button_bit1_pin: "21"
button_bit2_pin: "22"
button_bit4_pin: "19"
button_m_pin: "18"
# Runtime Config Defaults
default_height_units: "in" # Must be "in" or "cm"
# Please use `base.yaml` for new configurations and customizations.
packages:
standing_desk: github://tjhorner/esphome-standing-desk/configs/template.yaml@master
addon_presets: !include addons/presets.yml
addon_runtime_config: !include addons/runtime-config.yml
button:
- platform: restart
name: "${friendly_name} Restart"
light:
- platform: status_led
id: upsy_desky_status_led
name: "${friendly_name} Status LED"
pin: GPIO23
restore_mode: RESTORE_DEFAULT_ON
# Everything below this line is mostly for the benefit of the stock firmware
# and the
dashboard_import:
package_import_url: github://tjhorner/upsy-desky/firmware/config.yaml
logger:
level: INFO
wifi:
ap:
password: "hunter2hunter2"
captive_portal:
improv_serial:
api:
password: ""
reboot_timeout: 0s
web_server:
port: 80
ota:
password: ""
stock: !include stock.yaml

View File

@@ -1,5 +1,5 @@
packages:
base: !include config.yaml
stock: !include stock.yaml
logger:
level: DEBUG

23
firmware/stock.yaml Normal file
View File

@@ -0,0 +1,23 @@
packages:
base: !include base.yaml
logger:
level: INFO
wifi:
ap:
password: "hunter2hunter2"
captive_portal:
improv_serial:
api:
password: ""
reboot_timeout: 0s
web_server:
port: 80
ota:
password: ""