| Crates.io | homeassistant-rs |
| lib.rs | homeassistant-rs |
| version | 0.1.3 |
| created_at | 2025-05-05 12:11:16.322957+00 |
| updated_at | 2025-08-07 06:25:47.080658+00 |
| description | Library for interacting with the Homeassistant API |
| homepage | https://github.com/Blexyel/homeassistant-rs |
| repository | https://github.com/Blexyel/homeassistant-rs |
| max_upload_size | |
| id | 1660647 |
| size | 74,021 |
Implements the Homeassistant API for use in rust
A simple lib, that queries different endpoints and returns the data in a usable format.
The first 2 arguments of each function are always: HA_URL, API_Token.
These arguments do not have to be filled with actual data, they can be None, but in this case you will need to use environment variables.
Under the hood we use dotenvy.
Example env:
HA_URL="http://localhost:8123"
HA_TOKEN="api_token_from_hass"
use homeassistant_rs::{self, hass};
let config = hass().config(None, None).await?;
println!("{}", config.version);
You can check all available endpoints here: [HomeAssistant]
More Examples:
hass().config(None, None).await?;
hass().events(None, None).await?;
hass().services(None, None).await?;
hass()
.history(
Some("http://localhost:8123"),
Some("API_Token"),
Some("entity_id"),
/// minimal_response
true,
/// no_attributes
true,
/// significant_changes_only
true,
)
.await?;
hass().logbook(None, None, Some("light.bedroom_local_bedroom_local")).await?;
hass().states(None, None, Some("light.bedroom_local_bedroom_local")).await?;
hass().states(None, None, None).await?;
hass().error_log(None, None).await?;