パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリJairzinno/hue_dart

hue_dart

Flutterおよび/または AngularDartでPhilips Hueアプリを作成するためのライブラリ。

hue_dart のプロジェクト画像
スター
27
フォーク
12
最終プッシュ(UTC)
2023/11/09
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

hue_dart

A library for creating Philips Hue apps in Flutter and/or AngularDart.

This library aims to make it easier to handle with the Philips Hue bridge.

Using

Discovery

Import the library and search for bridges.

import 'package:http/http.dart';
import 'package:hue_dart/hue_dart.dart';

final client = Client();
final discovery = BridgeDiscovery(client);

List<DiscoveryResult> discoverResults = await discovery.automatic();
final discoveryResult = discoverResults.first;

final bridge = Bridge(client, discoveryResult.ipAddress);

For web, use the BrowserClient.

import 'package:http/browser_client.dart';
import 'package:hue_dart/hue_dart.dart';

final client = BrowserClient();
final discovery = BridgeDiscovery(client);

List<DiscoveryResult> discoverResults = await discovery.automatic();
final discoveryResult = discoverResults.first;

final bridge = Bridge(client, discoveryResult.ipAddress);

Searching for a bridge by entering an IP address is also supported.

import package:hue_dart/hue.dart;

final client = Client();
final discovery = BridgeDiscovery(client);

DiscoveryResult discoverResult = await discovery.manual('192.168.1.2');

final bridge = Bridge(client, discoveryResult.ipAddress);
Create a new user

To create a user press the push link button before calling the createUser method

final bridge = Bridge(client, discoveryResult.ipAddress);
final whiteListItem = bridge.createUser('hue_dart');
bridge.username = whiteListItem.username;
Lights

To get the current lights on the bridge, create a Bridge, set a username and

final lights = bridge.lights();

Changing a light's color while respecting its current color mode is done by using the Light#changeColor method.

final light = lights.first.changeColor(red: 1.0, green: 0.5, blue: 1.0);
LightState state = lightStateForColorOnly(light);
await bridge.updateLightState(light.rebuild(
    (l) => l..state = state.toBuilder(),
));

Different light state attributes can also be changed.

final light = lights.first;
LightState state = LightState((s) => s
    ..brightness = 100,
);
await bridge.updateLightState(light.rebuild(
    (l) => l..state = state.toBuilder(),
));

To get the light's current color in rgb values (and other known means) use the Light#colors method

final light = lights.first;
HueColor colors = light.colors();
print('red:${colors.red}, green: ${colors.green}, blue:${colors.blue}');
Jairzinno Henriquez GitHub avatar
GitHub 作者

Jairzinno Henriquez ↗

言語Dart

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 8 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗