Skip to content

Instantly share code, notes, and snippets.

@gadgetchnnel
gadgetchnnel / compact-header-enabler.js
Last active October 21, 2020 15:56
A way to enable a compact header in Home Assistant without changing your current theme
class CompactHeaderEnabler {
enableCompactHeader(compactHeaderTheme = "compact-header"){
let root = document.querySelector("html");
root.style.setProperty("--card-mod-theme", compactHeaderTheme);
setTimeout(() => {
let theme = JSON.parse(localStorage.getItem("selectedTheme") || "{}");
this.fireEvent("settheme",theme, document.querySelector("home-assistant"));
},100);
}
@gadgetchnnel
gadgetchnnel / light.py
Created December 21, 2019 10:05
Replacement light.py for HA Tuya component (with brightness level mapping)
"""Support for the Tuya lights."""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
@gadgetchnnel
gadgetchnnel / light.py
Created December 20, 2019 18:05
Replacement light.py for HA Tuya component
"""Support for the Tuya lights."""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,