LoginSignup
3
4

More than 5 years have passed since last update.

[HomeKit対応仕様] Philips Hue ホワイトグラデーション シングルランプ

Last updated at Posted at 2017-11-27

[Amazon] Philips Hue(ヒュー) ホワイトグラデーション シングルランプ

主なサービス

HMServiceType 説明
Lightbulb 電球

主なキャラクタ

HMCharacteristicType 説明 フォーマット 書き込み
PowerState 電源の状態 bool
ColorTemperature 色温度 int
Brightness 明るさ int

概要

スマートIoT照明のパイオニアであるPhilips Hueのランプの非カラー版です。
非カラーといっても、蛍光灯のような白色から白熱電球のようなオレンジ色の温かみのある色まで調整できます。

カラー版ではHueSaturationBrightnessの3つのキャラクタを変更することでランプの色を変えますが、この非カラー版ではColorTemperatureという1つのキャラクタを変更することで色味を調整します。

なおHMCharacteristicTypeColorTemperatureはiOS 11で新規追加されたキャラクタです。

もちろんPowerStateキャラクタで点灯/消灯を操作することもできます。

ColorTemperatureのmetadata

プロパティ 実際の値
format int
units
minimumValue 153
maximumValue 454
stepValue 1
validValues
maxLength
manufacturerDescription Color Temperature

ColorTemperatureのvalue

valueプロパティは153から454の範囲で設定できます。
この写真の左側のランプが153を、右側のランプが454を設定した時の実際の色味です。

ColorTemperatureを更新するサンプルコード

let service = home.servicesWithTypes([HMServiceTypeLightbulb])?.first
let candidates = service?.characteristics.filter { $0.characteristicType == HMCharacteristicTypeColorTemperature }

guard let colorTemperature = candidates?.first else {
    return
}

colorTemperature.writeValue(454) { error in
}

まとめ

キャラクタのvalueの更新が視覚的にわかりやすく、また、true/falseだけでなく数値のvalueを書き込み可能な製品としてPhilips Hueをオススメしていますが、実用的にはカラー版でなくこちらのホワイトグラデーション シングルランプで必要十分ではないでしょうか。

値段的にはカラー版の半額程度になりますので、すでにPhilips Hueのブリッジをお持ちのかたの追加ランプとしては順当かと思います。

iOS 11 Programmingについて

この記事は「iOS 11 Programming」の 第12章 HomeKit入門とiOS 11における新機能 の中の 12.4.2 HomeKit 対応製品利用実例 への追加コンテンツ的位置付けにもなっています。
この製品がサポートするサービス(HMService)やキャラクタ(HMCharacteristic)の表など、全てこの書籍に合わせた形で掲載しております。

「iOS 11 Programming」にご興味のあるかたは是非、以下リンクからご参照ください。


iOS 11 Programming

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4