I re-posted the same question received.
==========================
Hi Favoriot member,
I would like to publish data to your platform from my sensor node.
I'm using Raspberry Pi Node Red.
I already set requirement item but can not receive any data stream.
Could you advise more.
Thank you.
Best regards,
Nabilah
Dear Nabilah,
Please provide more information regarding this, ie. the code that you use.
Thank you.
Hi @gopish
In mqtt out node, setting as below:
server=mqtt.favoriot.com, port=1883, username&password=read writeAPI key,
topic=read writeAPI key/ Temperature, Qos=0, retain=true.
Hi guys,
I also encounter the same problem but with the board of ESP8266-12E. Although my serial monitor of Arduino IDE managed to display the sensor data, I cannot show the datastream. X0 means my wifi id, X1 means my wifi password and finally W2 means my Read/Write API key. Hence, I will be very appreciate if someone managed to help me about it ?
The code for my ESP is:
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
char ssid[] = "X0"; // change it!
char pass[] = "X1"; // change it!
const String myDevice = "Room@ccyedmund"; // change it!
//const String your_API_key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImNjeWVkbXVuZCIsInJlYWRfd3JpdGUiOnRydWUsImlhdCI6MTU3NTQ4NjQxNH0.QccJo7Q9H9em0yJyM93e_sljY2jQsIVzLCDkLtIdJ4g"; // change it!
char server[] = "api.favoriot.com";
int status = WL_IDLE_STATUS;
WiFiClient client;
void setup() {
Serial.begin(115200);
dht.begin();
WiFi.disconnect();
Serial.println("Connecting...");
WiFi.begin(ssid, pass);
while ((!(WiFi.status() == WL_CONNECTED))) {
delay(300);
Serial.print(".");
}
Serial.println(WiFi.status());
Serial.println("Connected!");
Serial.println("");
}
void loop() {
delay(5000);
Serial.println("-----------------");
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float k = t + 273.15;
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
Serial.print(k);
Serial.println (" *F");
Serial.println("-----------------");
Serial.print("Humidity: ");
Serial.print(h);
Serial.println(" % ");
Serial.println("===========================");
String myData = String(DHTPIN);
String json = "{\"myDevice_developer_id\":\"" + myDevice + "\",\"data\":{\"Temp\":\"" + t + "\",\"Humidity\":\"" + h + "\"}}";
Serial.println(json);
if (client.connect(server, 80)) {
client.println("POST /v1/streams HTTP/1.1");
client.println("Host: api.favoriot.com");
client.println(F("apikey: X2")); // change it!
client.println("Content-Type: application/json");
client.println("cache-control: no-cache");
client.print("Content-Length: ");
int thisLength = json.length();
client.println(thisLength);
client.println("Connection: close");
client.println();
client.println(json);
}
while (client.available()) {
char c = client.read();
Serial.write(c);
}
if (!client.connected()) {
client.stop();
}
delay(5000);
}
Please refer to the updated documentation to send and receive MQTT data at
https://platform.favoriot.com/tutorial/v2/#mqtt
Let us know if you still can't send data.
dear @nabilahd
Configuration
Send / Publish data
Use the following configuration to setup your device to send / publish data.
Host : mqtt.favoriot.com
Standard Ports: 1883 and 8883 ( for secure connection using TLS/SSL)
Websocket Port : 3000
Use your Read-write API-Key as username and password to connect to the platform.
ClientID (for some MQTT clients): Any name
Publish : {Your-API-Key}/v2/streams
Example : {Your-API-Key}/v2/streams
Receive / Subscribe
Use to the following configuration to receive / subscribe
Subscribe : {Your-API-Key}/v2/streams/status
Example : {Your-API-Key}/v2/streams/status
favoriot platform documentation : https://platform.favoriot.com/tutorial/v2/#mqtt
tutorial link : https://github.com/Favoriot/favoriot-mqtt-nodejs-tutorial
hi @ccyedmund
you need to change the some configuration such :
1. char server[] = "apiv2.favoriot.com";
2. client.println("POST /v2/streams HTTP/1.1");
3. String json = "{\"device_developer_id\":\"" + myDevice + "\",\"data\":{\"Temp\":\"" + t + "\",\"Humidity\":\"" + h + "\"}}";
tutorial link : https://github.com/Favoriot/MyFirstArduinoProject/blob/master/4.CompleteCode/4.CompleteCode.ino
favoriot platform documentation: https://platform.favoriot.com/tutorial/v2/#data
hi @gopish and @mohamad-nazrin,
I managed to publish the data after change the configuration as informed by both of you.Thank you.
I would like to understand more about favoriot platform.
1.How many data stream can be publish per day with the condition of '500 API calls per day for free plan'?
2.Is there any different in term of function features between 4 plan that offer by favoriot?
Thank you.
1. API call is used whenever there is interaction with the platform. The API call includes sending data, displaying data on platform, usage of graphs, creating devices, etc. So, the number of data that can be published is less than 500.
2. As described in the pricing page, the difference is the number of API calls. There are no differences in the features. As for the custom plan, it will be based on requirements such as a bigger number of API calls, private hosting, etc.
Thanks im using Wemos D1 R2 wifi and i change coding according above and sucessfuly send data....
2.Is there any different in term of function features between 4 plan that offer by favoriot?
Thank you.
Hi @nabilahd - The University plan is to ease the Faculty of Labs to control the usage of the Accounts and projects since the Accounts are owned by the University.
The customized plan is when a customer require to deploy commercial and big IoT solutions. It can be either on-premise or private clouds. Or we can customize the number of APIs as per your needs.
Take note that FAVORIOT will be introducing new features for Premium (Beginner Plan) users very soon. All these new features will be made available to them.