Skip to content

Instantly share code, notes, and snippets.

@balloob
balloob / lets_make_chai.md
Last active March 24, 2025 21:36
Can someone create an LLM standard?

I have an ask for the AI community: can someone create a standard for interacting with LLMs.

There is a whole category of new apps and features ready to be made on top of LLMs. But to get these in the hands of users is hard. Apps will need to have subscriptions, ask the user to add their OpenAI API key or include and ship their own LLMs. It’s time to add a fourth option: create a standardized API that allows interacting with LLMs that cloud and local services can implement to put the user in control.

There are new LLM models and tuned variations popping up all the time, and most of these models end up implementing some part of the Chat Completions endpoint of the OpenAI Rest API. The recommendation is for users to use the OpenAI SDK and override the endpoint (even Google is doing this now!). The OpenAI API is tailored to the needs of OpenAI, which means it’s set up to interact with their cloud-based LLM mode

@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 / 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 / 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
@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-panel.js
Last active August 31, 2020 13:34
Example Panel for Home Assistant
/*
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
@balloob
balloob / debug-visibility.patch
Created June 27, 2020 06:57
Patch for HA frontend to debug visiblitychange behavior on Android
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
@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 / ha-deno.ts
Last active May 16, 2020 15:04
Home Assistant Websocket Deno
// 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)