PHP库,用于控制飞利浦Hue照明系统
Requires
- php: >=5.4.0
- educoder/pest: ~1.0
This package is not auto-updated.
Last update: 2024-09-28 15:59:59 UTC
README
PHP库,用于控制飞利浦Hue照明系统。最初是从未维护的phpHue类(https://github.com/danray0424/phpHue)分支出来,最终进行了完全重写。
入门指南
src/目录包含huephp类和与Hue中心交互所需的所有必要函数。
此外,您可以使用composer轻松地将huephp作为依赖项引入
php composer.phar require muesli/huephp ~1.0
查看"samples"目录。您将找到一些示例,展示如何与huephp交互。它使用PEST库来访问Hue的RESTful API,但作为huephp的用户,您无需担心这些细节。
hue命令行工具
bin/hue是一个命令行照明系统控制器。
./bin/hue
-i [Hue bridge's ip]
If you don't already have a valid registered key for this Hue bridge:
-g [register a new key with the Hue bridge]
Once have a registered key, you need to specify it with -k:
-k [valid key that is registered with your Hue hub]
Use it in combination with one of the following parameters:
To get information from the bridge:
-f [fetch full state from Hue hub]
-c [check light states: returns 0 when a light is off, 1 when on]
To control the bridge:
If you don't specify a light number, bin/hue will target all bulbs:
-l [light number]
Turning a light on or off:
-o [0 for turning the light off, 1 for turning it on]
To set a new color, pick one of the following options:
-n [color name (see below)]
or
-h [hue in degrees on the color circle 0-360]
-s [saturation 0-254]
-b [brightness 0-254]
or
-t [white color temp 150-500]
Additionally options are:
-r [transition time, in seconds. Decimals are legal (".1", for instance)]
-e [command to execute before changing light setting]
您需要指定一个ip(-i),一个密钥(-k)以及以下选项之一:-h,-s,-b,-t,-o或-n。如果您没有指定灯,它将设置您指定的所有灯的值。
如果您还没有密钥,可以通过使用-g选项调用bin/hue来注册一个。
您可以使用-o开关打开或关闭灯。任何其他参数都表示'-o 1'。换句话说,如果您在灯关闭时指定任何其他参数,我们将为您将其打开。
预设
-n开关接受一个单词名称的颜色,并将所选灯设置为该颜色。它有一个预定义的颜色名称的小列表,如果给出了它不认识的字符串,则不做任何事情。它目前知道红色、蓝色、紫色、绿色、冷白色和暖白色。'-n'参数可能部分被其他参数覆盖。例如,"-n red -s 50"将给出柔和的红色,而"-n blue -r 10"将产生10秒渐变到蓝色。请注意,"-n red -h 200"将用200的色调(类似紫色)覆盖红色命令的红色度,但它将继承"红色"预设的全部饱和度和亮度。