View user-agent-card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
View balloob-battery-strategy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
View demo-strategy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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' |
View example-card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
To use in Home Assistant, configure card: | |
type: 'custom:example-card' | |
entities: | |
- switch.wemo_insight | |
- light.bed_light | |
- light.ceiling_lights | |
- light.kitchen_lights |
View pull-light-card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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: |
View example-panel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example panel. | |
Put this file in <config>/www/example-panel.js | |
In configuration.yaml: | |
panel_custom: | |
- name: example-panel | |
# url_path needs to be unique for each panel_custom config |
View debug-visibility.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/layouts/home-assistant.ts b/src/layouts/home-assistant.ts | |
index 0dae29df..663d152f 100644 | |
--- a/src/layouts/home-assistant.ts | |
+++ b/src/layouts/home-assistant.ts | |
@@ -150,6 +150,7 @@ export class HomeAssistantAppEl extends HassElement { | |
protected _handleVisibilityChange() { | |
if (document.hidden) { | |
+ console.log("home-assistant handle tab hidden"); | |
// If the document is hidden, we will prevent reconnects until we are visible again |
View panel-redirect.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
View ha-deno.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connect to Home Assistant from Deno | |
// Video: https://twitter.com/balloob/status/1261550082521919488?s=19 | |
// | |
// Example is built-in as CLI. Try it out: | |
// deno run --allow-net https://raw-path-to-gist <home assistant url> <long lived access token> | |
// | |
// To use in your own code: | |
// import { createConnection } from https://raw-path-to-gist | |
// const conn = await createConnection(urlOfHomeAssistant, accessToken) |
View find.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const fs = require("fs"); | |
const ICON_PACKAGE_PATH = path.resolve("./node_modules/@mdi/svg/"); | |
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json"); | |
const ICON_PATH = path.resolve(ICON_PACKAGE_PATH, "svg"); | |
// Print icons + sizes to create sizes.json | |
// const getPath = (icon) => { | |
// const svg = fs.readFileSync(`${ICON_PATH}/${icon}.svg`, { |
NewerOlder