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 does not show both switches in Home-Assistant auto detection / boot switch settings not saved / frequent disconnections #392

Closed
xoseperez opened this issue Jan 11, 2018 · 12 comments
Assignees
Milestone

Comments

@xoseperez
Copy link
Owner

Originally reported by: Foraster (Bitbucket: foraster, GitHub: Unknown)


I have been trying latest espurna-1.11.4-itead-sonoff-dual-r2.bin in a brand new Sonoff Dual R2, expecting an excellent behaviour like I got with several sonoff S20 (that I have working with ESPURNA 1.10.1), but I have found several issues:

First issue: I have configured the MQTT section and activated the HomeAssistant auto-discovery feature. I get a lot of warnings in HA "client is connecting too fast", later I got "WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON llums_parking_escalaprova".
In Home-Assistant I only get a single switch detected.

Second issue: After saving and forcing a reboot, the switches turn on, although I set the state "Same as before".

Third issue: I have detected that the Dual now and then gets disconnected from the wifi network. I have tried configuring two SSIDs (for my main and my backup wifi) but the problem persists.

@xoseperez
Copy link
Owner Author

Original comment by Guido Mersmann (Bitbucket: Geit_de, GitHub: Unknown):


The Power on state issue was fixed with todays 1.12.0.

I have no issues with the R2 wifi here. It was even impressive what distance they bridge when falling back into hotspot mode, which was twice as much as to the next hotpot they connect to when on duty.

The R2 is quite new and only supported for a couple of weeks, so be patient. It will pay off. :D

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


Just tested 1.12.0.
Indeed the power on state has been resolved. No ghost reboots have been detected since I flashed the firmware via serial port.
I'll try to integrate the dual into Home-Assistant and report results.

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


I managed to resolve the disconnection issues but discovered the reason: The Sonoff Dual was unable to connect to a Hidden SSID.

The same issue has been reproduced on a Sonoff S20: after flashing v1.12.0 the connection is lost, and the device AP appears. It connected ok with v1.10.1

@xoseperez
Copy link
Owner Author

Yes, that's true... since 1.12.0 I force the firmware to scan for networks. If the network is not visible it will not show up in the scan results and ESPurna will not try to connect to it...

The original reason to force scanning is to be able to decide what BSSID to connect to when different AP use the same SSID. I wanted to be able to connect to the one with the strongest signal. Maybe I could add a check in the web UI to force ESPurna to try to connect to a network even if it doesn't show up in the scan. Can you think of any other way to do it?

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


@xoseperez, the feature to connect to the stronger signal/AP is a great feature!
The check in the UI is also a good solution.

FYI, firmwares (I guess esp easy) try to connect to the strongest signal but also allow to connect to a hiden one.

@xoseperez
Copy link
Owner Author

Issue #399 was marked as a duplicate of this issue.

@xoseperez
Copy link
Owner Author

Version in dev branch now allows to disable network scanning. This will force ESPurna to try to connect to the defined networks in order.
Disable network scan when you have just one access point (so there is no benefit on scanning for the strongest signal) or a hidden SSID.
The default value is enabled.
Will be released with next version.

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


I'll give it a try!

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


Tested 1.12.1 in both dual-R2 and S20 and the scan option works like a charm!

@xoseperez
Copy link
Owner Author

There is one thing missing in this issue, the "client is connecting too fast" problem. Actually, the home automation module only supports on switch at the moment, only data for relay 0 is sent to HA. So it's only sending one config MQTT message. My guess is that, just after the config message ESPurna resends the status message to ensure HA gets it. Maybe the time between those two messages is too short. Maybe adding a "nice_delay(100);" between both messages at the end of the _haSend method helps:

    mqttSendRaw(topic.c_str(), output.c_str());
    nice_delay(100);
    mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);

@xoseperez
Copy link
Owner Author

Original comment by Foraster (Bitbucket: foraster, GitHub: Unknown):


I'll try to compile the firmware with the nice_delay in a few days.
Just to clarify and reproduce the error, could you confirm that the procedure to have an ESPURNA device automatically detected into HA is this:
1.-setup wifi
2.-setup mqtt
3-(reboot ?)
4.-go back to general page set HomeAssistant Prefix
5.-enable "Home Assistant auto-discovery feature". ( Enable and save to add the device to your HA console.)*

@xoseperez
Copy link
Owner Author

I have been testing this last issue for #465 and had no problems. Will stage this to release. Feel free to open it again if you have any other problem.

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

1 participant