Skip to content

Instantly share code, notes, and snippets.

homeassistant:
customize:
package.node_anchors:
coffee_switch: &cfe_switch switch.kaffebryggare
coffee_remote: &cfe_remote switch.kaffekontroll
common: &common
package: 'devices/coffeemaker'
input_boolean.cfe_on:
@thomasloven
thomasloven / configuration.yaml
Last active January 3, 2025 02:36
Use custom fonts in Home Assistant
# /config/configuration.yaml
...
lovelace:
mode: yaml
resources:
- url: /local/myfont.css
type: css
...
@thomasloven
thomasloven / my-custom-card.js
Last active April 3, 2025 10:32
Simplest custom card
// Simplest possible custom card
// Does nothing. Doesn't look like anything
class MyCustomCard extends HTMLElement {
setConfig(config) {
// The config object contains the configuration specified by the user in ui-lovelace.yaml
// for your card.
// It will minimally contain:
// config.type = "custom:my-custom-card"
#!/usr/bin/env bash
MD5="md5"
HOSTNAME=`hostname -s`
if [[ -n $1 ]]; then HOSTNAME=$1; fi
HASH=`echo ${HOSTNAME} | ${MD5}`
echo -n -e "\033[38;05;$((0x${HASH:4:6}))m"
attribute = data.get('attribute')
value = data.get('value')
service = data.get('service')
service_data = data.get('data', {})
# hass.services.call('system_log', 'write', {"message": str(data)})
for entity in hass.states.entity_ids():
state = hass.states.get(entity)
/*
To move a panel to below the divider in Home Assistant
Add this to your configuration.yaml
frontend:
extra_module_url:
- /local/move-panel.js
And put the following into <config-dir>/www/move-panel.js
Replace URL_TO_MOVE with the url of your panel
@thomasloven
thomasloven / chart-colors.js
Last active April 8, 2025 17:00
Replace history graph colors in lovelace
// Add this to your lovelace resources as
// url: /local/chart-colors.js
// type: module
customElements.whenDefined('ha-chart-base').then(() => {
// Find the HaChartBase class
const HaChartBase = customElements.get('ha-chart-base');
// Write a new color list generator
hass:account
hass:alert
hass:alert-circle
hass:altimeter
hass:apple-safari
hass:apps
hass:arrow-bottom-left
hass:arrow-down
hass:arrow-left
hass:arrow-right
@thomasloven
thomasloven / default.conf
Created February 12, 2019 22:02
nginx-ssl-proxy subdomains
####################
default.conf
####################
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name _;
homeassistant:
customize:
package.node_anchors:
coffee_switch: &cfe_switch switch.kaffebryggare
coffee_remote: &cfe_remote switch.kaffekontroll
common: &common
package: 'devices/coffeemaker'
input_boolean.cfe_on: