Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

g0rdan/ha_api

Repository files navigation

Home Assistant API client for Dart

An API client for Home Assistant automation framework. If you ever wanted to control your home from your Dart application, this is the package for you. The client covers following Home Assistant APIs:

GET

  • /api/
  • /api/config
  • /api/events
  • /api/services
  • /api/history/period/<timestamp>
  • /api/logbook/<timestamp>
  • /api/states
  • /api/states/<entity_id>
  • /api/error_log
  • /api/camera_proxy/<camera entity_id>
  • /api/calendars
  • /api/calendars/<calendar entity_id>

POST

  • /api/states/<entity_id>
  • /api/events/<event_type>
  • /api/services/<domain>/<service>
  • /api/template
  • /api/config/core/check_config
  • /api/intent/handle

More documentation can be found here.

Usage

To add this package as a dependency, add the following to your pubspec.yaml file:

dependencies:
 ha_api: ^0.1.0

Examples

Here are small examples that show you how to use the API.

Get list of services

import 'package:ha_api/ha_api.dart';
void main() async {
 final haClient = HaApi(
 url: 'yourIpAndPort',
 token: 'yourBearerToken',
 // make sure you call init() before using the client
 )..init();
 final (services, failure) = await service.getServices();
}

If the request was successful, the services variable will contain the result. If the request failed, the failure variable will contain the error.

About

Dart client library for the Home Assistant API.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /