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

On clean install device stays in MODE AP #79

Closed
xoseperez opened this issue Feb 21, 2017 · 27 comments
Closed

On clean install device stays in MODE AP #79

xoseperez opened this issue Feb 21, 2017 · 27 comments

Comments

@xoseperez
Copy link
Owner

Originally reported by: f-fish (Bitbucket: f-fish, GitHub: Unknown)


Hi all, need some validation on this please.
After a clean / new device install. The device only boots into AP MODE.
Expected behaviour:

on terminal

#!arduino

set ssd0 abc
set pass0 xyz
reset

device connects to AP abc.

What currently happens:
Device always connects in

#!arduino

[WIFI] Creating access point
[WIFI] MODE AP --------------------------------------
[WIFI] SSID SONOFF_95ED6A
......

after a reset I can

get ssd0 and get pass0 with the correct information being retrieved.

This worked in 1.6.3 - current 1.6.4 master not working as expected.

Later Ferdie

@xoseperez
Copy link
Owner Author

Original comment by Matheus Telles (Bitbucket: matheustelles, GitHub: matheustelles):


I noted that when I setup on terminal a double name Wifi ssd0 like "set ssd0 Matheus Telles" it report me "-ERROR bad argument count".

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


The auto retry / connect in AP mode is also making it difficult to configure on the web since it drops your connection on every retry.

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


In platformio.ini I revert back to the 1.6.3 config .. ie removed the git version of ESPAsyncTCP, ESPAsyncWebServer cleaned the lib's rebuild and flashed and that seemed to work again.

I need to do a bit more testing to confirm this.

Later Ferdie

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Nope that was not it .. only way I could get the device on the network was to time the setting up of the web interface and configure static IP.

All a bit weird.

@xoseperez
Copy link
Owner Author

There is an issue with ESPAsyncTCP reported in Async MQTT Client, the library ESPurna uses: marvinroger/async-mqtt-client#30. It's related to the same commit in ESPAsyncTCP that fixes the MSS problem we had these last days.

@xoseperez
Copy link
Owner Author

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

@xoseperez
Copy link
Owner Author

I think I will switch to good-old PubSubClient...

@xoseperez
Copy link
Owner Author

Original comment by Matheus Telles (Bitbucket: matheustelles, GitHub: matheustelles):


How can I disable the "CreateAP" when the STA falls, but keep trying to reconnect but without creating AP? I need to enter on AP mode only when the button is DoublePressed or there is no Wifi setting saved.

@xoseperez
Copy link
Owner Author

@MatheusTelles You can set the AP_MODE setting to AP_MODE_OFF in the code/espurna/config/general.h file to disable AP mode.

@xoseperez
Copy link
Owner Author

The dev branch now uses PubSubClient as MQTT client by default (I kept the async code as an option). I'm getting good results connecting to my local broker. If the issue is with the ESPAsyncTCP library it should be solved now.

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Had to add PubSubClient to lib_deps in platformio.ini on a git checkout dev, git pull to get it to compile without errors. Going to give it a quick flash and see what we are getting.

Later Ferdie

@xoseperez
Copy link
Owner Author

Wasn't it already there?

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Nope ...

I typically delete my platformio.ini before I do a git clean -f and the a git pull.

Also finding that I can switch from esp to domoticz, but can not switch from domoticz to the esp.

  • not sure if this is correct, in the past the terminal would be very chatty you would see all the mqtt data from all the other devices, now I only see what I am sending.
#!arduino

[MQTT] Sending /test/switch/SONOFF_95ED6A/version => 1.6.5b
[MQTT] Subscribing to /test/switch/SONOFF_95ED6A/action
[WEBSOCKET] Broadcasting '{"mqttStatus": true}'
[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 0
[MQTT] Subscribing to /test/switch/SONOFF_95ED6A/relay/+
[MQTT] Subscribing to domoticz/out
[MQTT] Subscribing to /test/switch/SONOFF_95ED6A/led/+
[MQTT] Received /test/switch/SONOFF_95ED6A/relay/0 => 0 - SKIPPED
[MQTT] Sending /test/switch/SONOFF_95ED6A/status => 1
[BEAT] Free heap: 26456
[NTP] Time: 22:11:54 21/02/2017
[WEBSOCKET] Parsing configuration data
[SETTINGS] Saving
[WEBSOCKET] Requested action: on
[RELAY] 0 => ON

[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 1
[WEBSOCKET] Broadcasting '{"relayStatus":[true]}'
[MQTT] Sending domoticz/in => {"idx": 66, "nvalue": 1, "svalue": ""}
[MQTT] Received /test/switch/SONOFF_95ED6A/relay/0 => 1
[WEBSOCKET] Requested action: off
[RELAY] 0 => OFF
[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 0
[WEBSOCKET] Broadcasting '{"relayStatus":[false]}'
[MQTT] Sending domoticz/in => {"idx": 66, "nvalue": 0, "svalue": ""}
[MQTT] Received /test/switch/SONOFF_95ED6A/relay/0 => 0
[MQTT] Sending /test/switch/SONOFF_95ED6A/status => 1
[BEAT] Free heap: 26416
[NTP] Time: 22:16:54 21/02/2017
[WEBSOCKET] Parsing configuration data
[SETTINGS] Saving
[WEBSOCKET] Requested action: on
[RELAY] 0 => ON
[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 1
[WEBSOCKET] Broadcasting '{"relayStatus":[true]}'
[MQTT] Sending domoticz/in => {"idx": 66, "nvalue": 1, "svalue": ""}


Still playing.

Later Ferdie

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Ok let me try with this

#!arduino

f-fish@ffish-VirtualBox ~/esp/espurna/code $ git reset --hard origin/master
HEAD is now at 9663a65 Version 1.6.4
f-fish@ffish-VirtualBox ~/esp/espurna/code $ git pull
Already up-to-date.
f-fish@ffish-VirtualBox ~/esp/espurna/code $ git checkout dev
Switched to branch 'dev'

Your branch is behind 'origin/dev' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
f-fish@ffish-VirtualBox ~/esp/espurna/code $ git pull
Updating 9663a65..04ba425
Fast-forward
 code/espurna/config/general.h |   2 ++
 code/espurna/config/version.h |   2 +-
 code/espurna/mqtt.ino         | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
 code/gulpfile.js              |  12 ++----------
 code/html/checkboxes.css      |  14 +++++++-------
 code/html/images/check.png    | Bin 1471 -> 0 bytes
 code/html/src/checkboxes.css  | 119 ----------------------------------------------------------------------------------------------------------------
 code/platformio.ini           |   1 +
 8 files changed, 96 insertions(+), 157 deletions(-)
 delete mode 100644 code/html/images/check.png
 delete mode 100644 code/html/src/checkboxes.css

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Done the above - complied without any issues - and can see the platformion changes look like yours. So git was a bit stuffed.

#!arduino
[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 0
[MQTT] Subscribing to /test/switch/SONOFF_95ED6A/relay/+
[MQTT] Subscribing to domoticz/out
[MQTT] Subscribing to /test/switch/SONOFF_95ED6A/led/+
[MQTT] Received /test/switch/SONOFF_95ED6A/relay/0 => 0 - SKIPPED
[WEBSERVER] Request: GET /index.html
[WEBSERVER] Request: GET /auth
[WEBSOCKET] #1 connected, ip: 192.168.1.24, url: /ws
[WEBSOCKET] Requested action: on
[RELAY] 0 => ON
[MQTT] Sending /test/switch/SONOFF_95ED6A/relay/0 => 1
[WEBSOCKET] Broadcasting '{"relayStatus":[true]}'
[MQTT] Sending domoticz/in => {"idx": 66, "nvalue": 1, "svalue": ""}
[MQTT] Received /test/switch/SONOFF_95ED6A/relay/0 => 1



Still same same, can switch to domoticz but is does not listen to what domoticz has to say.

Want to test AP quickly. Going to leave mqtt configured.

Later Ferdie

@xoseperez
Copy link
Owner Author

This is because the MQTT_MAX_PACKET_SIZE in the PubSubClient library is too small, edit the PubSubClient.h file and change it to:

#define MQTT_MAX_PACKET_SIZE 400

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Ok, I would like to nominate myself for the darwin award.

So my original reason for logging the ticket was to do with being stuck in AP mode and never seeing the light of day with STA configuration from terminal.

Who would have thought that I would by thinking I was doing the correct thing actually find something that was totally unrelated - but almost true enough to be the issue.

#!arduino

set ssd0 APNAME
get ssd0
+APNAME

vs

#!arduino

set ssid0 APNAME
get ssid0
+APNAME

Hey now all WIFI from terminal works.

#!arduino

[WIFI] MODE STA -------------------------------------
[WIFI] SSID APNAME

So is doing a "set ssd0" a bug or feature and what am I setting? Turns out you can set anything in the terminal - like setting a var, no validation that you are not being silly about it.

Now back to mqtt.

Later Ferdie

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


100% ... made the change in PubSubClient.h

cleaned up the pioenvs/sonoff-debug/lib/ removed PubSubClient_ID89 and libPubSubClient_ID89.a

rebuild and upload, and the flood gates opened ;-)

MQTT working to and from domoticz.

Going to stick around in dev branch for a bit ..

Later Ferdie

@xoseperez
Copy link
Owner Author

Hahaha... well, the terminal uses Embedis which provides:

  1. a configuration solution persistent in (emulated) EEPROM
  2. custom commands execution from the terminal

The application has no control on what config settings are created. You may as well do:

set mydogsname pluto
get mydogsname
+pluto

ESPurna will query the Embedis dictionary for the settings she wants to know, if there is no such setting she will use a default value or null. I wouldn't call it a bug or a feature.

@xoseperez
Copy link
Owner Author

@MatheusTelles Same for the "set ssd0 Matheus Telles" issue. "set" is a built-in command that expects key and value.

@xoseperez
Copy link
Owner Author

Original comment by Matheus Telles (Bitbucket: matheustelles, GitHub: matheustelles):


My bad, its "set ssid0 Matheus Telles". I tried "set ssid0 Matheus_Telles" and worked, but I need to change the ssid on router with no backspace.

@xoseperez
Copy link
Owner Author

@MatheusTelles You can do set ssid0 "Matheus Telles"

@xoseperez
Copy link
Owner Author

@F-Fish Does it make any difference using PubSubClient or AsyncMQTTClient?

@xoseperez
Copy link
Owner Author

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Not the brief time I played with it. have not moved this onto production devices. Still sitting on the bench.
Going to flash 1.6.4 stock quickly see if I can duplicate the issues the guys are having on that - I can can then I will flash 1.6.5b again see if it is any better.

Later Ferdie

@xoseperez
Copy link
Owner Author

I have noticed some difference between the both. On one hand PubSubClient, being synchronous, does halt execution when trying to connect, web interface is not responsive while the firmware is trying to establish an MQTT connection. On the other hand it seems more reliable and fast once the connection has been established.

@xoseperez
Copy link
Owner Author

Version 1.6.5 is live using PubSubClient by default. Please read note 1 in section "Installing libraries from the Library Manager" here https://bitbucket.org/xoseperez/espurna/wiki/ArduinoIDE.md.

@xoseperez
Copy link
Owner Author

Removing milestone: 1.7.0 (automated comment)

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