瀏覽代碼

Merge pull request #497 from sidoh/bugfix/handle_effect_key

Bugfix: handle effect key
Chris Mullins 6 年之前
父節點
當前提交
0ac8db9a23
共有 3 個文件被更改,包括 10 次插入0 次删除
  1. 1 0
      lib/MiLight/MiLightClient.cpp
  2. 1 0
      test/remote/settings.json.example
  3. 8 0
      test/remote/spec/state_spec.rb

+ 1 - 0
lib/MiLight/MiLightClient.cpp

@@ -20,6 +20,7 @@ const char* MiLightClient::FIELD_ORDERINGS[] = {
   GroupStateFieldNames::TEMPERATURE,
   GroupStateFieldNames::COLOR_TEMP,
   GroupStateFieldNames::MODE,
+  GroupStateFieldNames::EFFECT,
   GroupStateFieldNames::COLOR,
   // Level/Brightness must be processed last because they're specific to a particular bulb mode.
   // So make sure bulb mode is set before applying level/brightness.

+ 1 - 0
test/remote/settings.json.example

@@ -30,6 +30,7 @@
     "status",
     "level",
     "color_temp",
+    "kelvin",
     "bulb_mode",
     "hue",
     "saturation",

+ 8 - 0
test/remote/spec/state_spec.rb

@@ -374,6 +374,14 @@ RSpec.describe 'State' do
       # Should retain previous brightness
       expect(result['level']).to eq(50)
     end
+
+    it 'should support the mode and effect fields' do
+      state = @client.patch_state({status: 'ON', mode: 0}, @id_params)
+      expect(state['effect']).to eq("0")
+
+      state = @client.patch_state({effect: 1}, @id_params)
+      expect(state['effect']).to eq("1")
+    end
   end
 
   context 'increment/decrement commands' do