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

Pushbutton-Switch causes relay to toggle on boot if closed #125

Closed
xoseperez opened this issue Apr 14, 2017 · 7 comments
Closed

Pushbutton-Switch causes relay to toggle on boot if closed #125

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

Comments

@xoseperez
Copy link
Owner

Originally reported by: Andy Shultz (Bitbucket: SenorShultzy, GitHub: Unknown)


I've set up GPIO14 as a switch to activate the relay of a Sonoff basic. The problem I'm having is if the switch is closed when the Sonoff boots the relay will toggle. I would expect it t take the state or of the pin on boot as the base and only toggle if it sees the state change.

For illustration here is my use case:

  1. Sonoff booted with boot relay status set to off
  2. Turn the relay on by closing a switch on GPIO14
  3. Turn the relay off some other way (ie MQTT)
  4. Reset the Sonoff (ie Lose and regain power)
  5. The relay will turn on
@xoseperez
Copy link
Owner Author

ESPurna accepts two different button behaviours: pushbuttons (toggle the relay on rising transitions) and switches (toggle the relay on every transition). Currently it does not check the state of the button and it does not enforce the state of the relay to the state of the button because there are other means to change the state of the relay.

I mean: you want the relay to follow the state of GPIO14 on boot. But after your step number 3 it does not either.

Anyway: what I would do is to add another boot mode that would check the state of the button, so your use case will be satisfied.

@xoseperez
Copy link
Owner Author

Original comment by Andy Shultz (Bitbucket: SenorShultzy, GitHub: Unknown):


Sorry, I can see how my second sentence could've given the wrong idea.

I do not want the relay to follow the GPIO. I want exactly what you are describing. Toggle the relay if the GPIO state changes. In my use case, the switch is low at step 2 and stays that way. After reset (Step 4), the relay is toggled even though nothing told it to change. This might be a better example:

Expected Behavior:

  1. Booted with mode set to Always Off - Relay OFF
  2. Close switch - Relay ON
  3. Reset device - Relay OFF
  4. Open switch - Relay ON

Actual Behavior:

  1. Booted with mode set to Always Off - Relay OFF
  2. Close switch - Relay ON
  3. Reset device - Relay ON <- Why?
  4. Open switch - Relay OFF

@xoseperez
Copy link
Owner Author

Fixed with version 1.8.0

@xoseperez
Copy link
Owner Author

Removing milestone: 1.8.0 (automated comment)

@xoseperez
Copy link
Owner Author

Original comment by Andy Shultz (Bitbucket: SenorShultzy, GitHub: Unknown):


Sorry to say but this is not resolved. I've upgraded to the 1.8.1 and it behaves the same. If the switch is on when the sonoff starts up then the relay toggles. I'll dig in to see if I can fix it on my own.

@xoseperez
Copy link
Owner Author

Original comment by Skillet (Bitbucket: SkilletZA, GitHub: SkilletZA):


@SenorShultzy I am having the exact same issue on my Sonoff Basic's. Did you ever find a solution to this?

@xoseperez
Copy link
Owner Author

Original comment by Andy Shultz (Bitbucket: SenorShultzy, GitHub: Unknown):


Unfortunately I have not. I don't lose power or reset my devices much so it hasn't been a high priority. I'll certainly comment here if I do.

@xoseperez xoseperez added minor relay enhancement New feature or request labels Jan 24, 2018
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