Skip to content

Instantly share code, notes, and snippets.

@tomshaffner
tomshaffner / motion_illuminance_activated_entity.yaml
Last active October 26, 2022 00:32 — forked from freakshock88/motion_illuminance_activated_entity.yaml
Home Assistant BluePrint to turn on light, switch, scene or script based on motion and illuminance
blueprint:
name: Turn on light, switch, scene, script or group based on motion and illuminance, extra blocker.
description: >
Turn on a light, switch, scene, script or group based on motion detection, and low light level.
This blueprint uses helper entities you have to create yourself for some input values, to be able to dynamically set limits.
For instructions on creating the helper entities take a look in the Home Assistant Community forum topic:
https://community.home-assistant.io/t/turn-on-light-switch-scene-or-script-based-on-motion-and-illuminance-more-conditions/257085
@tomshaffner
tomshaffner / getfit.py
Last active May 28, 2020 17:44 — forked from cedricbonhomme/getfit.py
Get your Google Fit data - now in Python 3
#! /usr/bin/env python
#-*- coding: utf-8 -*-
import json
import httplib2
from datetime import datetime
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
@tomshaffner
tomshaffner / nx2gt.py
Created June 3, 2019 15:18 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
# -*- coding: utf-8 -*-
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
used with the PropertyMap. Returns a tuple, (type name, value, key)
"""