Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Preset 3 and 4 commands and add substitutions #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions packages/office-desk-esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ substitutions:
rx_pin: GPIO16 # RXD 2
screen_pin: GPIO23
encryption_key: "iOZqtvw31Yy6sasRl5h2DElG2VDlqW2WjJEKObVN8bg="
preset_1_name: "Preset 1"
preset_1_icon: "mdi:numeric-1-box"
preset_2_name: "Preset 2"
preset_2_icon: "mdi:numeric-2-box"
preset_3_name: "Preset 3"
preset_3_icon: "mdi:numeric-3-box"
preset_4_name: "Preset 4"
preset_4_icon: "mdi:numeric-4-box"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally prefer to keep these as sit/stand, because I think that's more common. If users want to change it to 3/4 then I think it's easier to infer those changes than to make the right changes for sit/stand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the HCB213A-1

I added them as substitutions to give users more flexibility which preset is associated with sit / stand as it might not always default to 3 and 4. The link for the different Loctek control panels seems to be dead but from the images I've seen, some panels only have presets 1-3.

I could add a commit so that preset 3 and 4 default to sit and stand respectively?

The substitutions result in a smaller config with more flexibility and less editing overall:

packages:
  remote_package: github://frenetic00/LoctekMotion_IoT/packages/office-desk-esp32.yaml
substitutions:
  device_name: Flexispot - Office Desk
  max_height: '100'
  min_height: '71'
  name: flexispot-office-desk
  preset_1_icon: mdi:chair-rolling
  preset_1_name: Sit
  preset_2_icon: mdi:human-handsup
  preset_2_name: Stand


external_components:
source: github://iMicknl/LoctekMotion_IoT
Expand Down Expand Up @@ -144,36 +152,36 @@ switch:

button:
- platform: template
name: "Preset 1"
icon: mdi:numeric-1-box
name: ${preset_1_name}
icon: ${preset_1_icon}
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x04, 0x00, 0xac, 0xa3, 0x9d]

- platform: template
name: "Preset 2"
icon: mdi:numeric-2-box
name: ${preset_2_name}
icon: ${preset_2_icon}
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x08, 0x00, 0xac, 0xa6, 0x9d]

- platform: template
name: "Sit" # Preset 3 on some control panels
icon: mdi:chair-rolling
name: ${preset_3_name} # Preset 3 on some control panels
Copy link
Contributor

@jamesmyatt jamesmyatt Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment should probably be "Stand preset on some control panels". And equivalent for 4 too.

icon: ${preset_3_icon}
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d]
data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d]

- platform: template
name: "Stand" # Preset 4 on some control panels
icon: mdi:human-handsup
name: ${preset_4_name} # Preset 4 on some control panels
icon: ${preset_4_icon}
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d]
data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d]

- platform: template
name: "Memory"
Expand Down