Skip to content

Commit

Permalink
Add example for HS01B-1 and updated README files.
Browse files Browse the repository at this point in the history
  • Loading branch information
staxDB committed Apr 5, 2021
1 parent d2022aa commit 8cebf6d
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 30 deletions.
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,33 @@ If your control panel is missing, feel free to [create an issue](https://github.
- **Tested with control box**: CB38M2B(IB)-1
- **Source**: Printed on the PCB of the control box.

| RJ45 pin | Name | Cable Color |
| -------- | ---------- | ----------- |
| 8 | RESET SWIM | Brown |
| 7 | PIN 20 | White |
| 6 | RX | Purple |
| 5 | TX | Red |
| 4 | GND1 | Green |
| 3 | +5V (VDD) | Black |
| 2 | 29V+ | Blue |
| 1 | 29V- | Yellow |
| RJ45 pin | Name | Original Cable Color | Ethernet cable color (T568B) |
| -------- | ---------- | -------------------- | ---------------------------- |
| 8 | RESET SWIM | Brown | White-Orange |
| 7 | PIN 20 | White | Orange |
| 6 | RX | Purple | White-Green |
| 5 | TX | Red | Blue |
| 4 | GND1 | Green | White-Blue |
| 3 | +5V (VDD) | Black | Green |
| 2 | 29V+ | Blue | White-Brown |
| 1 | 29V- | Yellow | Brown |

#### [HS01B-1](https://www.loctekmotion.com/shop/control-panel/hs05a-1/)

- **Desk model**: Flexispot E5B
- **Tested with control box**: unknown
- **Source**: [nv1t/standing-desk-interceptor](https://github.com/nv1t/standing-desk-interceptor)

| RJ45 pin | Name | Cable Color |
| -------- | --------- | ----------- |
| 8 | +5V (VDD) | Yellow |
| 7 | GND | Blue |
| 6 | TX | Black |
| 5 | RX | Green |
| 4 | PIN 20 | Red |
| 3 | (unknown) | Purple |
| 2 | SWIM | White |
| 1 | RES | Brown |

| RJ45 pin | Name | Original Cable Color | Ethernet cable color (T568B) |
| -------- | --------- | --------------------- | ---------------------------- |
| 8 | +5V (VDD) | Yellow | Brown |
| 7 | GND | Blue | White-Brown |
| 6 | TX | Black | Green |
| 5 | RX | Green | White-Blue |
| 4 | PIN 20 | Red | Blue |
| 3 | (unknown) | Purple | White-Green |
| 2 | SWIM | White | Orange |
| 1 | RES | Brown | White-Orange |

Other control panels / control boxes could be supported in the same way, but you would need to figure the RJ45 pinout mapping. Most control boxes have an extra RJ45 port for serial communication, but otherwise you would need to place your device in between the control panel and the control box.

Expand Down
37 changes: 28 additions & 9 deletions packages/esphome/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@

>ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
| ESP8266 | Loctek Motion |
| ------- | ------------- |
| GND | GND |
| D6 | RX |
| D5 | TX |
| D2 | PIN 20 |

See [README](../../README.md#control-panels) for more details. If your board supports a 5V input, you could use the 5V provided by the control box to power your controller as well.
## [HS13A-1](https://www.loctekmotion.com/shop/control-panel/hs13a-1/)

| ESP8266 | Loctek Motion (HS13A-1) | Loctek Motion Cable Color (HS13A-1)|
| ------- | ----------------------- | ---------------------------------- |
| GND | GND | Green |
| D6 | RX | Purple |
| D5 | TX | Red |
| D2 | PIN 20 | White |

## [HS01B-1](https://www.loctekmotion.com/shop/control-panel/hs05a-1/)

| ESP8266 | Loctek Motion (HS01B-1) | Loctek Motion Cable Color (HS01B-1)|
| ------- | ----------------------- | ---------------------------------- |
| GND | GND | Blue |
| D6 | RX | Green |
| D5 | TX | Black |
| D2 | PIN 20 | Red |

See [README](../../README.md#control-panels) for more details. If your board supports a 5V input, you could use the 5V provided by the control box to power your controller as well:

| ESP8266 | Loctek Motion (HS13A-1) | Loctek Motion (HS01B-1) |
| ------- | ----------------------- | ----------------------- |
| GND | GND | GND |
| D6 | RX | RX |
| D5 | TX | TX |
| D2 | PIN 20 | PIN 20 |
| VIN | +5V (VDD) | +5V (VDD) |

## Installation

Please refer to the [ESPHome documentation](https://esphome.io/guides/getting_started_command_line.html).

You can use `flexispot_ek5.yaml` 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)* 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

Expand Down
154 changes: 154 additions & 0 deletions packages/esphome/flexispot_e5b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
substitutions:
device_name: Flexispot E5B
name: flexispot_e5b
min_height: "73.6" # Min height + 0.1
max_height: "122.9" # Max height - 0.1

esphome:
name: ${name}
comment: ${device_name}
platform: ESP8266 # TODO Change to your platform
board: nodemcuv2 # 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: D5
rx_pin: D6

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"

switch:
- platform: gpio
name: "Virtual Screen"
pin:
number: D2
mode: OUTPUT
restore_mode: ALWAYS_ON
internal: true

- platform: uart
name: "Preset 1"
id: switch_preset1
icon: mdi:numeric-1-box
data: [0x9b, 0x06, 0x02, 0x04, 0x00, 0xac, 0xa3, 0x9d]
uart_id: desk_uart

- platform: uart
name: "Preset 2"
id: switch_preset2
icon: mdi:numeric-2-box
data: [0x9b, 0x06, 0x02, 0x08, 0x00, 0xac, 0xa6, 0x9d]
uart_id: desk_uart

- platform: uart
name: "Preset 3"
id: switch_preset3
icon: mdi:numeric-3-box
data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d]
uart_id: desk_uart

- 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: true

- 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: true

- platform: uart
name: "M"
id: switch_m
icon: mdi:alpha-m-circle
data: [0x9b, 0x06, 0x02, 0x00, 0xac, 0xac, 0xb8, 0x9d]
uart_id: desk_uart

- 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
# icon: mdi:table-chair
# icon: mdi-human-male-height-variant
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

0 comments on commit 8cebf6d

Please sign in to comment.