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

Sonoff Dual R2: Switch #1 ON on boot regardless the "Always OFF" option #1254

Closed
AlbrtoSam opened this issue Oct 8, 2018 · 17 comments
Closed

Comments

@AlbrtoSam
Copy link

I have just upgraded to 1.13.3a my dual sonoff R2 and when i reboot switch 1 gets ON. I have set the option boot mode as Always off

@AlbrtoSam
Copy link
Author

It worked fine for me on 1.12.5 version

@xoseperez xoseperez added this to the 1.13.4 milestone Oct 8, 2018
@xoseperez xoseperez changed the title 1.13.3a Switch ON on boot regardless the "Allways OFF" option Oct 8, 2018
@AlbrtoSam
Copy link
Author

I also have a 4ch and it works fine on 13.3a

@berryelectronics
Copy link

berryelectronics commented Oct 21, 2018

Noticed this too. I have freshly flashed Dual R2's here, and the first boot has also the Swith #1 turn on upon boot, aswell after setting them to Boot into Off.

But it seems like the relay turns off when you set it to pulse mode

@mcspr
Copy link
Collaborator

mcspr commented Nov 28, 2018

Mixed up with the #1216, cc @macobra as this is the actual R2 issue.

Could this be related to button setup?

#define DEVICE "SONOFF_DUAL_R2"
// Buttons
#define BUTTON1_PIN 0 // Button 0 on header
#define BUTTON2_PIN 9 // Button 1 on header
#define BUTTON3_PIN 10 // Physical button
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
#define BUTTON3_RELAY 1
#define BUTTON1_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH

edit: i.e should BUTTON2 (GPIO9) be BUTTON_PUSHBUTTON as BUTTON3 (GPIO10)?

I am not that familiar with pin initialization requirements, but reading DebounceEvent source BUTTON_SWITCH initial reading is done without pinMode setting it INPUT_PULLUP (or INPUT at all):
https://github.com/xoseperez/debounceevent/blob/4681547f72b226a9bafc95cf7a4623ec69f6a327/src/DebounceEvent.cpp#L36-L65

Core itself skips this too
(2.3.0 version linked, same with 2.4.X. My assumption that is because generic ESP8266 connects GPIO9/10 to SPI flash, unlike ESP8285 that is used in Dual R2):
https://github.com/esp8266/Arduino/blob/09826c6d87e54c15422da90f060377c9ef188947/cores/esp8266/core_esp8266_wiring_digital.c#L160-L176

@mcspr mcspr changed the title Switch ON on boot regardless the "Allways OFF" option Sonoff Dual R2: Switch #1 ON on boot regardless the "Always OFF" option Nov 28, 2018
@Misiu
Copy link

Misiu commented Dec 13, 2018

@mcspr Is this fixable? If Yes, will this be fixed? I'm planning to buy a couple of those Sonoffs for roller shutters and I just found this issue.

@mcspr
Copy link
Collaborator

mcspr commented Dec 13, 2018

My theory is pinMode(..., INPUT) should be done (IDE does this for esp8285 board)

I do not have Dual R2, but testing on the similar esp8285 with rfbridge: gpio 9 and gpio 10 in terminal show LOW, but must read HIGH, which is why I wondered about the pin setup.

@ralias
Copy link

ralias commented Dec 20, 2018

Same problem here. I am running ESPurna v 1.13.3 on Sonoff Dual R2. After lost power at the reboot the switch 1 is always on. When I burn the binary I did an erase before.

@ralias
Copy link

ralias commented Dec 20, 2018

I tried something. When I choose in the configuration SWITCH 1 Boot Mode: "Always ON", then it boot with the switch OFF.

@macobra
Copy link

macobra commented Dec 22, 2018

@ralias
switch#1 'bootmode'='Always ON' boots OFF, while setting 'Alway OFF' boots ON.

I fixed it quick and dirty by changing labels ;)

@ralias
Copy link

ralias commented Dec 23, 2018

@macobra I try again paying more attention to the boot process. When I set Switch 1 Boot Mode: "Always ON", I reboot the device, first of all it put the switch 1 on, finally it apply the configuration option "Always ON" and it power off the switch. There are a up/down state. It's not only change the label "OFF" by "ON". My previous message It's a bypass to avoid a manual intervention after a unexpected reboot. It's not the solution.

@ralias
Copy link

ralias commented Dec 23, 2018

In version 1.13.2 is working properly.

@xoseperez
Copy link
Owner

@ralias do you mean 1.13.2 works but 1.13.3 doesn't?

@ralias
Copy link

ralias commented Dec 31, 2018

@ralias do you mean 1.13.2 works but 1.13.3 doesn't?

@xoseperez, exactly the 1.13.3 binary doesn't works and binary version 1.13.2 works as expected.

@mileperhour
Copy link

FYI: The same issue, using 1.13.3, on Sonoff Bridge RF v2 hardware. It can't be fixed using "same as before", "always on" or "always off". All options send one order to every switch programmed on each Espurna boot. (I expected that "same as before" won't do any kind of order to switches on boot -¿?-). Its really difficult to handle using devices with same "on" and "off" RF code, as it can't be configured to be predictable on any situation.

@xoseperez
Copy link
Owner

Can any one test the version in the dev branch after the DebounceEvent library update?

@ColinShorts
Copy link
Contributor

I tested this at 5f288fc on the dev branch on one device and can't reproduce this, my network is being a pain or I'd have tried on a few devices. If you need more testing let me know and I'll power cycle some.

@skyynet
Copy link

skyynet commented Feb 16, 2019

Works for me. I just downloaded the current dev and upgraded Debounce Event Lib from 2.0.4 to 2.0.5 on my Sonoff Dual R2. Is it normal that I see the version still reported as 1.13.3 in the status tab of the web interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants