Skip to content

Instantly share code, notes, and snippets.

View hastarin's full-sized avatar

Jon Benson hastarin

  • Champion Data
  • Melbourne, Australia
View GitHub Profile
@hastarin
hastarin / google-assistant-relay-to-speaker.json
Created May 23, 2020 10:52
Using Google Relay Assistant in Home Assistant and playing back responses
[{"id":"4559289f.b3b438","type":"tab","label":"Assistant Relay","disabled":false,"info":""},{"id":"a87f10d7.69ca1","type":"delay","z":"4559289f.b3b438","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"20","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":340,"y":140,"wires":[["e4181900.7ce448"]]},{"id":"cc5745c5.422758","type":"http request","z":"4559289f.b3b438","name":"post","method":"POST","ret":"obj","paytoqs":false,"url":"http://localhost:3000/assistant","tls":"","persist":false,"proxy":"","authType":"","x":770,"y":140,"wires":[["613a534a.7da58c"]]},{"id":"e4181900.7ce448","type":"function","z":"4559289f.b3b438","name":"set payload and headers","func":"msg.message = msg.payload;\nmsg.payload = {\n \"name\": \"Jon\",\n \"command\": msg.message,\n \"broadcast\": false\n};\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":140,"wires":[["cc574
@hastarin
hastarin / DynamicCsvColumnRename.linq
Created October 7, 2019 00:07
Using Regex renaming for EFCorePowerTools
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Dynamic.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Globalization.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Text.RegularExpressions.dll</Reference>
<NuGetReference>Humanizer.Core</NuGetReference>
<NuGetReference>Newtonsoft.Json</NuGetReference>
<Namespace>Humanizer</Namespace>
<Namespace>Newtonsoft.Json</Namespace>
<Namespace>Newtonsoft.Json.Converters</Namespace>
<Namespace>System.Dynamic</Namespace>
@hastarin
hastarin / gist:984d17f5b828fdc67ac9e6d4decc71de
Created May 13, 2018 01:12
Home Assistant Notes for InfluxDb and Grafana 5.x on Raspian Stretch
I found a gist for InfluxDB here:
https://gist.github.com/boseji/bb71910d43283a1b84ab200bcce43c26
I followed that but replaced jessie with stretch.
Thanks to @fg2it we have a build of Grafana for the Pi complete with instruction to install here:
https://github.com/fg2it/grafana-on-raspberry/wiki
I went for the Bintray option so I'll get updates.
@hastarin
hastarin / Unhandled Exception Logging
Created December 23, 2017 23:10
Unhandled Exception Logging
// Hook in App.OnStartup
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (!e.IsTerminating)
{
return;
}
@hastarin
hastarin / esp8266_dht22_mqtt.ino
Created April 7, 2017 13:10
ESP8266 Feather HUZZAH with DHT22 using WiFiManager and PubSub for MQTT publishing with Home Assistant
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <DHT.h>
#include <DHT_U.h>
#include <PubSubClient.h> //https://github.com/knolleary/pubsubclient
@hastarin
hastarin / Resources.resw
Last active December 4, 2016 03:10
Resources.resw template file for use with HastPiControl
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes