Skip to content

Instantly share code, notes, and snippets.

@benhosmer
benhosmer / yaml-read-parse.py
Created September 11, 2012 09:24
Parsing yaml into a python dictionary.
f = open('user.yaml')
dataMap = yaml.load(f)
f.close()
print ""
print "=-----------="
print "dataMap is a ", type(dataMap), dataMap
print "=-----------="
print "main items are", type(dataMap['main']), dataMap['main']
@bricewge
bricewge / ble-button.py
Last active December 18, 2023 18:12
Use iTag Bluetooth BLE tracker as a light switch with Home Assistant
from bluepy import btle
import requests
bleAddr = "ff:ff:10:05:ef:ff"
url = "http://localhost:8123/api/services/light/toggle"
lamp = "light.mylight"
hassPasswd = "password"
class LightToggleDelegate(btle.DefaultDelegate):
def __init__(self):
@ispiropoulos
ispiropoulos / shelly.py
Created August 28, 2018 09:16
Shelly Switch Home Assistant Component
"""
Support for The Shelly Wifi switch.
Save this file inside ".homeassistant/custom_components/switch" (create the folders if not present) and restart HASS.
usage example:
switch:
- platform: shelly
switches:
@lordneon
lordneon / steps.md
Last active January 27, 2024 13:05
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

esphome:
name: esp32_1
platform: ESP32
board: lolin32
wifi:
ssid: !secret ssid_iot
password: !secret password_iot
manual_ip:
static_ip: 192.168.0.110
@rithvikvibhu
rithvikvibhu / README.md
Last active April 12, 2024 15:32
GHLocalApi Update

GHLocalApi Update

The Gist

Until recently, the Google Home app used to communicate with the device over port 8008 (HTTP) and did not require any authentication. Everything in the unofficial documentation worked as expected.

A few days (weeks) ago, Google pushed a new update to all GH devices and all endpoints (except /setup/eureka_info) started returning 403 (forbidden) errors. The app had switched over to port 8443 and HTTPS.