Rocka84 / esphome_components

8 stars 2 forks source link

Response first after second command sent #4

Open WhippingBoy01 opened 4 months ago

WhippingBoy01 commented 4 months ago

Seems like i somehow have to "wake" the code with the first butten pressed. Then after first command i response to every button clik. but if wait 10-15 sec after last command i need to push twice again.

here is my code:

substitutions:
  name: esphome-mittzon
  friendly_name: mittzon

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'
  on_boot:
    # This script is required to initialize the following sensors:
    #    height_pct, height_min, height_max, position1 - position4
    # You can skip this if you don't use those.
    priority: 0 # when mostly everything else is done
    then:
      - lambda: "id(my_desk).request_physical_limits();"
      - delay: 0.1s # give controller a chance to handle the response before sending the next command
      - lambda: "id(my_desk).request_limits();"
      - delay: 0.1s
      - lambda: "id(my_desk).request_settings();"

external_components:
  - source:
      #type: local
      #path: rocka84_esphome_components/components/
      type: git
      url: https://github.com/Rocka84/esphome_components/
    components: [ jiecang_desk_controller ]

uart:
  id: uart_bus
  tx_pin: TX
  rx_pin: RX
  baud_rate: 9600

logger:
  baud_rate: 0 # disable logging over uart, required when using the RX/TX pins for the controller

jiecang_desk_controller:
  id: my_desk
  buttons:
    move_up:
      name: "Move up"
    move_down:
      name: "Move down"
    stop:
      name: "Stop"
    step_up:
      name: "Step up"
    step_down:
      name: "Step down"
    position1:
      name: "Position 1"
    position2:
      name: "Position 2"
    position3:
      name: "Position 3"
    position4:
      name: "Position 4"
  numbers:
    height:
      name: "Height"

esp8266:
  board: esp01_1m

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
  - platform: esphome

# Allow provisioning Wi-Fi via serial
#improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
  import_full_config: true

# To have a "next url" for improv serial
web_server:

I have tried with both simple and advanced code.

here is out put from the log.

[12:53:50][D][sensor:093]: 'Heap Max Block': Sending state 21088.00000 B with 0 decimals of accuracy [12:53:50][D][sensor:093]: 'Heap Fragmentation': Sending state 10.00000 % with 1 decimals of accuracy [12:53:54][D][button:010]: 'Step up' Pressed. [12:53:55][D][sensor:093]: 'Heap Free': Sending state 29720.00000 B with 0 decimals of accuracy [12:53:55][D][sensor:093]: 'Loop Time': Sending state 13.00000 ms with 0 decimals of accuracy [12:53:55][D][sensor:093]: 'Heap Max Block': Sending state 21088.00000 B with 0 decimals of accuracy [12:53:55][D][sensor:093]: 'Heap Fragmentation': Sending state 10.00000 % with 1 decimals of accuracy [12:53:56][D][button:010]: 'Step up' Pressed. [12:53:56][D][number:012]: 'Height': Sending state 83.500000 [12:53:56][D][number:012]: 'Height': Sending state 83.800003 [12:53:57][D][number:012]: 'Height': Sending state 84.400002 [12:53:57][D][number:012]: 'Height': Sending state 84.900002 [12:53:57][D][number:012]: 'Height': Sending state 85.000000 [12:54:00][D][sensor:093]: 'Heap Free': Sending state 29720.00000 B with 0 decimals of accuracy

Software versions and model 2024.6.3|Flash: 1024kB Speed:40MHz Mode:DOUT|Chip: 0x006546c7|SDK: 2.2.2-dev(38a443e)|Core: 3.1.2|Boot: 31|Mode: 1|CPU: 80|Flash: 0x00164020|Reset: Software/System restart|Software/System restart

Rocka84 commented 1 month ago

Hi @WhippingBoy01 Could you provide your config including indentations? Please use a code-block for that.

As is it is quit hard to read and I can't spot anything wrong.

Rocka84 commented 1 month ago

P.S.: Which control box do you have? If you're not sure you can compare yours to the ones here: https://www.jiecang.com/product/control-boxes.html