Skip to content

Instantly share code, notes, and snippets.

@balloob
balloob / panel-redirect.js
Created June 22, 2020 04:51
Add redirects to the Home Assistant sidebar to any place in Home Assistant
/*
Add a link to the sidebar to any path in Home Assistant
Put this file in <config>/www/panel-redirect.js
In configuration.yaml:
panel_custom:
- name: panel-redirect
# url_path needs to be unique for each panel_custom config
@balloob
balloob / home-assistant.ipynb
Last active October 5, 2023 10:38
Jupyter Notebook connecting to Home Assistant
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@balloob
balloob / MQTT_ESP8266_temperature_humidity.ino
Created June 20, 2016 04:11
Sketch for the ESP8266 to publish temperature and humidity values received from a DHT22 to MQTT
// Get ESP8266 going with Arduino IDE
// - https://github.com/esp8266/Arduino#installing-with-boards-manager
// Required libraries (sketch -> include library -> manage libraries)
// - PubSubClient by Nick ‘O Leary
// - DHT sensor library by Adafruit
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <DHT.h>
@balloob
balloob / config.h
Last active July 13, 2023 07:40
ESP8266 sketch to control a Whynter ARC-110WD portable air conditioner and monitor temperature using MQTT, infrared transmitter, DHT22. For a list of possible IR codes see https://docs.google.com/spreadsheets/d/1dsr4Jh-nzC6xvSKGpLlPBF0NRwvlpyw-ozg8eZU813w/edit#gid=0
#define wifi_ssid "YOUR_WIFI_NAME"
#define wifi_password "YOUR_WIFI_PASSWORD"
#define mqtt_server "MQTT_SERVER"
#define mqtt_user "MQTT_USER"
#define mqtt_password "MQTT_PASS"
#define ac_topic "device/study_room/ac"
#define temperature_topic "device/study_room/temperature"
#define humidity_topic "device/study_room/humidity"
@balloob
balloob / balloob-battery-strategy.js
Created April 28, 2021 22:22
Lovelace strategy to show all batteries grouped by area.
/*
Battery strategy that shows your battery entities grouped by area.
To use:
- store this file in `<config>/www/balloob-battery-strategy.js`
- Add lovelace resource: `/local/balloob-battery-strategy.js`, type JavaScript Module
- Create a new Lovelace dashboard and set as content:
views:
- title: Batteries
@balloob
balloob / demo-strategy.js
Last active May 19, 2022 20:57
Demo Lovelace strategy for Home Assistant
/*
Demo strategy that shows each area as a tab. Each tab shows the area entities.
To use:
- store this file in `<config>/www/demo-strategy.js`
- Add lovelace resource: `/local/demo-strategy.js`, type JavaScript Module
- Create a new Lovelace dashboard and set as content:
strategy:
name: 'custom:balloob-demo'
@balloob
balloob / user-agent-card.js
Created December 29, 2021 06:55
User agent card
/*
Copy file to <config>/www/user-agent-card.js
Restart Home Assitant if www folder didn't exist.
In Home Assistant:
- Profile -> Enable advanced mode
- Config -> Dashboards -> Resources
- New resource. `/local/user-agent-card.js`. Type: JS Module
@balloob
balloob / sensor_example.py
Last active November 23, 2021 16:31
Example platforms and automation component for Home Assistant
"""
Copy this file to <config_dir>/example/sensor.py
Add to your configuration.yaml:
sensor:
platform: example
"""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
@balloob
balloob / pull-light-card.js
Created November 14, 2020 22:50
Custom card for Home Assistant that shows a pull Light Card. Video at https://twitter.com/balloob/status/1327745146633510912
/*
Created by @jh3yy
Adapted for Home Assistant by @balloob
Original: https://twitter.com/jh3yy/status/1327686213432717313
Only works on localhost because of restrictions MorphSVGPlugin3
Card config for usage in Home Assistant:
@balloob
balloob / example-card.js
Created February 20, 2021 03:26
Example custom card for Home Assistant. Created during Github Open Source Friday on Feb 19, 2021.
/*
To use in Home Assistant, configure card:
type: 'custom:example-card'
entities:
- switch.wemo_insight
- light.bed_light
- light.ceiling_lights
- light.kitchen_lights