tjhorner / esphome-standing-desk

68 stars 22 forks source link

Desk doesn't raise/lower to setpoint in one shot #2

Closed bachya closed 2 years ago

bachya commented 2 years ago

I have the following config for an ESPHome 2022.8.3 device:

---
packages:
  standing_desk: github://tjhorner/esphome-standing-desk/configs/template.yaml
  desk_config: github://tjhorner/esphome-standing-desk/configs/desks/uplift_v2.yaml
  device_base: !include common/device_base.yaml

substitutions:
  device_name: basement-upsy-desky
  device_friendly_name: Basement Upsy Desky
  device_static_ip: 172.16.20.222
  standing_desk_min_height: "24.5"
  standing_desk_max_height: "50.0"

esphome:
  platform: ESP8266
  board: d1_mini

...with common/device_base.yaml containing:

---
api:
  encryption:
    key: !secret api_encryption_key
  password: !secret api_password

binary_sensor:
  - name: ${device_friendly_name} Status
    platform: status

button:
  - platform: restart
    name: ${device_friendly_name} Restart

captive_portal:

esphome:
  name: ${device_name}

logger: null

ota: null

text_sensor:
  - lambda: |-
      auto state = id(esphome_version).state;
      return state.substr(0, state.find(' '));
    name: "${device_friendly_name}: ESPHome Version (Short)"
    platform: template

  - id: esphome_version
    name: "${device_friendly_name}: ESPHome Version"
    platform: version

wifi:
  ap:
    ssid: ${device_name}
    password: !secret wifi_password

  manual_ip:
    gateway: 172.16.20.1
    static_ip: ${device_static_ip}
    subnet: 255.255.255.0
  ssid: !secret wifi_ssid
  password: !secret wifi_password

This firmware worked great for a long time, but with ESPHome 2022.8.3 (I think), I now run into a problem: when I attempt to raise/lower the desk beyond a certain, indeterminate point, the desk stops short of the target height. Another "nudge" is needed to get there:

CleanShot 2022-09-14 at 12 37 13

In the above GIF, you can see me attempting to raise the desk, then lower it (both actions require 2 bumps of the number entity).

Here are my ESPHome logs during these actions:

[12:37:20][D][number:054]: 'Target Desk Height' - Setting number value
[12:37:20][D][number:113]:   New number value: 47.200001
[12:37:20][D][number:012]: 'Target Desk Height': Sending state 47.200001
[12:37:20][D][sensor:126]: 'Desk Height': Sending state 29.30000 in with 1 decimals of accuracy
[12:37:21][D][sensor:126]: 'Desk Height': Sending state 30.00000 in with 1 decimals of accuracy
[12:37:21][D][sensor:126]: 'Desk Height': Sending state 30.70000 in with 1 decimals of accuracy
[12:37:22][D][sensor:126]: 'Desk Height': Sending state 31.40000 in with 1 decimals of accuracy
[12:37:22][D][sensor:126]: 'Desk Height': Sending state 32.10000 in with 1 decimals of accuracy
[12:37:23][D][sensor:126]: 'Desk Height': Sending state 32.80000 in with 1 decimals of accuracy
[12:37:23][D][sensor:126]: 'Desk Height': Sending state 33.50000 in with 1 decimals of accuracy
[12:37:24][D][sensor:126]: 'Desk Height': Sending state 34.20000 in with 1 decimals of accuracy
[12:37:24][D][sensor:126]: 'Desk Height': Sending state 34.90000 in with 1 decimals of accuracy
[12:37:25][D][sensor:126]: 'Desk Height': Sending state 35.60000 in with 1 decimals of accuracy
[12:37:25][D][sensor:126]: 'Desk Height': Sending state 36.30000 in with 1 decimals of accuracy
[12:37:26][D][sensor:126]: 'Desk Height': Sending state 37.00000 in with 1 decimals of accuracy
[12:37:26][D][sensor:126]: 'Desk Height': Sending state 37.70000 in with 1 decimals of accuracy
[12:37:27][D][sensor:126]: 'Desk Height': Sending state 38.40000 in with 1 decimals of accuracy
[12:37:27][D][sensor:126]: 'Desk Height': Sending state 39.10000 in with 1 decimals of accuracy
[12:37:28][D][sensor:126]: 'Desk Height': Sending state 39.80000 in with 1 decimals of accuracy
[12:37:28][D][sensor:126]: 'Desk Height': Sending state 40.50000 in with 1 decimals of accuracy
[12:37:29][D][sensor:126]: 'Desk Height': Sending state 41.20000 in with 1 decimals of accuracy
[12:37:29][D][sensor:126]: 'Desk Height': Sending state 41.80000 in with 1 decimals of accuracy
[12:37:30][D][sensor:126]: 'Desk Height': Sending state 42.60000 in with 1 decimals of accuracy
[12:37:30][D][sensor:126]: 'Desk Height': Sending state 43.00000 in with 1 decimals of accuracy
[12:37:34][D][number:054]: 'Target Desk Height' - Setting number value
[12:37:34][D][number:113]:   New number value: 47.200001
[12:37:34][D][number:012]: 'Target Desk Height': Sending state 47.200001
[12:37:34][D][sensor:126]: 'Desk Height': Sending state 43.10000 in with 1 decimals of accuracy
[12:37:35][D][sensor:126]: 'Desk Height': Sending state 43.70000 in with 1 decimals of accuracy
[12:37:35][D][sensor:126]: 'Desk Height': Sending state 44.40000 in with 1 decimals of accuracy
[12:37:36][D][sensor:126]: 'Desk Height': Sending state 45.10000 in with 1 decimals of accuracy
[12:37:36][D][sensor:126]: 'Desk Height': Sending state 45.90000 in with 1 decimals of accuracy
[12:37:37][D][sensor:126]: 'Desk Height': Sending state 46.50000 in with 1 decimals of accuracy
[12:37:37][D][sensor:126]: 'Desk Height': Sending state 47.20000 in with 1 decimals of accuracy
[12:37:38][D][sensor:126]: 'Desk Height': Sending state 47.30000 in with 1 decimals of accuracy
[12:37:43][D][number:054]: 'Target Desk Height' - Setting number value
[12:37:43][D][number:113]:   New number value: 29.100000
[12:37:43][D][number:012]: 'Target Desk Height': Sending state 29.100000
[12:37:44][D][sensor:126]: 'Desk Height': Sending state 46.80000 in with 1 decimals of accuracy
[12:37:44][D][sensor:126]: 'Desk Height': Sending state 46.10000 in with 1 decimals of accuracy
[12:37:45][D][sensor:126]: 'Desk Height': Sending state 45.40000 in with 1 decimals of accuracy
[12:37:45][D][sensor:126]: 'Desk Height': Sending state 44.70000 in with 1 decimals of accuracy
[12:37:46][D][sensor:126]: 'Desk Height': Sending state 44.00000 in with 1 decimals of accuracy
[12:37:46][D][sensor:126]: 'Desk Height': Sending state 43.30000 in with 1 decimals of accuracy
[12:37:47][D][sensor:126]: 'Desk Height': Sending state 42.60000 in with 1 decimals of accuracy
[12:37:47][D][sensor:126]: 'Desk Height': Sending state 41.90000 in with 1 decimals of accuracy
[12:37:48][D][sensor:126]: 'Desk Height': Sending state 41.20000 in with 1 decimals of accuracy
[12:37:48][D][sensor:126]: 'Desk Height': Sending state 40.50000 in with 1 decimals of accuracy
[12:37:49][D][sensor:126]: 'Desk Height': Sending state 39.80000 in with 1 decimals of accuracy
[12:37:49][D][sensor:126]: 'Desk Height': Sending state 39.10000 in with 1 decimals of accuracy
[12:37:50][D][sensor:126]: 'Desk Height': Sending state 38.40000 in with 1 decimals of accuracy
[12:37:50][D][sensor:126]: 'Desk Height': Sending state 37.70000 in with 1 decimals of accuracy
[12:37:52][D][sensor:126]: 'Desk Height': Sending state 37.00000 in with 1 decimals of accuracy
[12:37:52][D][sensor:126]: 'Desk Height': Sending state 36.30000 in with 1 decimals of accuracy
[12:37:52][D][sensor:126]: 'Desk Height': Sending state 35.50000 in with 1 decimals of accuracy
[12:37:52][D][sensor:126]: 'Desk Height': Sending state 34.90000 in with 1 decimals of accuracy
[12:37:53][D][sensor:126]: 'Desk Height': Sending state 34.20000 in with 1 decimals of accuracy
[12:37:53][D][sensor:126]: 'Desk Height': Sending state 33.50000 in with 1 decimals of accuracy
[12:37:54][D][sensor:126]: 'Desk Height': Sending state 33.30000 in with 1 decimals of accuracy
[12:37:58][D][number:054]: 'Target Desk Height' - Setting number value
[12:37:58][D][number:113]:   New number value: 29.100000
[12:37:58][D][number:012]: 'Target Desk Height': Sending state 29.100000
[12:37:58][D][sensor:126]: 'Desk Height': Sending state 33.20000 in with 1 decimals of accuracy
[12:37:59][D][sensor:126]: 'Desk Height': Sending state 32.70000 in with 1 decimals of accuracy
[12:37:59][D][sensor:126]: 'Desk Height': Sending state 32.00000 in with 1 decimals of accuracy
[12:38:00][D][sensor:126]: 'Desk Height': Sending state 31.30000 in with 1 decimals of accuracy
[12:38:00][D][sensor:126]: 'Desk Height': Sending state 30.70000 in with 1 decimals of accuracy
[12:38:01][D][sensor:126]: 'Desk Height': Sending state 29.90000 in with 1 decimals of accuracy
[12:38:01][D][sensor:126]: 'Desk Height': Sending state 29.20000 in with 1 decimals of accuracy
[12:38:02][D][sensor:126]: 'Desk Height': Sending state 29.10000 in with 1 decimals of accuracy
tjhorner commented 2 years ago

@Trinnik was able to get to the bottom of this issue. The timeout for setting the desk height (used to avoid "pressing" either the up or down button forever if the desk stops) is a bit too low. I will increase it to 20 in the next version of the Upsy Desky firmware, and update this repo shortly.

bachya commented 2 years ago

Just deployed a new firmware with https://github.com/tjhorner/esphome-standing-desk/commit/34c00a37e461394df0b46b8da90f7a8250253c93 and everything works again! Thanks for the support!