From 6f206e1f1ed1e45ab7dfd76fea06cc020f0b12d2 Mon Sep 17 00:00:00 2001 From: MrTylerjet Date: Sat, 6 May 2023 22:24:29 -0600 Subject: [PATCH 1/4] Update README.md Flexispot E7 Working with ESP32 directly via GPIO to ethernet cable no passthrough/keypad method. --- packages/esphome/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/esphome/README.md b/packages/esphome/README.md index 4e4ba9d..52401de 100644 --- a/packages/esphome/README.md +++ b/packages/esphome/README.md @@ -11,6 +11,12 @@ | D5 | TX | Black | Green | | D2 | PIN 20 | Red | Blue | +| ESP32 | Loctek Controller (E7) | Loctek Motion Cable Color (HS13B-1)| +| ------- | ----------------------- | ---------------------------------- | +| GND | GND | Blue | +| GPIO16 | RX | Green | +| GPIO17 | TX | Black | +| GPIO23 | PIN 20 | Red | ## HS13A-1 @@ -71,7 +77,7 @@ You can use `flexispot_ek5.yaml` *(HS13A-1, HS13B-1)* or `flexispot_e5b.yaml` *( - Current height via sensor entity - M button via switch entity - Wake up button via switch entity (currently just used for testing, doesn't seem functional yet) -- Support for ESP32 (E5b only) +- Support for ESP32 (E5b & E7) - Support for keypad (E5b only) ## Screenshots From 15c39f207502480898a234d2279569bbbbf8a472 Mon Sep 17 00:00:00 2001 From: MrTylerjet Date: Sat, 6 May 2023 22:25:32 -0600 Subject: [PATCH 2/4] flexispot_e7.yaml addition --- packages/esphome/flexispot_e7.yaml | 217 +++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 packages/esphome/flexispot_e7.yaml diff --git a/packages/esphome/flexispot_e7.yaml b/packages/esphome/flexispot_e7.yaml new file mode 100644 index 0000000..19c923b --- /dev/null +++ b/packages/esphome/flexispot_e7.yaml @@ -0,0 +1,217 @@ +substitutions: + device_name: Flexispot E7 + name: flexispote7 + min_height: "73.6" # Min height + 0.1 + max_height: "122.9" # Max height - 0.1 + +esphome: + name: ${name} + comment: ${device_name} + platform: ESP32 # TODO Change to your platform + board: nodemcu-32s # TODO Change to your board + includes: + - desk_height_sensor.h + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "${device_name} Fallback Hotspot" + password: !secret ap_fallback_password + + +captive_portal: + +# Enable logging +logger: + #level: DEBUG + baud_rate: 0 + +# Enable Home Assistant API +api: + password: !secret ha_api_password + +ota: + password: !secret ha_api_password + +uart: + - id: desk_uart + baud_rate: 9600 + tx_pin: GPIO17 + rx_pin: GPIO16 + +script: + - id: screen_timer + mode: restart + then: + # on_start + - logger.log: "Executing screen timer command" + - switch.turn_on: virtual_screen + - delay: 12s # timer length (keypad screen timeout is 10s + 2s buffer) + - switch.turn_off: virtual_screen + # on_end + + - id: script_start_command + mode: restart + then: + - logger.log: "Executing Empty command" + - if: + condition: + switch.is_off : virtual_screen + then: + - script.execute: screen_timer + - delay: 480ms + else: + - script.execute: screen_timer + +sensor: + - platform: wifi_signal + name: "WiFi Signal" + update_interval: 60s + + - platform: uptime + name: Uptime + + - platform: custom + lambda: |- + auto desk_height_sensor = new DeskHeightSensor(id(desk_uart)); + App.register_component(desk_height_sensor); + return {desk_height_sensor}; + sensors: + id: "desk_height" + name: Desk Height + unit_of_measurement: cm + accuracy_decimals: 1 + icon: "mdi:counter" + on_value: + then: + - script.execute: screen_timer + +switch: + - platform: template + name: "Preset 1" + id: switch_preset1 + icon: mdi:numeric-1-box + turn_on_action: + - logger.log: "Executing Preset 1 command" + - script.execute: script_start_command + - script.wait: script_start_command + - uart.write: + id: desk_uart + data: [0x9b, 0x06, 0x02, 0x04, 0x00, 0xac, 0xa3, 0x9d] + internal: false + + - platform: template + name: "Preset 2" + id: switch_preset2 + icon: mdi:numeric-2-box + turn_on_action: + - logger.log: "Executing Preset 2 command" + - script.execute: script_start_command + - script.wait: script_start_command + - uart.write: + id: desk_uart + data: [0x9b, 0x06, 0x02, 0x08, 0x00, 0xac, 0xa6, 0x9d] + internal: false + + - platform: template + name: "Stand" + id: switch_preset3 + icon: mdi:numeric-3-box + turn_on_action: + - logger.log: "Executing Preset 3 command" + - script.execute: script_start_command + - script.wait: script_start_command + - uart.write: + id: desk_uart + data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d] + internal: false + + - platform: template + name: "Sit" + id: switch_preset4 + icon: mdi:numeric-4-box + turn_on_action: + - logger.log: "Executing Preset 4 command" + - script.execute: script_start_command + - script.wait: script_start_command + - uart.write: + id: desk_uart + data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d] + internal: false + + - platform: template + name: "M" + id: switch_m + icon: mdi:alpha-m-circle + turn_on_action: + - logger.log: "Executing M command" + - script.execute: script_start_command + - script.wait: script_start_command + - uart.write: + id: desk_uart + data: [0x9b, 0x06, 0x02, 0x20, 0x00, 0xac, 0xb8, 0x9d] + internal: false + + - platform: gpio # Does not seem to wake the screen as i would expect since its assigned to pin 20 that should give the singnal needed to wake the screen however the other actions already wake the screen as is so maybe not a big deal + name: "Virtual Screen" + id: "virtual_screen" + pin: + number: 23 + restore_mode: ALWAYS_OFF + internal: false + + - platform: uart + name: "Up" + id: switch_up + icon: mdi:arrow-up-bold + data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d] + uart_id: desk_uart + internal: false + + - platform: uart + name: "Down" + id: switch_down + icon: mdi:arrow-down-bold + data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d] + uart_id: desk_uart + internal: false + + # - platform: uart + # name: "(wake up)" # Not available on all control panels + # id: switch_wake_up + # icon: mdi:gesture-tap-button + # data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d] + # uart_id: desk_uart + +cover: + - platform: template + name: "Desk" + assumed_state: true + + # Move desk up + open_action: + - while: + condition: + sensor.in_range: + id: desk_height + below: ${max_height} + then: + - logger.log: "Executing up command" + - switch.turn_on: switch_up + - delay: 10ms + + # Move desk down + close_action: + - while: + condition: + sensor.in_range: + id: desk_height + above: ${min_height} + then: + - logger.log: "Executing down command" + - switch.turn_on: switch_down + - delay: 10ms + optimistic: true \ No newline at end of file From 6e344080b500bf25f50ba44cfdde1fa693c9ba14 Mon Sep 17 00:00:00 2001 From: MrTylerjet Date: Sat, 6 May 2023 22:27:11 -0600 Subject: [PATCH 3/4] Update README.md Added note for flexispot_e7.yaml --- packages/esphome/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/esphome/README.md b/packages/esphome/README.md index 52401de..a87d3cc 100644 --- a/packages/esphome/README.md +++ b/packages/esphome/README.md @@ -68,7 +68,7 @@ See [README](../../README.md#control-panels) for more details. If your board sup Please refer to the [ESPHome documentation](https://esphome.io/guides/getting_started_command_line.html). -You can use `flexispot_ek5.yaml` *(HS13A-1, HS13B-1)* or `flexispot_e5b.yaml` *(HS01B-1)* as a boilerplate for your own implementation. This implementation has been created for the ESP8266 nodemcu, but can easily be adopted for other platforms and boards. +You can use `flexispot_ek5.yaml` *(HS13A-1, HS13B-1)*/ `flexispot_e7.yaml` *(HS13B-1) ESP32* or `flexispot_e5b.yaml` *(HS01B-1)* as a boilerplate for your own implementation. This implementation has been created for the ESP8266 nodemcu, but can easily be adopted for other platforms and boards. ## Features From 3b3712d417d1939a42f24e93a3e694318a96a856 Mon Sep 17 00:00:00 2001 From: MrTylerjet Date: Sat, 6 May 2023 22:30:57 -0600 Subject: [PATCH 4/4] Update flexispot_e7.yaml --- packages/esphome/flexispot_e7.yaml | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/esphome/flexispot_e7.yaml b/packages/esphome/flexispot_e7.yaml index 19c923b..6c921a8 100644 --- a/packages/esphome/flexispot_e7.yaml +++ b/packages/esphome/flexispot_e7.yaml @@ -186,32 +186,32 @@ switch: # data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d] # uart_id: desk_uart -cover: - - platform: template - name: "Desk" - assumed_state: true - - # Move desk up - open_action: - - while: - condition: - sensor.in_range: - id: desk_height - below: ${max_height} - then: - - logger.log: "Executing up command" - - switch.turn_on: switch_up - - delay: 10ms +# cover: #Up Arrow does not work for some reason but still leaving in for others +# - platform: template +# name: "Desk" +# assumed_state: true + +# # Move desk up +# open_action: +# - while: +# condition: +# sensor.in_range: +# id: desk_height +# below: ${max_height} +# then: +# - logger.log: "Executing up command" +# - switch.turn_on: switch_up +# - delay: 10ms - # Move desk down - close_action: - - while: - condition: - sensor.in_range: - id: desk_height - above: ${min_height} - then: - - logger.log: "Executing down command" - - switch.turn_on: switch_down - - delay: 10ms - optimistic: true \ No newline at end of file +# # Move desk down +# close_action: +# - while: +# condition: +# sensor.in_range: +# id: desk_height +# above: ${min_height} +# then: +# - logger.log: "Executing down command" +# - switch.turn_on: switch_down +# - delay: 10ms +# optimistic: true