ArnieX / swifitch-software

Software for SWIFITCH HW
MIT License
12 stars 7 forks source link

Swifitch configuration #8

Closed dicastro closed 6 years ago

dicastro commented 6 years ago

I've been able to turn on swifitch and connect to the SWIFITCH_XXXXX wifi. Then I have configured my wifi connection (I've chosen my wifi SSID and I have introduced wifi password.

After that, swifitch was not available in my wifi. I have connected to the router to list the connected devices list, and there was no ESP connected. I have tried also Fing Android app to scan connected devices of a wifi network, and swifitch was not visible neither.

(All these steps have been done having connected swifitch to the computer through a NodeMCU. I am not sure if it could be a problem with power supply)

(The blue led of ESP12S is not fixed, it is blinking)

I have tried to reflash swifitch to start all the process from the begining. But after reflashing, the swifitch wifi SWIFITCH_XXXXXX is not created. What do I have to do to reset swifitch?

ArnieX commented 6 years ago

It has to be there. To reset to defaults look for line in setup() which is there to reset settings. Uncomment, flash, comment, flash.

dicastro commented 6 years ago

Which is the password to connect to SWIFITCH_XXXXX wifi? PASSWORD?

ArnieX commented 6 years ago

Yes ;) if you didn't change it in the code.

dicastro commented 6 years ago

I haven't changed it in the code. I am not able to connect to SWIFITCH_XXX wifi. Neither with my laptop (windows 10 pro) nor with my android mobile.

In my laptop I am getting: Impossible to connect to that network

In my mobile I am getting: Authentication error

I am getting crazy! This morning I managed to connect and configure my wifi SSID following the same steps. After a reset of the swifitch, it is not working anymore.

ArnieX commented 6 years ago

You should try to erase flash and reflash it again.

Search google for how to do it using esptool.py, I use following command.

python esptool.py -p /dev/cu.SLAB_USBtoUART erase_flash

ArnieX commented 6 years ago

Oh and sometimes forgetting that network in your phone helps. So that you have to enter password again.

dicastro commented 6 years ago

I have already tried to forget the network and to reenter the password.

I will try to erase the flash with esptool. I will tell you if it has worked.

dicastro commented 6 years ago

I have tried erasing completely the esp flash using esptool.

This is what I get in the serial monitor after uploading again the code:

(I am using ESP12S)

...
*WM: PASSWORD
{$␀l��|␀�d�|␃␌␄␌�␌l�␌#|��␃�␛�s�b�␌c��'o�$gn���␄c␜p��ds$sdp�'�␘␃␄␌�␌l␄��␌␌␄c␄o�<␃l�␌␌�c��go�␀d��$`␃�␛␓ng␄l`␃␏␂'{���g␄␌c␄�␏l␇s��'␌␌c␌�␇d܃�␛c�␒␛l ␃��n�␃*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM: SET AP STA
*WM:
*WM: Configuring access point...
*WM: SWIFITCH_10549155
*WM: PASSWORD
rd␀d��|␀�l�|␃␌␌␄�␄l�␄c|��␃�␒�;�c�␄c��g'�log���␄c␜8�lrl;l8�g�␐␃␌␄�␄l␌Ĝ␄␌␌c␌'�|␃$�␄␌�c��og�␀l��d`␃�␓␛gn␌d`␂␇␃gs�ۓn␌␄#␌�␎d␎;��g␄␌c␄�␏l���␛#�␛␒d`␂��g�␃{l␀l��|␀�d�|␂␄␌␌�␌d�␄c<ǃ␃�␛�{�c�␌b��og�l'o���␌#␜p�${ls$8�g�␐␃␌␄�␄$␌��␄␌␌b␌'�|␃$�␄␌�b��og�␀l��l`␃�␓␛gn␌d`␂␇␃gs�ۓn␌␄#␌�␇d␎;��g␄␌c␄�␏l���␓#�␛␒d`␂��g�␃*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM: SET AP STA
*WM:
*WM: Configuring access point...
*WM: SWIFITCH_10549155
*WM: PASSWORD
...
ArnieX commented 6 years ago

And still no luck connecting to SSID: Swifitch_xxx?

dicastro commented 6 years ago

Nop :-(

I am going to review the soldering part

I am going to give it another try using a CP2102 USB2UART.

Do you have any recommendation about which CP2102 to buy (I'd like to buy it in Amazon, to avoid waiting too long to have it)?

The ones that I've seen have 5 pins 3v, RX, TX, GND and DTR.

ArnieX commented 6 years ago

To flash swifitch you need basically only 4pins and jumper. 3,3V, GND, TX and RX connected in cross TX/RX and RX/TX. Using nodemcu is better as kt controlls putting module in flash mode and handle reset. When you will do it using regular programmer you need to use F jumper to put module in flash mode and have to handle resets by disconnecting and connecting from USB.

But stop for a while and please tell me what is the status now. Do you see swifitch_xxx AP or not at all. If you see it the only problem is that you can’t connect? If this is the problem make sure you forget this network on your device you are trying to connect to this network. Does swifitch LED light up and keep up? If it goes off after a while that mean that swifitch has finished setup and is connected to your home wifi, this shouldn’t be your case if you properly erased flash. Let me know more details, I think that it is ok but there is just some minor issue.

dicastro commented 6 years ago

This is the current status:

ArnieX commented 6 years ago

To the last point, when WiFi is configure led should turn OFF. Led on ESP itself should not blink or light up. That is not correct behaviour. You should now try to disconnect NodeMCU and connect swifitch to mains and see if that works. If it does, issue was power.

dicastro commented 6 years ago

I've tried connecting swifitch to mains and it works!! I see AP SWIFITCH_XXX, and I am able to connect at first. After that swifitch connects to my home wifi (led turns off).

My current problem is that swifitch's web server is available only during few seconds.

When the led turns off, I put the swifitch ip in a browser and I see Web server is running (If I point to /config, I am able to login and see the configuration page). But after some seconds the webserver is down.

Do you have any clue of why this could happen? I am not able to monitor the serial log because I must power the swifitch to main current.

ArnieX commented 6 years ago

That is really strange behaviour. I do not have such issues. Could you try to flash older version of firmware? Specifically this commit https://github.com/ArnieX/swifitch-software/tree/d4f56338b0531e6bf6579bc12c9dc8858213a72d

dicastro commented 6 years ago

I've tried with that commit and when swifitch starts, it seems it is stable. I can ping it after several minutes. But in this version, there is no web interface isn't it? I still haven't installed a MQTT broker, so I can't test it (or at least I don't know how to do it without an MQTT broker)

This weekend I will do some more tests. I have a raspberry pi where I will install the MQTT broker (mosquitto)

I would like to be able to use the last version. It seems a lot more usable

ArnieX commented 6 years ago

If you wish you could use this preconfigured OS for Raspberry Pi 2/3, there is Homebridge, Homebridge MQTT plugin, MQTT server and NodeRED with example flows for Swifitch for homekit.

http://nasberry.cz/sharing/d4lSes9iv

and yes you are right, this older firmware has only configuration at the beginning where you need to set everything including MQTT and MQTT is only communication possible. For testing MQTT use MQTT.fx (Google for download link).

ArnieX commented 6 years ago

Hi @dicastro

look at branch "fix", I have read something about issues with FauxMO and HTTP webserver. I was testing this change yesterday and it seems stable now, could you please test it?

https://github.com/ArnieX/swifitch-software/tree/fix

Let me know how it goes. Sorry for inconvenience ;)

dicastro commented 6 years ago

It works!! It is stable

Thank you very much.

I've seen that you have commented the part related to fauxmoESP. Have you found the origin of the issue between FauxMO and HTTP webserver.

FauxMO is used to emulate a fake WeMo device to integrate a device with Amazon Echo isn't it? It should be great to have both of them working together.

I would like to desolder ESP8266 from NodeMCU, to be able to power the swifitch with NodeMCU and to be able to debug the code.

This weekend I am going to work on this, I am really excited!! I am going to integrate the swifitch with google assistant and I am going to develop a PWA (I have lots of ideas!!)

Thank you very much for your reactivity!!! I love your project !

PD: And also I would like to take some pictures of my swifitch and upload them into the corresponding issue

ArnieX commented 6 years ago

I'm happy to hear that ;). You are welcome. I do not know what the issue is, but I will try to find out what's up.

I will be happy if you share some pictures. Have fun with swifitches, it makes me happy that you like it.