-
Notifications
You must be signed in to change notification settings - Fork 639
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
Wall Switch (ON/OFF) #182
Comments
Original comment by damienyong (Bitbucket: damienyong, GitHub: damienyong): Or simply |
With the current version you can define the button to be a BUTTON_SWITCH, which means it will trigger a click event on every edge, that means if you press the button it will toggle the relay, and when you release it it will toggle the relay again. In the hardware.ino file find the 4CH board and change the line for your button as follows:
Mind that the action it performs is "toggle", so it will simply change the state. If you change the state throw others means (web interface or MQTT, for instance) and you leave it ON, then pressing will turn it off and releasing will turn it on again. Another option is a beta feature I just pushed into the dev branch which allows to map the button events to ON or OFF actions, not just TOGGLE. This means the behaviour of the buttons will be consistent no matter the state of the relay. You would then configure the button like this:
Meaning pressing the button will always turn the relay on, and releasing it (no matter how long after the pressing) will turn it off. Remember than for this to work you'll need the latest dev branch (commit 66131bb). Will be released with 1.8.4 or 1.9.0, whatever comes first. |
Original comment by damienyong (Bitbucket: damienyong, GitHub: damienyong): Hello thank you very much for your help. (but Platformium is a little strrange for a Arduino-IDE person ) |
Original comment by damienyong (Bitbucket: damienyong, GitHub: damienyong): Another little thing, can you make the boot-mode of the switches to off ? Thank you :) |
That's what the "Switch boot mode" option does in the general tab. Set it to "Always OFF" and done. |
Release 1.9.0 adds support for ON/OFF actions. |
Removing milestone: 1.8.4 (automated comment) |
Original comment by J Hendricks (Bitbucket: joeyhza, GitHub: joeyhza): Hi To start - I just want to say thanks for all the work put in to this and making life easier for the IOT noobs like myself. I'm hoping someone can shed some light on my issue regarding run of the mill flip/toggle switches. I have successfully flashed 4x Sonoff Dual switches and all are in line and operational with my HA system and Alexa. Each switch is run in to the corresponding Button 0 / Button 1 on the header. The only problem i have is if i flip the wall switch to turn the light on or off,I have to flip it twice. Am I missing something. Reading up on past issues it doesnt appear this is the norm. I have flashed all 4 switches with the lastest version of the pre-built binary. Switch sync mode is set to No Synchronisation Any help appreciated - wife is giving me the 'look what you broke you idiot' look every time she has to flip a switch twice to turn it on or off. Me .... I don't mind so much :) |
Originally reported by: damienyong (Bitbucket: damienyong, GitHub: damienyong)
Hello,
I just discovered your firmware and I'm pretty impressed, looks and feels very clean.
But I'm trying to use my Sonoff 4CH (not-pro) as a Light and Roller shutter switch.
I tried to change the button mode in the settings, but noting changes when I'm choosing a different button mode.
I would love to use the buttons, that the relay is open as long as you press the button, and when you're releasing it it stops.
Is this doable ?
Thank you
The text was updated successfully, but these errors were encountered: