搜尋套件、儲存庫與 APP 分類

套件詳情v0.3.0

hue_dart

一個用於在 Flutter 和/或 AngularDart 中建立 Philips Hue 應用程式的程式庫。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
31
喜歡數
20
Pub 分數
140

安裝套件

flutter pub add hue_dart

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

hue_dart 是一個 Dart 庫,讓開發者能夠使用 Flutter 或 AngularDart 建立 Philips Hue 智能照明系統的應用程式。它提供了一個乾淨的非同步 API,用於與 Hue 橋接設備互動,可控制燈光、群組、場景和感應器。該套件支援所有主要平台,包括行動、網頁和桌面,非常適合跨平台物聯網解決方案。透過簡單的驗證和裝置管理,它簡化了整合至家庭自動化應用的過程。此庫持續維護且文件完整,促進快速開發。

適用情境

  • 智慧家庭照明控制
  • 自動照明場景
  • 物聯網儀表板整合
  • 智慧家庭工作流程
  • 遠端燈光管理

主要特色

  • 跨平台支援
  • 身分驗證處理
  • 輕量級和分組管理
  • 場景與感應器互動
  • 非同步 API 設計

適合對象

  • Flutter 開發者
  • AngularDart 項目
  • 物聯網愛好者
  • 智慧家居應用
  • 全端網頁與行動應用程式

使用建議

  • 需要 Philips Hue 橋接器
  • 對 Hue 橋接器的網路存取
  • 需要設定驗證
  • 僅限飛利浦Hue生態系統
  • 依賴外部 API 的穩定性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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}');

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。