Skip to content
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

button with delayed ON or OFF actions #161

Closed
xoseperez opened this issue Jul 7, 2017 · 7 comments
Closed

button with delayed ON or OFF actions #161

xoseperez opened this issue Jul 7, 2017 · 7 comments
Labels
enhancement New feature or request minor relay

Comments

@xoseperez
Copy link
Owner

Originally reported by: Carlos (Bitbucket: cnieves1, GitHub: cnieves1)


Hi,
Attached is a diff showing how to implement a button with delayed on or off actions.
The main purpose is using it with a presence detector (delayed off). See Issue #123.

Please tell me what do you think about that.

Thanks,

Carlos

@xoseperez
Copy link
Owner Author

Looks neat. I will test it and maybe add a configuration code in the web interface...

@xoseperez
Copy link
Owner Author

Hi
I've been playing with your code a bit. There is something I'm not sure about. I think the delayed ON/OFF is actually a property of the relay, not the button.
I have a countrproposal, check it in the dev branch: https://bitbucket.org/xoseperez/espurna/commits/2d2a8a69a831f16c05a1bad90df913f4c4ff1dbf
Basically you define RELAY#_DELAY_ON and RELAY#_DELAY_OFF values for each relay you want (# being the relay number).

@xoseperez
Copy link
Owner Author

Original comment by Carlos (Bitbucket: cnieves1, GitHub: cnieves1):


Hi,
I looked at it (not tested), and it looks good.

Your thought about this being a relay property is also what I first thought.

I wanted this for a presence detector, so both ways will work.

What made me change my mind was thinking about more generic situations.
I thought two scenarios:

  • one, where a presence detector and a manual switch are connected. Usually the user will want an off delay for the presence detector, but will expect an instantaneous action when using the manual switch.
  • another, with a presence detector connected, the user switches the relay using mqtt or web interfaces. Usually, the user will expect again an instantaneous action using mqtt or web interfaces, but a delayed off action when using the presence detector.

In these two scenarios, having the delay as a switch property, the user will be able to configure it to do what he wants. It is just a matter of configuration.
If the delay is a relay property, he will not be able to do that...

That is why I preferred to have the delay as a button property instead of a relay property. That way it is more configurable and flexible, it can be configured to make more things...

Best regards,

Carlos

@xoseperez
Copy link
Owner Author

I see, it makes sense.

But maybe that would imply more deep changes in the firmware to be able to configure different behaviours depending on the source of the event, it could be a button, a different button, and MQTT message, the web interface,...

In the meantime I prefer to keep it simple and consistent across different sources, even thou it means it's not as flexible and someone would like to.

@xoseperez
Copy link
Owner Author

Original comment by Carlos (Bitbucket: cnieves1, GitHub: cnieves1):


Different behaviors for different buttons were already supported, and I don't think delayed actions are needed for mqtt or web interfaces.

Anyway, it's ok. Of course you know the code better than me and you are free to do that. If it works, I will be able to use a presence detector. I am not having complex setups so it is not a problem for me...

Are you finally going to make this configurable in the web interface?

Thanks,

Carlos

@xoseperez
Copy link
Owner Author

Released with 1.9.0. Configurable only through build parameters.

@xoseperez
Copy link
Owner Author

Removing milestone: 1.8.4 (automated comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor relay
Projects
None yet
Development

No branches or pull requests

1 participant