So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Merkur
#73015 I definitely think you are on the right track with the EEPROM working differently in the Huzzah ESP8266. I have got past the original compilation error (fatal error: avr/eeprom.h: No such file or directory). I did this by changing the #include statement in the ESP8266EastIoT.cpp file from <avr/eeprom.h> to <EEPROM.h> based on asuggestion from another forum.

The error I get now is:
    Arduino: 1.8.5 (Windows 10), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"

    E:\Users\Paul\Documents\Arduino\libraries\Esp8266EasyIoT\Esp8266EasyIoT.cpp: In member function 'void Esp8266EasyIoT::begin(void (*)(const Esp8266EasyIoTMsg&), int, Stream*, Stream*)':

    E:\Users\Paul\Documents\Arduino\libraries\Esp8266EasyIoT\Esp8266EasyIoT.cpp:58:84: error: 'eeprom_read_block' was not declared in this scope

    eeprom_read_block((void*)&_nodeId, (void*)EEPROM_NODE_ID_ADDRESS, sizeof(uint16_t));

    ^
    E:\Users\Paul\Documents\Arduino\libraries\Esp8266EasyIoT\Esp8266EasyIoT.cpp: In member function 'bool Esp8266EasyIoT::process()':

    E:\Users\Paul\Documents\Arduino\libraries\Esp8266EasyIoT\Esp8266EasyIoT.cpp:231:92: error: 'eeprom_write_block' was not declared in this scope

    eeprom_write_block((void*)&_nodeId, (void*)EEPROM_NODE_ID_ADDRESS, sizeof(uint16_t));

    ^
    exit status 1
    Error compiling for board Adafruit HUZZAH ESP8266.


I think that there may be an incompatibility or version problem between the main program (esp8266easyiot_temperature_humidity) and the libraries. Unfortunately I lack the programming experience to move forward and debug this.

The example hardware/software setup I am using is from the IOT-Playground site and I have bought five 8266 modules in anticipation of getting this working. The code was written by Igor Jarc and I downloaded the Arduino Sketch and associated libraries.
Unfortunately there appears to be an issue with the support forums on the IOT-Playground site so I cannot seek their help in debugging.

Thanks in anticipation of help here.

Paul
User avatar
By btidey
#73034 I didn't bother with using the easyIOT library which had way to much stuff in for what I wanted.

To report a value to easyIOT using for example their REST method is very easy as it just means making a http post request with the right value.

A typical url minus host:port is to send a value e.g. a temperature of 23.5 to a virtual sensor is

/Api/EasyIoT/Control/Module/Virtual/N1S0//ControlLevel/23.5

So code fragment is just
Code: Select all      cClient.print(String("POST ") + url + " HTTP/1.1\r\n" +
            "Host: " + String(EIOT_IP_ADDRESS) + "\r\n" +
            "Connection: close\r\n" +
            "Authorization: Basic " + unameenc + " \r\n" +
            "Content-Length: 0\r\n" +
            "\r\n");


where cClient is a WifiClient connected to the easyIOT host and port and unameenc is the base64 encoded password to access the host.
User avatar
By Merkur
#73786 Thanks. I have made quite a bit of progress with integrating the ESP8266 with Easy IoT. I am reading values and have successfully sent the temp/humidity values to EasyIoT via a wifi connection. I have also got the battery level monitoring working and like the simplicity of the interface.

Now I have cleaned up the code and implimented the DeepSleep mode which works OK. 75mA when awake and 85uA when sleeping. In an attempt to minimize the 'awake' time of the ESP8266, I have cleaned up the code to read all the sensor values, form all the url 'POSTs', then connect to WiFi, transmit all the URLs then disconnect and go into sleep mode.

This does not appear to work as anticipated and the documentation, and support of EasyIoT leaves a lot to be desired. What happens is that only the first 'Post' is recognized by the dashboard. Subsequent urls are ignored. Wheat I think is happening is that EasyIoT is expecting one URL to be transmitted per connect cycle. Is this correct? Is there something needed in between transmissions to let EasyIoT know that another url is being sent?

The urls are being correctly formed as I can see by the serial.print debug outputs:

Code: Select all==========
Battery Level:  3.39 Volts (90%)
Temperature DS18B20: 71.15
Humidity DHT: 17.80 %   Temperature DHT: 72.68 *F
Connecting to AP ........
WiFi connected
Connecting client ...
Client connected.
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N9S0/ControlLevel/71.15
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N9S0/ControlBattery/90.00
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N13S0/ControlLevel/72.68
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N13S0/ControlBattery/89.00
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N14S0/ControlLevel/17.80
Sending POST data to URL: /Api/EasyIoT/Control/Module/Virtual/N14S0/ControlBattery/89.00
Putting WiFi to sleep for 20 seconds.


Thanks for everyone's continued help with this project.

Paul
User avatar
By btidey
#73795 In my ESP temp sensing modules I use a easyIOTReport function which is called whenever I want to report a value.

This function includes a clientConnect to the easyIOT host/port so that is called every time a value is reported.

I suspect the easyIOT is closing the connection after getting a POST.