Got the latest SDK + IoT demo and wanted to understand what was happening.
Got it working as per http://bbs.espressif.com/viewtopic.php?f=9&t=66
Putting everything I've done up on github just in case it's helpful to anybody.
I've hit the limitation of my ESP-01, no ADC port and no GPIO16 to wake up from deep sleep. Once I get -03/-12 I'll play with this some more.
Here's patched SDK+IoT - https://github.com/vladkosarev/esp8266_IOT
esp8266_IOT
Trying out different things using official SDK + IOT Example
This is based on a copy of Espressif's SDK+IoT demo. Also, check out companion app - https://github.com/vladkosarev/esp8266_IOT_mobile
Here are some changes -
Rudimentary CORS support. Webserver now understands ajax requests (did it for mobile app).
Added another sensor - RAIN, just to demo what adding a simple sensor looks like in code. For now it's just doing adc read but since ESP-01 doesn't have ADC pin out it's just sending garbage data. Will actually add a sensor to this if GPIO00 and GPIO02 allow.
In user_config you can define DEEP_SLEEP_OVERRIDE. This will override deep sleep settings. I added it because I have ESP-01 which is missing GPIO16 pin so esp never wakes up from deep sleep. I wanted to make a clear define for that scenario. As soon as I get ESP-03 I'll just remove that define and off we go.
You can direct all os_printf to UART0 by defining TRACE_TO_UART0 in uart.c
You can enable more tracing by defining TRACE_ESPCONN in espconn.h
Here's web/mobile app to get endpoint info or send in wifi/iot info - https://github.com/vladkosarev/esp8266_IOT_mobile
esp8266_IOT_mobile
Ionic based app for control of esp8266 IoT demo
This app needs CORS support so you will need a patched version of IoT demo - https://github.com/vladkosarev/esp8266_IOT
Installing.
You need to install ionic -
npm install -g ionic
To run it as a web app on your desktop -
ionic serve
To build and run this as an app on your mobile device you will want to read ionic documentation and set up your environment. If you already have your mobile dev environment set up properly then all you need is the following -
For Android -
ionic platform android
ionic run
For iOS -
ionic platform ios
ionic run
Using.
By default IoT app will start as Access Point with ip of 192.168.4.1 You will want to connect your desktop or mobile device to esp8266 AP to use this app.
Once connected to ESP AP you can run the app.
Info screen will call different available endpoints and dump JSON results on the screen. Helpful for debugging.
Setup screen is for setting up your IoT app. You have to provide your wifi ssid/password and your Master Device Key token from http://iot.espressif.cn/
Once you successfully submit WiFi/IoT configuration, your ESP will start sending data to iot.espressif.cn and you should see data points appearing there. At this point your ESP is running as a client and will stop being an access point. You will have to re-flash to return it back to original state.