New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New 'Duty Time' sensor component #5069
Conversation
Hey there @dudanov, CODEOWNERS = ["@dudanov"] And run (message by NeedsCodeownersLabel) |
cd13cfa
to
2dad680
Compare
2dad680
to
bca16ab
Compare
Sound an interesting addition. Can be useful for example to build a kind of "historical stats" if you can add a "period" field to compute the ratio. More adding an action to "reset" the sensor would be great too |
What does this implement/fix?
The component
Duty Time
is used to calculate the operating time of something, for example, a light bulb inseconds
.It is configured by one of the logical sources: a
binary_sensor
or alambda
function.The main loop checks the source for a change in the input signal. The auxiliary interval loop
update()
of thePollingComponent
class periodically updates the sensor.If necessary, it is possible to add an auxiliary sensor to record the time of the last switch-on.
Types of changes
Related issue or feature (if applicable): fixes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3049
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: