GithubHelp home page GithubHelp logo

esp8266-library's Introduction

Download and update Infrastructure for IOT devices, currenlty the ESP8266. You will need an account at IOTAppStory.com

Wiki pages: https://iotappstory.com/wiki

Latest release 1.0.6

https://github.com/iotappstory/ESP8266-Library/releases/latest

Develop branch

If you want to fork or contribute to the library. Please send your pull request to the "develop" branch.

API

IOTAppStory(char* appName, char* appVersion, char* compDate, char* modeButton)

Tells IAS the name of the application, its version, compilation date and what digital input is the force-update/reset button. Note: the EEPROM size and number of firmware variables are limited to 1024 and 12 respectively. If additional resources are needed beyond these limits EEPROM_SIZE and MAXNUMEXTRAFIELDS can be defined / modified in IOTAppStory.h.

#define APPNAME my_app
#define VERSION V1.0.0
#define COMPDATE __DATE__ __TIME__
#define MODE_BUTTON D3


#include <IOTAppStory.h>
IOTAppStory IAS(APPNAME, VERSION, COMPDATE, MODEBUTTON);

setup () { ... }
loop () { ... }

serialdebug(bool enabled, int speed)

Set if sending debug over serial is enabled and, if so, at what speed to send data.

preSetConfig(...)

Sets various options to influence how begin() sets things up. All calls to this function must be done before calling begin().

preSetConfig(bool automaticUpdate)

Setting to true will make the device do an update-check immediately after calling begin().

preSetConfig(string boardName, bool automaticUpdate)

Set the device hostname. This is important as devices by default has APPNAME as hostname (set by the IOTAppStory constructor), which can lead to all sorts of networking issues.

Examples of setting it:

#define APPNAME my_awesome_app
IOTAppStory(APPNAME, ...);

begin () {
    // C++-style appname + mac
    IAS.preSetConfig(APPNAME"_" + WiFi.macAddress());

    // C-style w. sprintf (ex. "ESP_DEF123")
    char hostString[16] = {0};
    sprintf(hostString, "ESP_%06X", ESP.getChipId());
    IAS.preSetConfig(hostString, false);

    // Now start it up
    IAS.start();
}

preSetConfig(string ssid, string password, bool automaticUpdate)

Set the WiFi credentials without going through the captive portal.

preSetConfig(string ssid, string password, string boardName, bool automaticUpdate)

As the two above; sets WiFi credentials and boardName.

preSetConfig(string ssid, string password, string boardName, string url1, string url2, bool automaticUpdate)

As above + set urls for contacting IOTAppStory.com. Generally not needed.

addField(char* var, string fieldName, string fieldVar, uint maxLen)

These fields are added to the config wifimanager and saved to eeprom. Updated values are returned to the original variable.

char* LEDpin = "D4";

setup () {
    IAS.addField(LEDpin, "ledpin", "ledPin", 2);
    IAS.begin();
}

loop () {
    IAS.buttonLoop();
    // dPinConv() converts pin-name to appropriate number
    pinMode(IAS.dPinConv(LEDpin), OUTPUT);
}

begin(bool bootstat, char ea)

Set up IAS and start all dependent services.

If bootstat is true, the code will keep track of number of boots and print contents of RTC memory.

If ea is 'F' (full), the entire EEPROM (including wifi credentials and IAS activation code) will be erased on first boot of the sketch/app.

If ea is 'P' (partial), some of the EEPROM (excluding wifi credentials and IAS activation code) will be erased on first boot of the sketch/app.

If ea is 'L' (leave intact), none of the EEPROM (including wifi credentials and IAS activation code) will be erased on first boot of the sketch/app.

buttonLoop()

Checks if the button is depressed and what mode to enter when once it is released. Call in loop().

callHome(bool spiffs)

Calls IOTAppStory.com to check for updates. OK to call every ~5 minutes in development, but production setups should call at most every two hours.

If spiffs is true, the call also checks if there is a new filesystem image to download.

dPinConv(...)

See addField()

Contributions and thanks

For Wifi AP management we forked and modified the WifiManager from kentaylor which in its turn was a fork from tzapu

Thanks to msiebuhr for this readme file.

And thankyou to all of you who made a pull request

esp8266-library's People

Contributors

cwlbroeders avatar izanette avatar joeybab3 avatar msiebuhr avatar onno-dirkzwager avatar pbek avatar potatox avatar riccpt avatar rotzbua avatar sensorsiot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.