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

[HS01B-1] None of the commands work #6

Closed
staxDB opened this issue Mar 28, 2021 · 6 comments
Closed

[HS01B-1] None of the commands work #6

staxDB opened this issue Mar 28, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@staxDB
Copy link
Contributor

staxDB commented Mar 28, 2021

Hey, damn cool project and just what I was looking for!

I am having a few issues in my setup though: I have been trying ,to control a flexispot desk remotely. Unfortunately none of the scenarios work.
I first tried the ESPHome solution and used an ESP8266. Since this did not work (or my desk did not respond at all), I still tried the variant with the Raspberry Pi - Unfortunately also unsuccessful. I even tried to execute the single "Up" command alone with a Python script, but the desk does not react to it.

Which setup I have: A Flexispot E5B with an HS01B-1 control unit and a CB38M2A-1 control module. I connected the Raspberry Pi and also the ESP8266 to the control module (CB38M2A-1) via a modified Ethernet cable. For the correct ethernet cable mapping I used this table as a guideline:
https://github.com/deskmatik/deskmatik#wiring-flexispot

Do you have any idea where I made a mistake? Is my control module possibly not compatible, since I also have only one Ethernet port?

@iMicknl
Copy link
Owner

iMicknl commented Mar 28, 2021

Have you tried reversing the TX / RX cables? This is very messy always and I had those reversed many many times during the development. The PIN20 is a very important one as well, since this allows you to send commands.

Could you perhaps share more here about how you configured the cables and how you set up the ESPHome yaml?

The Raspberry Pi code could use some love by the way, I just used this during the testing. The ESPHome code should work and this is what I am currently using.

Happy to walk through it on Discord as well, iMick#1903.

@iMicknl iMicknl added the bug Something isn't working label Mar 28, 2021
@iMicknl iMicknl changed the title None of the commands work. [HS01B-1] None of the commands work Mar 29, 2021
@lordfiSh
Copy link

lordfiSh commented Mar 31, 2021

Same Problem here, also tried to switch RX/TX
Used your Code and PINs

image
image

substitutions:
  device_name: Standing Desk
  name: esphome-desk
  min_height: "80" # 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 esphome_wlanssid
  password: !secret esphome_wlanpw 
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.121
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  
  ap:
    ssid: "${device_name} Fallback Hotspot"
    password: !secret esphome_web_pass


captive_portal:

# Enable logging
logger:
  #level: DEBUG
  baud_rate: 0

# Enable Home Assistant API
api:
  password: !secret esphome_ota

ota:
  password: !secret esphome_ota

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_OFF
    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: "Sit" # Preset 3 on some control panels
    id: switch_sit
    icon: mdi:chair-rolling
    data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d]
    uart_id: desk_uart

  - platform: uart
    name: "Stand" # Not available for all control panels
    id: switch_stand
    icon: mdi:human-handsup
    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, 0x20, 0x00, 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

May something about the two Warnings?

Compiling /data/esphome_desk/.pioenvs/esphome_desk/lib4d9/ESP8266WiFi/ESP8266WiFi.cpp.o
In file included from src/main.cpp:42:0:
src/desk_height_sensor.h:9:17: warning: converting to non-pointer type 'float' from NULL [-Wconversion-null]
   float value = NULL;
                 ^
				 
Compiling /data/esphome_desk/.pioenvs/esphome_desk/libe95/ESPAsyncWebServer-esphome/WebHandlers.cpp.o
In file included from /data/esphome_desk/.piolibdeps/esphome_desk/ESPAsyncWebServer-esphome/src/SPIFFSEditor.cpp:1:0:
/data/esphome_desk/.piolibdeps/esphome_desk/ESPAsyncWebServer-esphome/src/SPIFFSEditor.h:16:101: warning: 'SPIFFS' is deprecated (declared at /root/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
     SPIFFSEditor(const String& username=String(), const String& password=String(), const fs::FS& fs=SPIFFS);
                                                                                                     ^

@iMicknl
Copy link
Owner

iMicknl commented Mar 31, 2021

@staxDB I just discussed this issue briefly with @lordfiSh and he is indeed facing similar issues. Looking at DeskMatic, it seems that they set the PIN20 to HIGH, where I use LOW.

Perhaps the following works;

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

Set restore_mode to ALWAYS_ON, or remove the internal and toggle it yourself during testing.

@staxDB
Copy link
Contributor Author

staxDB commented Apr 4, 2021

I just tried the customization: It seems to work! However, I have also changed the PIN assignment:
PIN20 = D5
RX = D7
TX = D8

@staxDB staxDB closed this as completed Apr 4, 2021
@iMicknl
Copy link
Owner

iMicknl commented Apr 4, 2021

@staxDB are you able to do a pull request on this repo to add better instructions for HS01B-1? I will investigate the ALWAYS_ON/ ALWAYS_OFF differences between our model and document that in a better way.

@iMicknl
Copy link
Owner

iMicknl commented Apr 5, 2021

Should be fixed with new ESPHome sample, thanks @staxDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants