Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
LarsBergqvist / automation.yaml
Last active November 10, 2017 17:55
A Home Assistant automation rule for sending ios notifications on sensor state changes
automation:
alias: Notify Lars when door is opened
trigger:
platform: state
entity_id: sensor.front_door_opened
action:
service: notify.ios_larsiphone
data:
message: The front door has been opened!
@LarsBergqvist
LarsBergqvist / grafana.ini
Created October 22, 2017 18:21
Grafana configuration
[server]
# Protocol (http, https, socket)
protocol = http
# The ip address to bind to, empty will bind to all interfaces
;http_addr =
# The http port to use
http_port = 3000
@LarsBergqvist
LarsBergqvist / grafana_installation.sh
Created October 22, 2017 18:15
Grafana installation for Raspberry Pi with Jessie / Debian 8
sudo apt-get install apt-transport-https curl
curl https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana
@LarsBergqvist
LarsBergqvist / influxdb.conf
Created October 22, 2017 18:01
InfluxDB setup
[http]
# Determines whether HTTP endpoint is enabled.
enabled = true
# The bind address used by the HTTP service.
bind-address = ":8086"
# Determines whether user authentication is enabled over HTTP/HTTPS.
auth-enabled = false
@LarsBergqvist
LarsBergqvist / influxdb_rpi_installation.sh
Last active October 22, 2017 17:57
Installation of InfluxDB on a Raspberry Pi with Jessie/Debian 8
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apt-transport-https
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add - source /etc/os-release
echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
sudo apt-get install influxdb
@LarsBergqvist
LarsBergqvist / blynk_example.cpp
Created August 10, 2017 15:54
Blynk example without setup() and loop()
#include <Arduino.h> // Arduino basic stuff
#include <WiFi.h> // WiFi-library needed for Blynk
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h> // Include Blynk library
#include "credentials.h" // Keep WiFi and Blynk credentials in a separate file
//
// BEEP/BUZZER
// Called when the value of V1 is written to the Blynk server
// V1 is connected to a button in the GUI. When the button is pressed, the V1=1
@LarsBergqvist
LarsBergqvist / setup_and_loop.cpp
Last active September 9, 2017 19:08
setup() and loop() for blynk example
void setup()
{
Serial.begin(9600);
pinMode(BEEP_PIN, OUTPUT);
dht.begin();
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,16),8442);
timer.setInterval(TIMER_INTERVAL, timerEvent);
}
void loop()
@LarsBergqvist
LarsBergqvist / credentials.h
Created August 10, 2017 15:44
Credentials example for a Blynk project
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "a89e439b754d4d9888ecaa74c7b0e61a";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YOUR WIFI SSID";
char pass[] = "YOUR WIFI PASSWORD";
@LarsBergqvist
LarsBergqvist / platformio.ini
Created August 10, 2017 14:33
platformio.ini example for ESP32 board using Blynk with a DHT22 sensor
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps=
https://github.com/blynkkk/blynk-library
https://github.com/adafruit/Adafruit_Sensor
https://github.com/adafruit/DHT-sensor-library
@LarsBergqvist
LarsBergqvist / platformio.ini
Created August 8, 2017 10:34
Platform IO ini-file example
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html