Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
dexterlabora / meraki-mqtt-v1-asyncapi.yaml
Created April 28, 2022 14:02
DEV --- The is just a TEST schema for Meraki MQTT data.
asyncapi: '2.3.0'
info:
title: Meraki MQTT API
version: '1.0.0'
description: |
The Meraki MQTT service enables real-time telemetry from your network devices.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
@dexterlabora
dexterlabora / merakiFetchReport.gs
Created April 25, 2022 19:02
An add-on custom function to call a Meraki API and shape the data to fit a Google Sheet.
/**
* Fetches Meraki API data and formats the JSON data into Google Sheet format
* @param url url to pull json data from
* @param apiKey API key for authorization
* @param title The title text to display in the cell
* @param refresh Triggers a refresh of report when changed. Cannot use now() functions, so a helper "Refresh Reports" button will update a hidden _meraki_tools settings sheet to set a time, triggering the function to re-evaluate. You can optionaly set a Trigger to call the refreshReports function on a schedule.
* @return Google Sheet data
* @customfunction
@dexterlabora
dexterlabora / jsonata-openapi-parse-ops-paths.txt
Created February 12, 2021 11:38
JSONata - Parse Open API v2 Spec by Path, Operation, Description and Tags
/* OAS Path Ops and Tags */
(
$.paths.*#$index.**.operationId.{
/*"pathIndex": $index,*/
"path": $keys($$.paths)[$index],
"operationid": %.operationId,
"description": %.description,
"tags":%.tags
};
)
@dexterlabora
dexterlabora / v0-v1-path-operations-diff.json
Created September 4, 2020 20:24
Meraki API v0-v1-path-operations-diff.json
[
{
"oldPath": "/devices/{serial}/camera/qualityAndRetentionSettings",
"newPath": "/devices/{serial}/camera/qualityAndRetention",
"oldOperations": [
"getDeviceCameraQualityAndRetentionSettings",
"updateDeviceCameraQualityAndRetentionSettings"
],
"newOperations": [
"getDeviceCameraQualityAndRetention",
@dexterlabora
dexterlabora / reddit-power-temp-flows.json
Created July 28, 2020 17:24
Is basement humidity above 50%? Is current power draw in Watts below 5.0 on dehumidfier? Only if both of those are true, then trigger the next step in the flow.
[
{
"id": "8d3e6c8e.8cbc9",
"type": "inject",
"z": "e941d247.46185",
"name": "51%",
"props": [
{
"p": "payload"
},
@dexterlabora
dexterlabora / jsonata.txt
Created July 21, 2020 21:08
JSONata - Format OpenAPI Spec JSON for Vue V-Swagger component
(
/*
JSONata expression to:
Format OpenAPI Spec JSON for Vue V-Swagger component
https://www.npmjs.com/package/v-swagger
*/
$requestArray := $.paths.*#$pi.*#$i.{
@dexterlabora
dexterlabora / mr-mqtt-nr-simulator.json
Created August 21, 2019 13:32
A simulation of WiFi and BLE probes and MQTT communication network.
[
{
"id": "c100fe2a.cb152",
"type": "debug",
"z": "90fbc492.9c31f8",
"name": "Broker",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
@dexterlabora
dexterlabora / esp8266-sniffer
Created August 7, 2019 11:24
A fork of esp8266-sniffer to pipe probe requests the serial port in JSON format to be easily used with Node-RED, etc.
#include <ArduinoJson.h>
#include <iostream>
#include <ESP8266WiFi.h> // added this
#include <ESP8266HTTPClient.h> // added this
const char* serial = "YYYY-YYYY-YYYY"; // fake AP serial
const char* networkId = "N_99999999999"; // fake network ID
const float txPower = 20.5; // power in dBm (0 - 20.5)
@dexterlabora
dexterlabora / parsePathParams.js
Created April 12, 2019 08:48
Regex to replace URL path params with values
var path = '/network/{id}/device/{serial}';
params = {
id:"123456",
serial: "abcd-abcd-abcd"
}
var paramNames = Object.keys(params);
console.log('paramNames', paramNames);
@dexterlabora
dexterlabora / vue.config.js
Created April 1, 2019 11:24
Meraki API proxy config for VueJS with Webpack
module.exports = {
devServer: {
proxy: {
"/api/*": {
target: "https://api.meraki.com/api/v0",
secure: false,
changeOrigin: true,
pathRewrite: {
"^/api": ""
},