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 socket | |
data = bytes([ 0x03, 0x01, 0x00]); | |
group = 'ff04::123' | |
REMOTE_PORT = 1884 | |
network_interface = 'enp4s0' # Change to the actual interface name | |
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) | |
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, network_interface.encode()) | |
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, 32) |
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 Lorawan_Downlink( uint8_t *Buffer, uint8_t BufferSize, uint8_t Port, uint16_t RSSI, uint16_t SNR ) { | |
printk("Downlink data received: \n"); | |
for(int i=0; i < BufferSize; i++ ) | |
printk("%02X ", Buffer[i]); |
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
/* | |
* Copyright (c) 2020 Manivannan Sadhasivam <mani@kernel.org> | |
* | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
#include <init.h> | |
#include <errno.h> | |
#include <lorawan/lorawan.h> | |
#include <zephyr.h> |
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
/* | |
* Copyright (c) 2020 Manivannan Sadhasivam <mani@kernel.org> | |
* | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
#ifndef ZEPHYR_INCLUDE_LORAWAN_LORAWAN_H_ | |
#define ZEPHYR_INCLUDE_LORAWAN_LORAWAN_H_ | |
/** |
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 Web3 = require('web3'); | |
const provider = new Web3.providers.HttpProvider("http://localhost:7545"); | |
const web3 = new Web3(provider); | |
/*web3.eth.net.isListening() | |
.then(() => console.log('web3 is connected')) | |
.catch(e => console.log('Wow. Something went wrong')); | |
*/ | |
( async() => { |
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
[{"id":"fa93e49d.59c9d","type":"function","z":"44ba6b13.5c4d64","name":"IIR Low Pass Filter","func":"// IIR LPF factors\n f_a0 = 0.0010227586546542474; // Input factors\n f_a1 = 0.002045517309308495;\n f_a2 = 0.0010227586546542474;\n \n f_b1 = -1.9066459797557103; // Output factors\n f_b2 = 0.9107370143743273;\n\n// PPM 1.0 input variables\nvar i0_c10 = msg.payload.cPM10;\nvar i1_c10 = context.get('i1_c10') || 0;\nvar i2_c10 = context.get('i2_c10') || 0;\n\n// PPM 1.0 output variables\nvar o0_c10 = context.get('o0_c10') || 0;\nvar o1_c10 = context.get('o1_c10') || 0;\n\n\n// Calculate the IIR\nvar lpf = i0_c10 * f_a0 + \n i1_c10 * f_a1 + \n i2_c10 * f_a2 - // We add the negative output factors\n o0_c10 * f_b1 - \n o1_c10 * f_b2;\n \n// Memorize the variables\ncontext.set( 'i2_c10' , i1_c10 );\ncontext.set( 'i1_c10' , i0_c10 );\n\ncontext.set( 'o1_c10' , o0_c10 );\ncontext.set( 'o0_c10' , lpf );\n\n// PPM 2.5 input variables\nvar |
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 OpenIdClient = require("openid-client"); | |
const identityUrl = "http://127.0.0.1:3000/"; | |
const clientId = "user1"; | |
const clientSecret = "password"; | |
async function GetAccessToken() { | |
var issuer = await OpenIdClient.Issuer.discover(identityUrl); |
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
/** | |
* PostgresMiddleware.js | |
* | |
* Handles postgres queries and caching to redis | |
* see README for usage | |
* | |
*/ | |
var pg = require('pg'), | |
crypto = require('crypto'), |
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
[{"id":"c69b35de.5b1288","type":"tab","label":"Power Meter Dash","disabled":false,"info":"Power Meter DashBoard"},{"id":"11b29614.713a5a","type":"mqtt in","z":"c69b35de.5b1288","name":"PM Telemetry","topic":"iot/device/ESP8266_PowerMeter/telemetry","qos":"2","datatype":"auto","broker":"2a552b3c.de8d2c","x":140,"y":60,"wires":[["4f01e095.a6b468"]]},{"id":"4f01e095.a6b468","type":"json","z":"c69b35de.5b1288","name":"To JSON","property":"payload","action":"","pretty":false,"x":350,"y":60,"wires":[["3afc46aa.19ff9a","b4966155.90ad9","4e1496c4.95576","2cdca24.0a446de","3c7e559f.3df0ea","db4513ed.467ef8"]]},{"id":"3afc46aa.19ff9a","type":"function","z":"c69b35de.5b1288","name":"Voltage (V)","func":"msg.payload = Number(msg.payload.V);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":60,"wires":[["c2e720c3.2121d","f13ac150.bfe46"]]},{"id":"b4966155.90ad9","type":"function","z":"c69b35de.5b1288","name":"Current (I)","func":"msg.payload = Number(msg.payload.I);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":120,"wires |
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
functionGlobalContext: { | |
// os:require('os'), | |
// octalbonescript:require('octalbonescript'), | |
// jfive:require("johnny-five"), | |
// j5board:require("johnny-five").Board({repl:false}) | |
gcm:require('node-gcm'), | |
cryptojs:require('crypto-js') | |
}, |
NewerOlder