Releases: jamel-86/hassio_addons
v1.2.1
v1.1.5
v1.0.3
v1.0.0
Home Assistant Supabase Client Add-on v1.0.0
Overview
The initial release of the Home Assistant Supabase Client add-on allows you to store all states and events from your Home Assistant instance directly into Supabase. This version provides a robust and scalable solution for data storage and analysis.
Features
- Real-time Event Streaming: Stream all your Home Assistant events to Supabase in real time.
- Entity Filtering: Specify which entities to store in Supabase, or store all entities if no specific entities are provided.
- Flexible Configuration: Configure the add-on using the
options.json
file or environment variables. - Data Transformation: Store both original and transformed event data for structured storage and easy querying.
Installation
- Add the Repository
- Install the Add-on
Find the Home Assistant Supabase Client add-on in the add-on store and click Install.
- Configure the Add-on
After installation, navigate to the add-on's Configuration tab and set the necessary options:
Supabase Url: https://[PROJECT-ID].supabase.co
Supabase Key: [SUPABASE_KEY]
Home Assistant url: http://homeassistant.local:8123
Home Assistant Long Lived Token: "your-long-lived-access-token"
entities: "[sensor.temperature, sensor.humidity, another, another]"
- SQL Setup Instructions
To ensure that your Supabase instance is ready to store Home Assistant states and events, execute the following SQL queries to create the necessary tables:
Create states
Table:
CREATE TABLE states (
id SERIAL PRIMARY KEY,
entity_id TEXT NOT NULL,
state TEXT,
attributes JSONB,
last_changed TIMESTAMP,
last_updated TIMESTAMP
);
Create events
Table:
CREATE TABLE events (
id SERIAL PRIMARY KEY,
event_type TEXT NOT NULL,
event_data JSONB,
context JSONB,
origin TEXT,
time_fired TIMESTAMP
);
Create transformed_events
Table:
CREATE TABLE transformed_events (
id SERIAL PRIMARY KEY,
entity_id TEXT NOT NULL,
new_state JSONB,
old_state JSONB,
context_id TEXT,
user_id TEXT,
parent_id TEXT,
last_changed TIMESTAMP,
last_updated TIMESTAMP,
last_reported TIMESTAMP
);
Usage Instructions
Environment Variables
Alternatively, you can configure the add-on using environment variables if you want to run it on an external server. Create a .env
file in the root of your project with the following content:
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-key
HOME_ASSISTANT_URL=http://your-home-assistant-url
HOME_ASSISTANT_TOKEN=your-long-lived-access-token
ENTITIES=sensor.temperature,sensor.humidity
Running Locally
To run the script locally, ensure you have Node.js and ts-node installed. Then, execute the following command:
npx ts-node src/index.ts