Giter VIP home page Giter VIP logo

Comments (6)

staxDB avatar staxDB commented on June 25, 2024 1

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

from loctekmotion_iot.

iMicknl avatar iMicknl commented on June 25, 2024 1

@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.

from loctekmotion_iot.

iMicknl avatar iMicknl commented on June 25, 2024

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.

from loctekmotion_iot.

lordfiSh avatar lordfiSh commented on June 25, 2024

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);
                                                                                                     ^

from loctekmotion_iot.

iMicknl avatar iMicknl commented on June 25, 2024

@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.

from loctekmotion_iot.

iMicknl avatar iMicknl commented on June 25, 2024

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

from loctekmotion_iot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.