PlatformIO Community

Thinger.io not working with Platformio


#1

Hi Every one

I am making ESP8266 project to link to Thinger io cloud using thinger.io library 2.13.0 using PlatformIO core 3.6.7 and Arduino framework.
When building project many errors generated pointing that missed (;)s in thiner.io source .CPP file but actually same code is working properly without ant modifications on Arduino IDE 1.8.9


#2

Kindly support if anybody used thinger.io successfully with PlatformIO before.


#3


#4

Please post your exact platformio.ini and the source code you’re trying to compile.


#5

Hi @maxgerhardt,
Thanks for interesting to support, here below is the full code test along with platformio.ini file.
======================== Code =======================================

#define _DEBUG_
#include <ThingerESP8266.h>
#include <ESP8266WiFi.h>
#define USERNAME "user"
#define DEVICE_ID "device_name"
#define DEVICE_CREDENTIAL "------------------"
#define SSID "Network_Name"
#define SSID_PASSWORD "Password"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
bool led_status = 0;
unsigned long old_time, current_time;
void setup()
{
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    led_status = 0;
    Serial.begin(115200);
    thing.add_wifi(SSID, SSID_PASSWORD);
    old_time = millis();
    // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
    // thing["led"] << digitalPin(LED_BUILTIN);
    thing["led"] << invertedDigitalPin(LED_BUILTIN);
    // resource output example (i.e. reading a sensor value)
    thing["millis"] >> outputValue(millis() / 1000);
    thing["led_status"] >> outputValue(led_status);
}
void loop()
{
    thing.handle();
    if (digitalRead(LED_BUILTIN))
        led_status = 0;
    else
        led_status = 1;
    current_time = millis();
    if ((current_time - old_time) > 1000) {
        old_time = current_time;
        thing["led_status"] >> outputValue(led_status);
    }
}

========================= ini file =============================

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 115200
; set frequency to 160MHz
board_build.f_cpu = 160000000L
; set frequency to 80MHz
board_build.f_flash = 80000000L
board_build.flash_mode = qio
upload_speed = 921600

#6

There is an actual error in that library… unforturnately, as always, it’s not where the compiler says it it… it’s just that it realised by that point there is an error. :-/

On line 82 of thinger_resource.hpp, there is a ; missing.

image

Easiest way to get to it is to build the code again, and then when the build errors appear, Ctrl+click on that first one to open it, and it will jump to line 87… then add that missing ; to 82, and it should be fine.

btw, you can add lib_deps = thinger.io to your platformio.ini so that platformio can install / update the library itself.

PS: Actually, if do you lib_deps = https://github.com/thinger-io/Arduino-Library/archive/2.13.0.zip instead of the one I gave above, you’ll get the fixed version of that library. I was about to submit a pull request with the correction, then realised it’s already fixed… but for some reason platformio is getting wrong version somehow? You may need to delete the .piolibdeps folder to make sure you don’t have two different copies of that library in your project.


#7

@ivankravets What needs to be done to unstick this library… seems to be stuck several commits back, and is using the commit version of the code as it was at that point, rather than the released version. Do they need to push a minor version release to clear it, or is it something you can refresh your end?


#8

This happens when library maintainers do a fix to a library and didn’t increment patch version. Instead, they keep the same release tag but point to modified commit.

I’ve just forced to re-update this library and everything should work. What need to do?

  1. pio lib uninstall thinger.io
  2. Or, remove .piolibdeps or .pio folder from a project
  3. Run pio update - it will remove PlatformIO Core cache
  4. Add to project lib_deps = thinger.io…

Thanks!