esphome / esphome/issues

Sending the same setPosition to a time based cover cause it to move just slightly over and over again

Open
#1,061 10 comments 0 reactions 0 assignees View on GitHub
component: time_based not-stale
Dominant language
No language data
Stars
313
Forks
40
PR merge metrics
No merged PRs in 30d

Description

**Operating environment/Installation (Hass.io/Docker/pip/etc.):**

Home Assistant 105 in Docker. ESPHome 1.14.3 in Docker.

**ESP (ESP32/ESP8266, Board/Sonoff):**
Shelly 2.5 which is a ESP8266 with 2 Relays and 2 Inputs

**Affected component:**

https://esphome.io/components/cover/time_based.html

**Description of problem:**

When sending the same position the a time based cover (which is already at set position) then the cover moves up and down for a few ms. I think this is due to a rounding issue but not really sure.

Here is a video with sound of the issue: https://imgur.com/a/uMD320g

Possible fix would be to check if the moving action is <1 step and then just ignore it.

**Problem-relevant YAML-configuration entries:**
```yaml
binary_sensor:
- platform: gpio
pin: 5
id: open_button
on_press:
if:
condition:
lambda: 'return id(tb_cover).current_operation == COVER_OPERATION_IDLE;'
then:
cover.open: tb_cover
else:
cover.stop: tb_cover
- platform: gpio
pin: 13
id: close_button
on_press:
if:
condition:
lambda: 'return id(tb_cover).current_operation == COVER_OPERATION_IDLE;'
then:
cover.close: tb_cover
else:
cover.stop: tb_cover

cover:
- platform: time_based
name: "${friendly_name}"
device_class: shutter
id: tb_cover
open_action:
- switch.turn_on: open_switch
open_duration: 16.5s
close_action:
- switch.turn_on: close_switch
close_duration: 16s
stop_action:
- switch.turn_off: open_switch
- switch.turn_off: close_switch

switch:
- platform: gpio
pin: 4
id: open_switch
restore_mode: ALWAYS_OFF
interlock: &interlock_group [open_switch, close_switch]
- platform: gpio
pin: 15
id: close_switch
restore_mode: ALWAYS_OFF
interlock: *interlock_group

```

**Logs (if applicable):**

```
[22:31:31][D][cover:072]: 'Niklas Rolladen' - Setting
[22:31:31][D][cover:080]: Position: 25%
[22:31:31][D][switch:021]: 'close_switch' Turning ON.
[22:31:31][D][switch:045]: 'close_switch': Sending state ON
[22:31:31][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:31][D][cover:155]: Position: 25%
[22:31:31][D][cover:168]: Current Operation: CLOSING
[22:31:31][D][switch:025]: 'open_switch' Turning OFF.
[22:31:31][D][switch:025]: 'close_switch' Turning OFF.
[22:31:31][D][switch:045]: 'close_switch': Sending state OFF
[22:31:31][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:31][D][cover:155]: Position: 25%
[22:31:31][D][cover:168]: Current Operation: IDLE
[22:31:31][D][cover:072]: 'Niklas Rolladen' - Setting
[22:31:31][D][cover:080]: Position: 25%
[22:31:31][D][switch:021]: 'open_switch' Turning ON.
[22:31:31][D][switch:045]: 'open_switch': Sending state ON
[22:31:31][D][switch:025]: 'open_switch' Turning OFF.
[22:31:31][D][switch:045]: 'open_switch': Sending state OFF
[22:31:31][D][switch:025]: 'close_switch' Turning OFF.
[22:31:31][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:31][D][cover:155]: Position: 25%
[22:31:31][D][cover:168]: Current Operation: IDLE
[22:31:32][D][cover:072]: 'Niklas Rolladen' - Setting
[22:31:32][D][cover:080]: Position: 25%
[22:31:32][D][switch:021]: 'close_switch' Turning ON.
[22:31:32][D][switch:045]: 'close_switch': Sending state ON
[22:31:32][D][switch:025]: 'open_switch' Turning OFF.
[22:31:32][D][switch:025]: 'close_switch' Turning OFF.
[22:31:32][D][switch:045]: 'close_switch': Sending state OFF
[22:31:32][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:32][D][cover:155]: Position: 25%
[22:31:32][D][cover:168]: Current Operation: IDLE
[22:31:32][D][cover:072]: 'Niklas Rolladen' - Setting
[22:31:32][D][cover:080]: Position: 25%
[22:31:32][D][switch:021]: 'open_switch' Turning ON.
[22:31:32][D][switch:045]: 'open_switch': Sending state ON
[22:31:32][D][switch:025]: 'open_switch' Turning OFF.
[22:31:32][D][switch:045]: 'open_switch': Sending state OFF
[22:31:32][D][switch:025]: 'close_switch' Turning OFF.
[22:31:32][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:32][D][cover:155]: Position: 25%
[22:31:32][D][cover:168]: Current Operation: IDLE
[22:31:32][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:32][D][cover:155]: Position: 25%
[22:31:32][D][cover:168]: Current Operation: IDLE
[22:31:32][D][cover:072]: 'Niklas Rolladen' - Setting
[22:31:32][D][cover:080]: Position: 25%
[22:31:32][D][switch:021]: 'close_switch' Turning ON.
[22:31:32][D][switch:045]: 'close_switch': Sending state ON
[22:31:32][D][switch:025]: 'open_switch' Turning OFF.
[22:31:32][D][switch:025]: 'close_switch' Turning OFF.
[22:31:32][D][switch:045]: 'close_switch': Sending state OFF
[22:31:32][D][cover:152]: 'Niklas Rolladen' - Publishing:
[22:31:32][D][cover:155]: Position: 25%
[22:31:32][D][cover:168]: Current Operation: IDLE

```

**Additional information and things you've tried:**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.