I have tried to flash two of these devices and so far have been unsuccessful in getting them to work. I am not even sure if the reason for flashing these devices is what I think it is. I am hoping that the PRIMARY reason for doing this is to make these devices work from my in home server running on my RPi instead of going to the Itead cloud server.
If I am wrong in this assumption, I hope someone will correct me right away. I followed the procedure in the home automation course and get some strange results. I edit the sketch to include my home wifi credentials and the IP address of my server. I then made sure that the names used in the node red flow matched the name in the “if” statements in the sketch. The sketch uploaded without errors but when it finished, I was presented with a long text file on the serial monitor.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 16:09:10.473 -> 3fffff60: 3ffe84ec 3ffee84c 3ffee880 402025f5 16:09:10.473 -> 3fffff70: 0001c200 0000001c 00000000 401001cd 16:09:10.473 -> 3fffff80: 3fffdad0 00000000 3ffe84dc 40202736 16:09:10.473 -> 3fffff90: feefeffe feefeffe feefeffe feefeffe 16:09:10.473 -> 3fffffa0: feefeffe feefeffe 3ffee8b8 4020498c 16:09:10.473 -> 3fffffb0: feefeffe feefeffe 3ffe85fc 40100981 16:09:10.473 -> <<<stack<<< 16:09:10.473 -> 16:09:10.473 -> last failed alloc call: 4010022C(-2138280708) 16:09:10.473 -> 16:09:10.473 -> ets Jan 8 2013,rst cause:1, boot mode:(1,7) 16:09:10.473 -> 16:09:18.669 -> 16:09:18.669 -> ets Jan 8 2013,rst cause:4, boot mode:(1,7) 16:09:18.669 -> 16:09:18.669 -> wdt reset <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
This was the last few lines and there was nothing prior to this stuff at the beginning of the file. I was hoping to see that the thing would report “connected” etc….
But I have been able to repeat this file several times. I tried another device and was not even able to get that far. So before I “brick” anymore of these things, I sure would appreciate some ideas.
I am still unsure how this process works. For example, after flashing this device, what have I accomplished? How does this device know to respond to the commands from my node red flow? Is it done by the names entered in the switch edit page? I just don’t seem to have a basic understanding of how this works.
These sonoff devices are the basis for my need for the home server to begin with. I currently have 12 of these things running things in my home. But I want to get them to be independent of any cloud server. Does this also mean that the node red has to be running at all times or is it just a means for inputting to the MQTT.
Can you point me to some basic understanding regarding how this server works.
Hello, can you try to upload again an Arduino sketch, but double-check that you have these details selected in the Arduino IDE:
- Flash Mode: DIO
- Flash Frequency: 40MHz
- Upload Using: Serial
- CPU Frequency: 80MHz
- Flash Size: 1M (64K SPIFFS)
- Debug Port: Disabled
- Debug Level: None
- Reset Method: ck
- Upload Speed: 115200
- Port: Your COM port
After, uploading the sketch, restart your SONOFF device and let me know your results.
Thanks for your patience. Regards.
I am enjoying partial success. I have one of the devices working. I am sure that the problem was that I had missed a setting in the “tools” menu of the IDE. That was the
- Flash Size: 1M (64K SPIFFS)
- I now have one of the devices working. After the uploading finished, I was greeted by a connection message on the serial monitor. I then switched the power off and back on. I then went back to my other computer that was running the dashboard and was able to control the green led on the sonoff. I then went back to the sketch and changed the “if(topic” message to see if that controlled the device and sure enough it did. So that has answered the other major question that I had concerning the device identity on the network. So now I have a bunch of switches to flash. I am also going to continue with the course to learn how to use PIR device to control a switch.
- It appears that one of the devices was damaged in my fumbling around. The funny thing is that the IDE never showed any problem. Just observing the process would lead me to believe that it had uploaded correctly. But I could not get it to respond after trying it several times.
- Thanks for you patience and assistance. I am sure there will be more questions as I go along
More success. I now have another switch flashed and working correctly. I have also setup my router to allow access to the dashboard from anywhere. I then created a “dummy” sketch that allows me to go in and change the appropriate number after “sonoff” to add new switches. I plan to keep them numbered in order and then maintain a log as to where they are located around the house. I am sure this is probably a crude way of doing it but it will work for me. My next effort is going to be setting up daily time schedules for the switches. Any input along this line would be appreciated
I’m glad it’s working now!
You could add all those routines and schedules inside Node-RED to trigger things automatically.
Thanks. I will move on to that project. Is there an informative guide for learning the in and outs of node red such as backing up flows, exporting flows and general administrative tasks for that tool?
In page 318 “Unit 6 – Exporting Node-RED Nodes” I show to how export/import your Node-RED flows. Node-RED definitely lacks a good way of automatically backups or easier restores.
Which other administrative tasks are you referring to? I might be able to point you to the right resource.
Since I am not a linux user, I would like to know the path of the files used by node red and MQTT on the RPi.
This is the official Wiki page that covers where you can find all the necessary files to back up your Node-RED flow and settings: https://github.com/node-red/cookbook.nodered.org/wiki/How-to-backup-flows-and-related-configuration
I hope that helps!