If I complile my code this error occures:
C:\Users\USER\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:47:5: warning: control reaches end of non-void function [-Wreturn-type]
The Telegram Bot that is icluded in this code works fine. But the implementation of https://thinger.io/ doesnt work because of the error message
#include <ThingerWifi.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Wire.h>;
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include <ArduinoJson.h>
#include <ThingerESP8266.h>
const char* ssid = "Martin Router King";
const char* password = "paassword";
//thingerio diggi
#define USERNAME "username"
#define DEVICE_ID "id"
#define DEVICE_CREDENTIAL "credential"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
#define BOTtoken "botToken"
#define CHAT_ID "chat_id"
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);
int botRequestDelay = 1000;
unsigned long lastTimeBotRan;
float t, f, d;
Adafruit_BME280 bme;
// Handle what happens when you receive new messages
void handleNewMessages(int numNewMessages) {
Serial.begin(115200);
Serial.println("handleNewMessages");
Serial.println(String(numNewMessages));
bool status;
status = bme.begin(0x76);
for (int i=0; i<numNewMessages; i++) {
// Chat id of the requester
String chat_id = String(bot.messages[i].chat_id);
if (chat_id != CHAT_ID){
bot.sendMessage(chat_id, "Mit dir rede ich nicht!!! Du hast hier nix zu melden!!!", "");
continue;
}
// Print the received message
String text = bot.messages[i].text;
Serial.println(text);
String from_name = bot.messages[i].from_name;
if (text == "/start") {
String welcome = "Du hast also keine Lust auf nasse Wände? Gute Entscheidung!!!, " + from_name + ".\n";
welcome += "Das kann ich bis jetzt für mehr Funktionen musst du mal Philip fragen. \nDer kann da bestimmt was drehn´ \n\n";
welcome += "/temp für die Temperatur im Badezimmer. \n";
welcome += "/hum für die aktuelle Luftfeuchtigkeit im Badezimmer. \n";
welcome += "/druck für den Aktuellen Luftdruck im Badezimmer. \n";
bot.sendMessage(chat_id, welcome, "");
}
if (text == "/temp") {
t = bme.readTemperature();
Serial.println("Temperaur abgefragt!");
Serial.print(t);
String messageTemp = "Die Temperatur beträgt gerade " + String(t) + "°C \n";
bot.sendMessage(chat_id, messageTemp);
}
if(text == "/hum"){
f = bme.readHumidity();
Serial.println("Luftfeuchtigkeit abgefragt!");
Serial.print(f);
String messageHum = "Die Luftfeuchtigkeit liegt bei " + String(f) + "% \n";
bot.sendMessage(chat_id, messageHum);
}
if(text == "/druck"){
d = bme.readPressure();
Serial.println("Luftdruck abgefragt!");
Serial.print(d);
// Serial.println("Luftdruck abgefragt!" +druck);
bot.sendMessage(chat_id, "Der Luftdruck im Badezimmer beträgt: \n");
}
}
}
void setup() {
Serial.begin(115200);
#ifdef ESP8266
client.setInsecure();
#endif
// Connect to Wi-Fi
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
// Print ESP32 Local IP Address
Serial.println(WiFi.localIP());
thing.add_wifi(ssid, password);
thing["Temperatur"] >> [](pson& out){
out = bme.readTemperature();
};
thing["Luftfeuchtigkeit"] >> [](pson& out){
out = bme.readHumidity();
};
thing["Luftdruck"] >> [](pson& out){
out = bme.readPressure();
};
}
void loop() {
thing.handle();
if (millis() > lastTimeBotRan + botRequestDelay) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
while(numNewMessages) {
Serial.println("got response");
handleNewMessages(numNewMessages);
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
}
lastTimeBotRan = millis();
}
}