Skip to content

Instantly share code, notes, and snippets.

@lordneon
lordneon / steps.md
Last active April 26, 2024 09:58
UK Light Wiring with Shelly 1

Intro

This is a simple guide on how to automate UK lights with a Shelly 1 by installing the shelly 1 relay into the ceiling pendant which has both permanent live, neutral and a switched live back from the wall switch.

These steps are from my own experience making my lighting "smart" but also user friendly (it works via a wall switch!). This simple guide will go through replacing an a normal ceiling pendant with one with room for a Shelly 1. If you have a ceiling light with a bigger base it's even easier.

Warning Electrical regulations must be followed by law. If you are not a competent person under the regulations do not attempt electrical work. https://www.diydoctor.org.uk/projects/electrical_safety.htm

Wiring Diagram

This diagram has been taken from here and modified to include the Shelly 1. Wiring Diagram

@hisnameisjimmy
hisnameisjimmy / le-install.sh
Last active March 14, 2022 22:14
Unifi Controller one-shot install script for Ubuntu 16.04 with Lets Encrypt
#!/bin/sh
#
# This script stands on the shoulders of giants.
#
# You can always find the most recent version here: https://gist.github.com/hisnameisjimmy/56f9414076ca39a79bfa07eefa89759e
#
# It is written and tested for Ubuntu 16.04 on Digital Ocean using a 1GB droplet.
# Anything less than 1GB of memory may cause issues with anything memory intensive
# like imports/exports.
#
function PostsDAO(db) {
"use strict";
if (false === (this instanceof PostsDAO)) {
console.log('Warning: PostsDAO constructor called without "new" operator');
return new PostsDAO(db);
}
var posts = db.collection("posts");
@bmcbride
bmcbride / postgis_geojson.php
Created February 26, 2012 05:43
PHP PostGIS to GeoJSON
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*