mirror of
https://github.com/tjhorner/upsy-desky.git
synced 2026-01-09 15:37:54 -05:00
Firmware 0.3.0
This commit is contained in:
105
firmware/addons/presets.yml
Normal file
105
firmware/addons/presets.yml
Normal file
@@ -0,0 +1,105 @@
|
||||
output:
|
||||
- platform: gpio
|
||||
inverted: true
|
||||
id: button_bit1
|
||||
pin: ${button_bit1_pin}
|
||||
|
||||
- platform: gpio
|
||||
inverted: true
|
||||
id: button_bit2
|
||||
pin: ${button_bit2_pin}
|
||||
|
||||
- platform: gpio
|
||||
inverted: true
|
||||
id: button_bit4
|
||||
pin: ${button_bit4_pin}
|
||||
|
||||
- platform: gpio
|
||||
inverted: true
|
||||
id: button_m
|
||||
pin: ${button_m_pin}
|
||||
|
||||
button:
|
||||
# Recall Presets
|
||||
- platform: template
|
||||
id: recall_preset_1
|
||||
name: "${friendly_name} Preset 1"
|
||||
icon: "mdi:numeric-1-box"
|
||||
on_press:
|
||||
- output.turn_on: button_bit1
|
||||
- output.turn_on: button_bit2
|
||||
- delay: 1s
|
||||
- output.turn_off: button_bit2
|
||||
- output.turn_off: button_bit1
|
||||
|
||||
- platform: template
|
||||
id: recall_preset_2
|
||||
name: "${friendly_name} Preset 2"
|
||||
icon: "mdi:numeric-2-box"
|
||||
on_press:
|
||||
- output.turn_on: button_bit4
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_bit4
|
||||
|
||||
- platform: template
|
||||
id: recall_preset_3
|
||||
name: "${friendly_name} Preset 3"
|
||||
icon: "mdi:numeric-3-box"
|
||||
on_press:
|
||||
- output.turn_on: button_bit2
|
||||
- output.turn_on: button_bit4
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_bit4
|
||||
- output.turn_off: button_bit2
|
||||
|
||||
- platform: template
|
||||
id: recall_preset_4
|
||||
name: "${friendly_name} Preset 4"
|
||||
icon: "mdi:numeric-4-box"
|
||||
on_press:
|
||||
- output.turn_on: button_bit4
|
||||
- output.turn_on: button_bit1
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_bit1
|
||||
- output.turn_off: button_bit4
|
||||
|
||||
# Set Presets
|
||||
- platform: template
|
||||
name: "${friendly_name} Set Preset 1"
|
||||
entity_category: "config"
|
||||
icon: "mdi:numeric-1-box-multiple"
|
||||
on_press:
|
||||
- output.turn_on: button_m
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_m
|
||||
- button.press: recall_preset_1
|
||||
|
||||
- platform: template
|
||||
name: "${friendly_name} Set Preset 2"
|
||||
entity_category: "config"
|
||||
icon: "mdi:numeric-2-box-multiple"
|
||||
on_press:
|
||||
- output.turn_on: button_m
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_m
|
||||
- button.press: recall_preset_2
|
||||
|
||||
- platform: template
|
||||
name: "${friendly_name} Set Preset 3"
|
||||
entity_category: "config"
|
||||
icon: "mdi:numeric-3-box-multiple"
|
||||
on_press:
|
||||
- output.turn_on: button_m
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_m
|
||||
- button.press: recall_preset_3
|
||||
|
||||
- platform: template
|
||||
name: "${friendly_name} Set Preset 4"
|
||||
entity_category: "config"
|
||||
icon: "mdi:numeric-4-box-multiple"
|
||||
on_press:
|
||||
- output.turn_on: button_m
|
||||
- delay: 100ms
|
||||
- output.turn_off: button_m
|
||||
- button.press: recall_preset_4
|
||||
56
firmware/addons/runtime-config.yml
Normal file
56
firmware/addons/runtime-config.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
select:
|
||||
- platform: template
|
||||
name: "${friendly_name} Height Decoder Variant"
|
||||
entity_category: "config"
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
options:
|
||||
- uplift
|
||||
- jarvis
|
||||
- omnidesk
|
||||
initial_option: ${standing_desk_variant}
|
||||
on_value:
|
||||
then:
|
||||
lambda: "id(desk_height)->set_decoder_variant(x);"
|
||||
- platform: template
|
||||
name: "${friendly_name} Height Units"
|
||||
entity_category: "config"
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
options:
|
||||
- in
|
||||
- cm
|
||||
initial_option: ${default_height_units}
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(desk_height)->set_unit_of_measurement(x);
|
||||
id(target_desk_height)->traits.set_unit_of_measurement(x);
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
name: "${friendly_name} Min Target Height"
|
||||
entity_category: "config"
|
||||
min_value: 0
|
||||
max_value: 150
|
||||
step: 0.1
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: ${standing_desk_min_height}
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(target_desk_height)->traits.set_min_value(x);
|
||||
- platform: template
|
||||
name: "${friendly_name} Max Target Height"
|
||||
entity_category: "config"
|
||||
min_value: 0
|
||||
max_value: 150
|
||||
step: 0.1
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: ${standing_desk_max_height}
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(target_desk_height)->traits.set_max_value(x);
|
||||
@@ -1,21 +1,4 @@
|
||||
substitutions:
|
||||
name: "upsy-desky"
|
||||
friendly_name: "Upsy Desky"
|
||||
|
||||
# Defaults
|
||||
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
|
||||
button_bit1_pin: "21"
|
||||
button_bit2_pin: "22"
|
||||
button_bit4_pin: "19"
|
||||
button_m_pin: "18"
|
||||
|
||||
# Essential ESPHome config options
|
||||
esphome:
|
||||
name: "${name}"
|
||||
name_add_mac_suffix: true
|
||||
@@ -27,10 +10,7 @@ esphome:
|
||||
data: [ 0x0 ]
|
||||
project:
|
||||
name: tj_horner.upsy_desky
|
||||
version: "0.2.1"
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://tjhorner/upsy-desky/firmware/config.yaml
|
||||
version: "0.3.0"
|
||||
|
||||
uart:
|
||||
id: handset_tx
|
||||
@@ -40,6 +20,51 @@ uart:
|
||||
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.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
|
||||
|
||||
@@ -60,74 +85,3 @@ web_server:
|
||||
|
||||
ota:
|
||||
password: ""
|
||||
|
||||
packages:
|
||||
standing_desk: github://tjhorner/esphome-standing-desk/configs/template.yaml@master
|
||||
presets_addon: github://tjhorner/esphome-standing-desk/configs/addons/presets.yaml@master
|
||||
|
||||
select:
|
||||
- platform: template
|
||||
name: "${friendly_name} Height Decoder Variant"
|
||||
entity_category: "config"
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
options:
|
||||
- uplift
|
||||
- jarvis
|
||||
- omnidesk
|
||||
initial_option: ${standing_desk_variant}
|
||||
on_value:
|
||||
then:
|
||||
lambda: "id(desk_height)->set_decoder_variant(x);"
|
||||
- platform: template
|
||||
name: "${friendly_name} Height Units"
|
||||
entity_category: "config"
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
options:
|
||||
- in
|
||||
- cm
|
||||
initial_option: in
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(desk_height)->set_unit_of_measurement(x);
|
||||
id(target_desk_height)->traits.set_unit_of_measurement(x);
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
name: "${friendly_name} Min Target Height"
|
||||
entity_category: "config"
|
||||
min_value: 0
|
||||
max_value: 150
|
||||
step: 0.1
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: ${standing_desk_min_height}
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(target_desk_height)->traits.set_min_value(x);
|
||||
- platform: template
|
||||
name: "${friendly_name} Max Target Height"
|
||||
entity_category: "config"
|
||||
min_value: 0
|
||||
max_value: 150
|
||||
step: 0.1
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
initial_value: ${standing_desk_max_height}
|
||||
on_value:
|
||||
then:
|
||||
lambda: |
|
||||
id(target_desk_height)->traits.set_max_value(x);
|
||||
|
||||
button:
|
||||
- platform: restart
|
||||
name: "${friendly_name} Restart"
|
||||
|
||||
light:
|
||||
- platform: status_led
|
||||
id: upsy_desky_status_led
|
||||
pin: GPIO23
|
||||
restore_mode: ALWAYS_ON
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"plot_directory": "./",
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"subpart_first_id": 65,
|
||||
|
||||
Reference in New Issue
Block a user