esphome / esphome/feature-requests
delayed_on_off: different on and off
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for delayed_on_off - https://github.com/esphome/esphome/pull/700
**Describe the problem you have/What new integration you would like**
Current syntax:
````
filters:
- delayed_on_off: 40s
````
Please, add ability to define different on and off time. For example, like this:
````
filters:
- delayed_on_off:
on: 5s
off: 30s
````
**Please describe your use case for this integration and alternatives you've tried:**
In one mode, my washing machine has power consumtion pattern like this (simplified for clear example):
> 10 seconds > 0W
> 20 seconds = 0W
> 10 seconds > 0W
> 20 seconds = 0W
> ...
And (!) from time to time there is very short random consumtion spikes, when machine don't work.
I want to make binary sensor "machine is on". So, I need short delay on filter (~5s) to ignore random spikes, but not more than 10s. And long (>20s) delay off filter.
In simplified example above, something like this can work (thanks to your explanation about pipeline - https://github.com/esphome/issues/issues/463):
````
filters:
- delay_on: 5
- delay_off: 25
````
But real power consumtion is more complex - in middle of working cycle there is periods (for a several minutes) like this:
> 2 seconds > 0W
> 20 seconds = 0W
So, in this period delay_on never pass "on", and after some time delay_off will be trigged.
But something like this totally solve my case:
````
filters:
- delayed_on_off:
on: 5s
off: 25s
````
Turn on when "on" condidion is done and _never_ turn off until off condition is done. Simple, clear logic. Equal to HA delay_on + delay_off.
Alternative solutions:
1. Send power consumtion to HA and create template binary sensor with delay_on and delay_off (it's pity - I can simple do it in HA, but can't in ESPHome).
2. In ESPHome create two sensors - one with delay_on and second with delay_off, and binary_sensor.template.publish from them to third binary sensor. Ugly :(
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue describes the existing delayed_on_off filter and compares it with delay_on and delay_off, but names no files or tests. Start by locating those filter implementations and their configuration parsing; done means separate on/off durations work as shown, while the existing single-duration syntax remains supported and both behaviors are tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100