Skip to content

Instantly share code, notes, and snippets.

View greghesp's full-sized avatar
🖐️

Greg Hesp greghesp

🖐️
View GitHub Profile
@greghesp
greghesp / functions.js
Last active August 1, 2019 08:27
Using Custom Email Templates with Firebase Authentication
exports.verifyEmail = functions.auth.user().onCreate(async(user) => {
try {
const token = crypto.randomBytes(48);
await admin.firestore().collection("users").doc(user.uid).set({
name: user.displayName,
});
await admin.firestore().collection("activationTokens").doc(user.uid).set({
token: token.toString('hex'),
expires: Date.now() + ( 3600 * 1000 * 24)
});
#include <Adafruit_MAX31865.h>
// Use software SPI: CS, DI, DO, CLK
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(3, 2, 1, 0);
// use hardware SPI, just pass in the CS pin
Adafruit_MAX31865 thermo = Adafruit_MAX31865(D1,D2,D3,D4);
// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF 430.0
// The 'nominal' 0-degrees-C resistance of the sensorS
@greghesp
greghesp / update_notification.yaml
Last active March 25, 2021 22:29
Home Assistant Update Notification for Android
blueprint:
name: Home Assistant Update Notification for Android
description: Send a notification when there's an update available for Home Assistant
domain: automation
input:
updater:
name: Update sensor
description: "The sensor which indicates if there's an update. Default is 'binary_sensor.updater'"
default: binary_sensor.updater
selector:
@greghesp
greghesp / tailwind-flex-wrap-row-space.html
Last active December 24, 2022 19:36
Tailwind Flex Wrap with Row spacing
// Apply negative value to the items you want to add to each child
// In this example, the first row and last items to the right will have the overlap the negative values to create the effect of them not being there
<div class="flex flex-wrap -mt-2 -mr-2">
// forEach, map etc
// Apply a positive value to the items you want to add to each child.
<div class="mt-2 mr-2">Loop Item</div>
</div>
@greghesp
greghesp / ColorLoop.json
Last active January 7, 2022 15:03
RGB Colour loop for a Home Assistant Light
[{"id":"ec22fd2d9a498086","type":"tab","label":"Color Loop","disabled":false,"info":"","env":[]},{"id":"5c960d526cfff1b2","type":"link in","z":"ec22fd2d9a498086","name":"","links":["dd2114c718df4892","5085829335ba248c","ac68dbc399f99fd1","f23f2d6854efbe20","2764c38f9e14979d"],"x":115,"y":60,"wires":[["8e09f9d06493bcb6"]]},{"id":"651e1d7c5572c654","type":"link out","z":"ec22fd2d9a498086","name":"","mode":"return","links":[],"x":1195,"y":60,"wires":[]},{"id":"8e09f9d06493bcb6","type":"change","z":"ec22fd2d9a498086","name":"Store RGB Color","rules":[{"t":"set","p":"status","pt":"flow","to":"status","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":60,"wires":[["c15001e6c435dbed"]]},{"id":"c15001e6c435dbed","type":"function","z":"ec22fd2d9a498086","name":"Set Flow Var","func":"if(!msg.entity) {\n node.status({\n text: 'No Light defined',\n shape: 'ring',\n fill: 'red'\n });\n return; \n}\n\nflow.set(\"i\", 0);\n\nreturn msg;","outputs":1,"noerr":0,"
@greghesp
greghesp / nodered
Created January 4, 2022 11:11
Node Red Error Handling Flow
[{"id":"9c2bbc33.ea38a8","type":"tab","label":"Error Handling","disabled":false,"info":""},{"id":"c5d148b4.60be08","type":"component_in","z":"9c2bbc33.ea38a8","name":"Error Handling","api":[{"name":"error","type":"any","required":false},{"name":"title","type":"string","required":false}],"x":130,"y":80,"wires":[["48d15bee.5c8144"]]},{"id":"fd5aeffe.53525","type":"file","z":"9c2bbc33.ea38a8","name":"Exception Log","filename":"/share/logs/node-red-exceptions.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":540,"y":60,"wires":[[]]},{"id":"751e1c04.0448a4","type":"debug","z":"9c2bbc33.ea38a8","name":"Errors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"48d15bee.5c8144","type":"function","z":"9c2bbc33.ea38a8","name":"Format","func":"let error = msg.error;\nlet title = msg.title;\nlet device = msg.topic;\n\nif(msg.topic == \"/config/home-assistant.log\
@greghesp
greghesp / esphome_ble_config.yaml
Last active May 26, 2023 18:01 — forked from kmdm/esphome_ble_config.yaml
esphome, esp32 ble tracker and Home Assistant mqtt_room sensors
# MQTT broker configuration
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_username
password: !secret mqtt_password
discovery: False # Only if you use the HA API usually
id: mqtt_client
# Define the room for this ESP32 node
substitutions:
esphome:
name: living-room-display
esp8266:
board: d1_mini
# Enable logging
logger:
level: DEBUG
esphome:
name: dressing-room-esp32
esp32:
board: mhetesp32minikit
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
esphome:
name: master-bedroom-oled-display
comment: Bedroom OLED with Glucose Levels
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging