Announcement

Collapse
No announcement yet.

Setting brightness from UPB dim value with Script

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

    Setting brightness from UPB dim value with Script

    I am attempting to set the brightness of a group of Hue lights based on the dim level of a UPB link with a UPB supertoggle. Aside from the super toggle being clearly the best of all toggles (because it is super) it also is pretty useful. What it does is if you double tap the top rocker it snaps on the connected light. If you double tap the bottom it snaps off the light. If you hold it it either raises or lowers the dim level. While I realize I will not get to preview the dim level as I am setting it via scripting as I would with a connected UPB light, at least being able to set the level via light switch rather than an app will be very convenient.

    Spud, the author of the UPB plugin, has created a sample script for putting the dim value in a variable. What I am still trying to figure out is setting a JowiHue group to "off" or "on" via a script. I see in the documentation that it is possible to set the brightness, and I made an attempt to convert the dim value from SpudUPB to the brightness value here: http://board.homeseer.com/showthread...03#post1201903


    How would you use a script to turn a group on or off?
    _______________________________________________

    HS3 : HSpro (3.0.0.460) on Win2012 (vm on ESXi)
    Plugins: HSTouch, UPBSpud, Kinect, Nest, IFTTT, DirecTV, EasyTrigger, Imperihome, Zwave, RFXcom, UltraMon3, UltraWeatherBug3, UltraGCIR3, UltraLog3, UltraPioneer, PHLocation, Pushover, Pushalot, MCSSPrinklers S, JowiHue
    Jon00 Plugins: Bluetooth Proximity, Performance Monitor, DB Chart, Links

    #2
    Jlrichar,

    You can script a group device to change to off just like any other device, through the capi control command set. A short sample here:



    Code:
     Dim result As CAPIControlResponse
        result = CAPIControlResponse.Indeterminate
        For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
            If LCase(objCAPIControl.Label) = LCase(strDevCmd) Then
                result = hs.CAPIControlHandler(objCAPIControl)
                Exit For
            End If
        Next
    Where:

    strDevCmd holds the command you want to send: On or Off.
    intDevRef holds the reference id of the device for the group of lights.

    Does this help you?

    Regards,

    Wim
    -- Wim

    Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

    1210 devices/features ---- 392 events ----- 40 scripts

    Comment


      #3
      Jlrichar,

      And there is also another possibility to switch off lights or groups with a script command to the plugin. It is described in the documentation

      With:

      hs.PluginFunction("JowiHue", "", "SetLightsOff", {True, Name})

      The "True" Parameter determines if you are adressing a group (True) or Light (False). The name parameter is holding the name of the light or group.

      I forgot about this, but exists after all

      Wim
      -- Wim

      Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

      1210 devices/features ---- 392 events ----- 40 scripts

      Comment


        #4
        Originally posted by w.vuyk View Post
        Jlrichar,

        And there is also another possibility to switch off lights or groups with a script command to the plugin. It is described in the documentation

        With:

        hs.PluginFunction("JowiHue", "", "SetLightsOff", {True, Name})

        The "True" Parameter determines if you are adressing a group (True) or Light (False). The name parameter is holding the name of the light or group.

        I forgot about this, but exists after all

        Wim
        Oh good! This is so much simpler than the Capi example. Thank you!
        _______________________________________________

        HS3 : HSpro (3.0.0.460) on Win2012 (vm on ESXi)
        Plugins: HSTouch, UPBSpud, Kinect, Nest, IFTTT, DirecTV, EasyTrigger, Imperihome, Zwave, RFXcom, UltraMon3, UltraWeatherBug3, UltraGCIR3, UltraLog3, UltraPioneer, PHLocation, Pushover, Pushalot, MCSSPrinklers S, JowiHue
        Jon00 Plugins: Bluetooth Proximity, Performance Monitor, DB Chart, Links

        Comment


          #5
          Unfortunately it does not seem to work? I tried adding this to the script I am trying and it did not turn off the lights:

          Code:
          hs.PluginFunction("JowiHue", "", "SetLightsOff", new object[] {true, "Master Bath"});
          I am on version 1.0.6.2 of the plugin if that matters. I am trying to add this to a c# script.
          _______________________________________________

          HS3 : HSpro (3.0.0.460) on Win2012 (vm on ESXi)
          Plugins: HSTouch, UPBSpud, Kinect, Nest, IFTTT, DirecTV, EasyTrigger, Imperihome, Zwave, RFXcom, UltraMon3, UltraWeatherBug3, UltraGCIR3, UltraLog3, UltraPioneer, PHLocation, Pushover, Pushalot, MCSSPrinklers S, JowiHue
          Jon00 Plugins: Bluetooth Proximity, Performance Monitor, DB Chart, Links

          Comment


            #6
            Originally posted by jlrichar View Post
            Unfortunately it does not seem to work? I tried adding this to the script I am trying and it did not turn off the lights:

            Code:
            hs.PluginFunction("JowiHue", "", "SetLightsOff", new object[] {true, "Master Bath"});
            I am on version 1.0.6.2 of the plugin if that matters. I am trying to add this to a c# script.
            jlrichar,

            I am no good with c#, but I suggest to remove the new object[], like in my earlier sample/

            Code:
            hs.PluginFunction("JowiHue", "", "SetLightsOff",  {true, "Master Bath"})
            The line above works - in a vb.net script.

            Wim
            -- Wim

            Plugins: JowiHue, RFXCOM, Sonos4, Jon00's Perfmon and Network monitor, EasyTrigger, Pushover 3P, rnbWeather, BLBackup, AK SmartDevice, Pushover, PHLocation, Zwave, GCalseer, SDJ-Health, Device History, BLGData

            1210 devices/features ---- 392 events ----- 40 scripts

            Comment

            Working...
            X