Skip to content

Instantly share code, notes, and snippets.

@ubi-gists
ubi-gists / onboarding_dashboard.json
Last active February 27, 2024 23:19
A dashboard template for Ubidots onboarding
[
{
"__model__": "dashboard",
"label": "onboarding-wip2",
"name": "Demo Dashboard",
"description": "",
"tags": [],
"context": {
"size": {
"width": "1366",
[
{
"__model__": "dashboard",
"label": "ncd-ota",
"name": "NCD OTA",
"description": "",
"tags": [],
"context": {
"size": "auto",
"alignment": "center",
[
{
"id": "1e3ade0e.dd0622",
"type": "tab",
"label": "Data and Device Manager",
"disabled": false,
"info": ""
},
{
"id": "otaManager",
/*
* The sample code requires the ESP8266 v.2.0.0 library for proper operation.
* (https://github.com/ubidots/ubidots-esp8266/releases/tag/2.0.0)
* However, is strongly recommended to migrate the code to the latest library version.
* (https://github.com/ubidots/ubidots-esp8266)
*/
#include <Wire.h>
#include "UbidotsMicroESP8266.h"
/* Constants */
const request = require('request-promise');
const TOKEN = "PUT_YOUR_UBIDOTS_TOKEN_HERE"; // Assign your Ubidots TOKEN
/* Decodes the hex frame coming from the SigFox callback – Thinxtra device */
function decodeHexFrame(data) {
var buf = new Buffer.from(data, "hex");
var temperatura = buf.readInt16LE() / 100;
// This #include statement was automatically added by the Particle IDE.
#include <Ubidots.h>
// This #include statement was automatically added by the Particle IDE.
#include <Current_Monitor.h>
#ifndef TOKEN
#define TOKEN "put_your_ubidots_token_here" // Put here your Ubidots TOKEN
#endif
/*************************************************************************************************
* This example get the last value of a variable from the Ubidots Cloud(www.ubidots.com) to control
* a Led.
*
* Requirements:
* 1. In the Device section, create a new device called "control"
* 2. Into the device just created, create a new default variable called "led"
* 3. In the Dashboard section, create a new "switch" control widget to control the led :)
*
* IMPORTANT NOTE: Don't forget assign your WiFi credentials, ubidots token, and the pin where the
/*************************************************************************************************
* This Example sends harcoded data to Ubidots using a ESP32. The code sends a distance value
* between a device and its opposite endpoint to Ubidots, then the value will be managed in
* Ubidots to calculate the volume of a tank with the characteristics of your tank.
*
* This example is given AS IT IS without any warranty.
*
* Made by María Carlina Hernandez.
*************************************************************************************************/
@ubi-gists
ubi-gists / UbidotsAPI_PubNub_BLOCKS.js
Last active June 1, 2017 02:16
Manages data between Ubidots and PubNub
// https://ubidots.com/docs/api/index.html
export default (request) => {
const xhr = require('xhr');
const queryStringCodec = require('codec/query_string');
const token = request.message.token || '';
const apiKey = request.message.apiKey || '';
const action = request.message.action;
const payload = request.message.payload;
const labelDevice = request.message.labelDevice;
const variableLabel = request.message.variableLabel;
// Made by: Maria Carlina Hernandez
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "..." // Your Ubidots TOKEN
#define WIFINAME "..." //Your SSID