This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from datetime import timedelta, datetime | |
API_KEY = "YOUR_API_KEY" | |
PROJECT_ID = "YOUR_PROJECT_ID" | |
base_url = 'https://api.golioth.io/v1/projects/' + PROJECT_ID | |
def getStream(start, end, fields): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: 'sglahn/platformio-core:latest' | |
dir: . | |
args: ['run'] | |
artifacts: | |
objects: | |
location: 'gs://$PROJECT_ID-firmwares/$TAG_NAME' | |
paths: ['/workspace/.pioenvs/esp32/firmware_esp32.bin','/workspace/.pioenvs/esp8266/firmware_esp8266.bin'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[common] | |
build_flags = '-DVERSION="1.2.0"' | |
extra_scripts = pre:extra_script.py | |
monitor_speed = 115200 | |
lib_deps_external = | |
tzapu/WiFiManager#development | |
[env:esp8266] | |
platform = espressif8266 | |
board = nodemcuv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Check if needs to update the device and returns the download url. | |
*/ | |
String getDownloadUrl() | |
{ | |
HTTPClient http; | |
String downloadUrl; | |
USE_SERIAL.print("[HTTP] begin...\n"); | |
String url = CLOUD_FUNCTION_URL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { BigQuery } = require( '@google-cloud/bigquery' ) | |
const semver = require( 'semver' ) | |
const projectId = process.env.GCLOUD_PROJECT | |
const bqClient = new BigQuery( { projectId } ) | |
/** | |
* Responds to any HTTP request. | |
* @param {!express:Request} req HTTP request context. | |
* @param {!express:Response} res HTTP response context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup(){ | |
/* ... */ | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
int ledState = LOW; | |
const long interval = 1000; | |
unsigned long previousMillis = 0; | |
void loop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require( 'path' ) | |
/** | |
* Generic background Cloud Function to be triggered by Cloud Storage. | |
* | |
* @param {object} data The event payload. | |
* @param {object} context The event metadata. | |
*/ | |
exports.insertFirmwaresOnBigquery = ( data, context ) => { | |
const file = data; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Listen to devices changes on Firestore | |
* and update the current state | |
*/ | |
function loadDevices() { | |
const db = firebase.firestore(); | |
db.collection('devices').onSnapshot(snapshot => { | |
const devices = snapshot.docs.map(doc => doc.data()); | |
this.setState( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const Geopoint = require('geopoint'); | |
const googleapis = require('googleapis'); | |
admin.initializeApp(); | |
const GeoPointFirestore = admin.firestore.GeoPoint; | |
const db = admin.firestore(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
author: Alvaro Viebrantz | |
description: An asset tracker project | |
version: 1.0 | |
libs_version: 1.21 | |
modules_version: 1.21 | |
mongoose_os_version: 1.21 | |
# Optional. List of tags for online search. | |
tags: |
NewerOlder