Skip to content

Instantly share code, notes, and snippets.

@balloob
balloob / reactstrap.cjs.js
Created June 26, 2017 18:37
Build output Reactstrap optimizations
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = require('react');
var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var classNames = _interopDefault(require('classnames'));
@balloob
balloob / pytradfri.py
Last active August 23, 2017 13:54
WIP library to control Ikea Tradfri
"""
This is the Ikea Tradfri code from @ggravlingen extracted into a lib.
https://github.com/ggravlingen/home-assistant/blob/master/custom_components/light/ikeatradfri.py
Depends on modified coap-client with dtls support. Build instructions here:
https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee-very-basic-working-implementation/14788/19?u=balloob
Run with python3 -i pytradfri.py IP KEY
Will give you an interactive Python shell:
@balloob
balloob / ble_discovery.py
Created May 7, 2018 02:34
Basis for a component to prototype bluetooth discovery
"""Basis for a BLE discovery component.
To add to Home Assistant, copy this file to
<config>/custom_components/ble_discovery.py
Add to your configuration.yaml:
```
ble_discovery:
@balloob
balloob / experimental-ui.yaml
Last active June 18, 2018 00:20
Example custom card for the experimental UI in Home Assistant 0.72
views:
- name: Example
cards:
- type: 'custom:my-element'
entity_id: input_boolean.switch_ac_kitchen
@balloob
balloob / configuration.yaml
Last active June 21, 2018 13:52
Home Assistant Lovelace + WiredJS
# In Home Assistant UI, navigate to dev-info page and click on "Try out the new Lovelace UI" (HASS 0.72+)
# Reference the file in your configuration file
frontend:
extra_html_url:
- /local/wired-cards.html
# Example entities used in sample ui-lovelacy.yaml below
input_boolean:
switch_ac_kitchen:
@balloob
balloob / CLA.md
Last active September 27, 2018 09:19 — forked from pjcozzi/CLA.md
CLA for Apache 2.0 license

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the Apache 2.0 license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the Apache 2.0 license; or

@balloob
balloob / environment.py
Created January 31, 2016 07:16
Detect Python virtual environments venv and virtualenv
def is_virtual():
""" Return if we run in a virtual environtment. """
# Check supports venv && virtualenv
return (getattr(sys, 'base_prefix', sys.prefix) != sys.prefix or
hasattr(sys, 'real_prefix'))
@balloob
balloob / example_options_flow.diff
Created August 15, 2019 20:21
Example options flow
diff --git a/homeassistant/components/unifi/config_flow.py b/homeassistant/components/unifi/config_flow.py
index e5a8965df..06751ed6e 100644
--- a/homeassistant/components/unifi/config_flow.py
+++ b/homeassistant/components/unifi/config_flow.py
@@ -2,6 +2,7 @@
import voluptuous as vol
from homeassistant import config_entries
+from homeassistant.core import callback
from homeassistant.const import (
@balloob
balloob / config_entry_reloader.py
Created August 21, 2019 18:05
Config Entry Reloader
class EntityRegistryDisabledHandler:
"""Handler to handle when entities related to config entries updating disabled_by."""
RELOAD_AFTER_UPDATE_DELAY = 30
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize the handler."""
self.hass = hass
self.registry: Optional[entity_registry.EntityRegistry] = None
self.changed: Set[str] = set()
@balloob
balloob / config_flow.py
Created October 16, 2019 21:04
Config flow to link Home Assistant with Home Assistant
"""Config flow to connect with Home Assistant."""
import logging
import voluptuous as vol
from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN