搜索插件、代码仓与 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 桥接设备交互,支持对灯、组、场景和传感器的控制。该包支持所有主要平台,包括移动、Web 和桌面,非常适合跨平台物联网解决方案。通过简单的认证和设备管理,它简化了集成到家庭自动化应用的过程。该库持续维护且文档完善,有助于快速开发。

适合场景

  • 智能家居照明控制
  • 自动照明场景
  • 物联网仪表板集成
  • 智能家居工作流
  • 远程灯光管理

主要特点

  • 跨平台支持
  • 身份验证处理
  • 轻量级和分组管理
  • 场景与传感器交互
  • 异步 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 项

源码仓库

使用此插件的项目

暂无相关数据。