Announcement

Collapse
No announcement yet.

Can SceneMaster be used to Dim JowiHue lights

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can SceneMaster be used to Dim JowiHue lights

    JowiHue has separate devices for:
    • On/Off/Alert
    • Brightness


    I have one Leviton (instant status) dimming overhead lights and 10 hue lights that I want to be a "dimming slave" to the Leviton switch.

    Has anyone attempted this before with Scene Master?

  • #2
    maybe this helps

    Hi Agilehumor,

    To dim JowiHue lights with scenemaster I added both devices (on/off and brightness) in the scene config. see screenshot.
    Scene dimming does not work because the brightness device is not really a dimming device.
    But when you define multiple scenes with different brightness values it might work.

    Zigmund
    Attached Files

    Comment


    • #3
      Thanks sir! I was hoping to finally be able to control the brightness of the hue lights from or Leviton dimmer.

      Your non-linear dimming is great. I hope to still leverage your scenes for my lighting needs as they vary during the day.

      Cheers!

      Comment


      • #4
        scene selector

        Hi there,

        I'm trying to accomplish a similar scenario, and so far works as suggested - thank you.

        I did notice you have a virtual switch in your scene config that appears to be a scene selector? Is that something you created yourself as a virtual device? I was looking to include something similar in my setup.

        Thanks,
        Andrew

        Comment


        • #5
          virtual device

          Originally posted by transparent View Post
          Hi there,

          I'm trying to accomplish a similar scenario, and so far works as suggested - thank you.

          I did notice you have a virtual switch in your scene config that appears to be a scene selector? Is that something you created yourself as a virtual device? I was looking to include something similar in my setup.

          Thanks,
          Andrew
          Andrew,
          Correct, I wanted to have 1 simple homeseer device to select a Hue scene. I wrote a few lines of code to create and update device actions buttons using the JowiHue plugin

          Code:
          Sub StartHueScene(ByVal Parm As Object)
                  Dim AllOff() As Object = { True, "All Lights” }
                  Dim CBlue As String = "<font color='#000080'>"
                  Dim CGreen As String = "<font color='#008000'>"
                  Dim CEnd As String = "</font>"
              Try
                  Dim SceneValue As Double = hs.DeviceValue(1006)
                  If SceneValue = 0 Then 'all Lights off
                      Dim Result As Boolean = hs.PluginFunction("JowiHue", "", "SetLightsOff", AllOff)
                      hs.WriteLog("HueControl", String.Format("Hue scene: {0}{3}{2} with success: {1}{4}{2}",CBlue,CGreen, _
                                                                                           CEnd,String.Join(".",AllOff),Result.ToString))
                  Else 
                       Dim Scenes As Object = hs.PluginFunction("JowiHue", "", "GetScenes", Nothing)
                       Dim Scene() As String = Split(Scenes(SceneValue-1),",")
                       Dim Result As Boolean = hs.PluginFunction("JowiHue", "", "StartScene", Scene)
                       hs.WriteLog("HueControl", String.Format("Start Hue scene: {0}{3}{2} with success: {1}{4}{2}",CBlue,CGreen, _
                                                                                           CEnd,Scene(0).ToString,Result.ToString))
                  End If
              Catch ex As Exception
                  hs.WriteLog("HueControl.vb", "Exception: " & ex.Message.ToString)
              End Try
          End Sub
          
          Sub StartHueAnimation(ByVal Parm As Object)
                  Dim AnimationAllOff() As Object = {"all”}
              Try
                  Dim AnimationValue As Double = hs.DeviceValue(1066)
                  if AnimationValue = 0 Then 'all off
                      Dim Result As Boolean = hs.PluginFunction("JowiHue", "", "StopAnimation", AnimationAllOff)
                      hs.WriteLog("HueControl", "stop Hue animation: " & chr(34) & String.Join(".",AnimationAllOff) & chr(34) & ", success: " & Result.ToString)
                  Else 
                       Dim Animations As Object = hs.PluginFunction("JowiHue", "", "GetAnimations", Nothing)
                       Dim Animation() As String = Split(Animations(AnimationValue-1) & ",", ",")
                       Dim Result As Boolean = hs.PluginFunction("JowiHue", "", "StartAnimation", Animation)
                       hs.WriteLog("HueControl", "start Hue animation: " &  chr(34) & Animations(0).ToString & chr(34) & ", success: " & Result.ToString )
                  End If
              Catch ex As Exception
                  hs.WriteLog("HueControl.vb", "Exception: " & ex.Message.ToString)
              End Try
          End Sub
          
          Sub UpdateSceneDevice(ByVal Parm As Object)
                  Dim CBlue As String = "<font color='#000080'>"
                  Dim CGreen As String = "<font color='#008000'>"
                  Dim CEnd As String = "</font>"
          
              Try
                  Dim Scenes As Object = hs.PluginFunction("JowiHue", "", "GetScenes", Nothing)
                  Dim i As Byte = 0
                  Dim dvRef As Integer = 1006
                  Dim Pair As VSPair
                  Dim Result As Boolean
                  Dim SceneName As String = "All Lights Off"
                  hs.DeviceVSP_ClearAll(dvRef,True)
          
                  '0 = all lights off
                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                  Pair.PairType = VSVGPairType.SingleValue
                  Pair.Status = SceneName
                  Pair.Value = 0
                  Pair.Render = Enums.CAPIControlType.Button
                  Result = hs.DeviceVSP_AddPair(dvRef, Pair)
                  hs.WriteLog("HueControl", String.Format("Device: {0}{3}{2} value {0}{4}{2} Set to {1}{5}{2}, exitcode: {1}{6}{2}", _
                                       CBlue,CGreen,CEnd,dvRef.ToString,i.ToString,SceneName,Result.ToString))
                  'add JowiHue scenes
                  i += 1
                  For Each SceneName As String In Scenes
                      Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                      Pair.PairType = VSVGPairType.SingleValue
                      Pair.Status = SceneName.ToString          
                      Pair.Value = i
                      Pair.Render = Enums.CAPIControlType.Button
                      Result = hs.DeviceVSP_AddPair(dvRef, Pair)
                      hs.WriteLog("HueControl", String.Format("Device: {0}{3}{2} value {0}{4}{2} Set to {1}{5}{2}, exitcode: {1}{6}{2}", _
                                           CBlue,CGreen,CEnd,dvRef.ToString,i.ToString,SceneName.ToString,Result.ToString))
                      i += 1
                  Next
          
              Catch ex As Exception
                  hs.WriteLog("HueControl.vb", "Exception: " & ex.Message.ToString)
              End Try
          End Sub
          
          Sub UpdateAnimationDevice(ByVal Parm As Object)
                  Dim CBlue As String = "<font color='#000080'>"
                  Dim CGreen As String = "<font color='#008000'>"
                  Dim CEnd As String = "</font>"
          
              Try
                  Dim Animations As Object = hs.PluginFunction("JowiHue", "", "GetAnimations", Nothing)
                  Dim i As Byte = 0
                  Dim dvRef As Integer = 1066
                  Dim Pair As VSPair
                  Dim Result As Boolean
                  Dim AnimationName As String = "Stop all animations"
          
                  hs.DeviceVSP_ClearAll(dvRef,True)
                  '0 = stop animation
                  Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                  Pair.PairType = VSVGPairType.SingleValue
                  Pair.Status = AnimationName
                  Pair.Value = 0
                  Pair.Render = Enums.CAPIControlType.Button
                  Result = hs.DeviceVSP_AddPair(dvRef, Pair)
                  hs.WriteLog("HueControl", String.Format("Device: {0}{3}{2} value {0}{4}{2} Set to {1}{5}{2}, exitcode: {1}{6}{2}", _
                                       CBlue,CGreen,CEnd,dvRef.ToString,i.ToString,AnimationName.ToString,Result.ToString))        
                  'add JowiHue animations
                  i += 1
                  For Each AnimationName As String In Animations
                      Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                      Pair.PairType = VSVGPairType.SingleValue
                      Pair.Status = AnimationName.ToString
                      Pair.Value = i
                      Pair.Render = Enums.CAPIControlType.Button
                      Result = hs.DeviceVSP_AddPair(dvRef, Pair)
                      hs.WriteLog("HueControl", String.Format("Device: {0}{3}{2} value {0}{4}{2} Set to {1}{5}{2}, exitcode: {1}{6}{2}", _
                                           CBlue,CGreen,CEnd,dvRef.ToString,i.ToString,AnimationName.ToString,Result.ToString))        
                      i += 1
                  Next
          
              Catch ex As Exception
                  hs.WriteLog("HueControl.vb", "Exception: " & ex.Message.ToString)
              End Try
          End Sub

          Comment


          • #6
            Brilliant! Thank you, that gives me lots to work with.

            Much appreciated,
            Andrew

            Comment


            • #7
              I'm sorry for my lack of knowledge, but how and when do you trigger this code to get the virtual devices created?

              Comment

              Working...
              X