Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adrianmihalko
adrianmihalko / sonoff.yaml
Last active January 28, 2019 20:58
Sonoff, Esphome
esphomeyaml:
name: sonoff_1
platform: ESP8266
board: esp01_1m
wifi:
ssid: ''
password: ''
manual_ip:
@adrianmihalko
adrianmihalko / gist:dfab154681775538087d97baf704f990
Created January 15, 2019 21:36
Esphomeyaml Sonoff S20 for Home Assistant
This configuration allows you to use physical button on your Sonoff S20, add one button to Home Assistant and for safe turn off after x minutes.
esphomeyaml:
name: sonoffs20_esphomeyaml_1
platform: ESP8266
board: esp01_1m
wifi:
ssid: ''
password: ''
@adrianmihalko
adrianmihalko / gist:ff01b7b3c0321d0fcb1cfa9935ea6ff2
Created January 11, 2019 14:10
Custom DDNS on Ubiquiti USG for specific interface
/etc/cron.hourly/ddns:
#!/bin/bash
YDNS_USER=
YDNS_PASSWD=
HOST=.ydns.eu
INTERFACE=pppoe0
IP=$(ip address show ${INTERFACE} | grep 'inet ' | awk '{print $2}')
curl --basic -u "$YDNS_USER:$YDNS_PASSWD" --silent "https://ydns.io/api/v1/update/?host=${HOST}&ip=${IP}"
@adrianmihalko
adrianmihalko / update.sh
Created January 13, 2018 17:38
Letsencrypt update script, restart service if success and notify with ssmtp
SERVER="Ubuntu (192.168.1.54)"
EMAIL='hello@gmail.com'
ALERTMESSAGE='/tmp/ALERTMESSAGE_cert.tmp'
if /usr/bin/openssl x509 -checkend 86400 -noout -in /etc/letsencrypt/live/my.domain.eu/fullchain.pem
then
echo "Certificate is good for another day!"
else
echo "To: $EMAIL" > $ALERTMESSAGE
@adrianmihalko
adrianmihalko / miflora-domoticz.py
Created December 10, 2017 14:30
Miflora Domoticz
#!/usr/bin/env python3
#usage:
#python3 ./miflora-domoticz.py --idx_temp 61 --idx_lux 62 --idx_moist 63 --idx_cond 64 --backend gatttool poll C4:7C:8D:63:7A:11
import argparse
import re
import logging
#domoticz