Announcement

Collapse
No announcement yet.

Get Light Brightness Level in script

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

  • Get Light Brightness Level in script

    I would like to read the brightness level of a light in a script. I see JSON value pairs listed under the Jowihue tab.

    Code:
    LightGroup
    
    **************************** Object info *****************************
    {
    "name": "Living Room Sconces",
    "lights": [
    "11",
    "12",
    "10",
    "8"
    ],
    "action": {
    "on": true,
    "bri": 89,
    "hue": 0,
    "sat": 127,
    "ct": 0,
    "effect": "none",
    "xy": [
    0.0,
    0.0
    ]
    },
    "type": "LightGroup",
    "state": {
    "all_on": true,
    "any_on": true
    },
    "devicemembership": [],
    "etag": "f73ec6147edecaa062155aeda1682ff8",
    "scenes": [],
    "id": "2"
    }
    ************************* End Object info ***************************
    How can I access that JSON string from a script?

  • #2
    You cannot access the JSON through the plugin, but you can use scripting like hs.getdevicevalueex(), check the helpfile of HS for this. Or if you want to work with JSON, check the JSON helpfile of HS for this

    Wim
    -- Wim

    Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
    650 devices ---- 336 events ----- 40 scripts

    Comment


    • #3
      Maybe I am missing something or I configured it incorrectly. I adjusted the brightness level with a Hue remote just now yet the HS device status shows the light group off and the status time stamp is from yesterday. How does the plugin update HS device status/values?

      Click image for larger version

Name:	sconce_status.PNG
Views:	0
Size:	36.3 KB
ID:	1321310

      The advanced tab shows this:

      Click image for larger version

Name:	sconce_status_1.PNG
Views:	0
Size:	171.6 KB
ID:	1321311

      Obviously when I try hs.DeviceValueEx(773) it returns a zero value.

      When I look at the device Jowihue tab I see different values:

      Click image for larger version

Name:	sconce_status_3.PNG
Views:	0
Size:	46.2 KB
ID:	1321312

      I would think Value be set to 75? How does the plugin update the devices and groups? Does it use web sockets or does it poll?

      Thanks,
      Patrick

      Comment


      • #4
        Patrick,

        It depends on your configuration if it use polling or webhooks. If you are using a Philips Hue bridge the plugin does use polling, by the setting of refreshrate in the configuration page. Philips bridge will not send webhooks, so polling is the only option. If you are using a deCONZ gateway, (either the USB device ConBee or the PI RaspBee) webhooks are enabled and response can be a lot faster for especially sensors and lights/groups.

        If you are using the current production version of JowiHue, 2.0.3.3, then there is an issue in updating group devices. This will be resolved in the next version, But still for group devices the updating of values in action will show a delay when the command was given through another app.
        The current beta has this issue reolved already at this moment. I f you plan to use the beta, be aware this will be a one way only update, so have a backup of the homeseer daabase at hand!
        If you update single lights, you will see all is working fine for those.

        Wim
        -- Wim

        Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
        650 devices ---- 336 events ----- 40 scripts

        Comment


        • #5
          Wim,
          Thanks for your response. I am using an RPI deCONZ gateway. What would the typical delay be for updating group devices with the beta version? What I am trying to do is syncronize some Insteon and Zigbee device brightness levels.

          Thanks,
          Patrick

          Comment


          • #6
            Except for the all lights group (which is not handled as group by the gateway) almost immediatly.

            Wim
            -- Wim

            Plugins:RFXCOM, HSTouch Server, Squeezebox, BLGData, Restart, Jon00's Perfmon and Network monitor, WeatherXML, BLBackup, TenScripting, BC4, Pushover, PHLocation, JowiHue, Zwave, Sonos
            650 devices ---- 336 events ----- 40 scripts

            Comment

            Working...
            X