Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

New Hue Bridge - compatible with Fibaro Hue plugin?


Question

Posted

Hello,

 

does anybody know if the new Hue Bridge will work with the Fibaro Hue plugin on HC3? Thanks! Cheers Alfons

Recommended Posts

  • 1
  • Inquirer
  • Posted

    This does not sound very promising! @FibaroSupport: are there any plans to support an automated migration path? Thanks!

    • 1
    Posted

    HUE plugin on HC2 is using old API ver.1 and with new HUE bridge will not work anymore.

    Only solution left is to find virtual devices with scene that support new API ver.2.

    BTW I know only for my solution that can be found here:

    You do not need to install complete package, but just some needed parts like translation and schedule and then HUE2 support. Everything is explained in provided user manual.

    • 0
  • Inquirer
  • Posted

    Hmm, no answers to this … not even by Fibaro Support?

    • 0
    Posted

    The "the new Hue Bridge" came out 2015.

    Yes, there have been many sw updates since then adding features.

    The plugin is still on like 2015 capabilities,  turn on/off lights and set some color...

    It's a bit limited in for other devices and features - so the answer to your question is "it depends", on what functionality you need.

    There are community developed QAs to provide more features and device supports.

    • 0
    Posted
    1 hour ago, jgab said:

    The "the new Hue Bridge" came out 2015.

     

    he means i think the hue bridge pro, which came out last week.

     

    The basic functionality should work (on/off, color).

    • 0
    Posted

    Ahh, something new to spend money on! :-)

    • 0
    Posted

    I just read up on that - looks nice. I've put in an order... :-) 
     

    Philips Hue Bridge Pro V3.0 and allows you completely new ways to control the smart bulbs. It is up to 5x faster than the previous generation and offers three times the capacity for bulbs, accessories and scenes. In the future you can teach 150 bulbs & lamps and use 50 accessories such as switches, motion sensors and co. In addition, up to 500 scenes are supported.
    Inside the completely revised Hue Bridge Pro will work in the future the self-developed "
    Hue Pro Chip" with 1.7 Ghz, 8GB DDR4 memory, 8GB eMMc flash memory and a WiFi chip. This makes it up to 5x faster than the old generation, which was more than necessary thanks to the amount of Philips Hue bulbs, switches and scenes.
    Exclusively for the new Philips Hue Bridge Pro there will be a new feature: Philips Hue MotionAware™.
    The new function allows the lighting system to react intuitively to movement in the house. With at least three lights in the same room, a MotionAware™ motion range can be created that detects the presence and turns on the lights assigned to it.
    It can now also be integrated directly into the network via WLAN, since a WiFi chip is installed in the Hue Bridge. Classically, however, the Ethernet LAN connection is still connected to your network. For this, the power supply is made easier, because it is set to USB-C, a corresponding power supply is included

    • 0
  • Inquirer
  • Posted

    So will it use already integrated Hue devices (i.e. use existing device ids) or do I have to integrate them from scratch? That would a lot of work in my case 🫤 Thanks!

    • 0
    Posted

    I have the new Hue Bridge Pro.
    HC3 cannot find the Bridge.

    Of course I entered the IP address, but no results.

     

    Does anyone have any idea if it is even possible to migrate the new Hue Bridge Pro to HC3?
     

    Thanks,

    René

    • 0
    Posted

    I will get mine today and update my QA to make sure it works with it…

    • Like 5
    • 0
    Posted
    On 9/15/2025 at 11:08 AM, jgab said:

    I will get mine today and update my QA to make sure it works with it…

    Did you managed to get it to work?

    • 0
    Posted

    Yes, the Yahue QA works (v0.60). It may not suite your needs as it doesn't control individual lights, only rooms and zones. (and it also support various sensors and buttons)


     

    • Like 1
    • 0
    Posted

    Just migrated my Hue lights from the old bridge to the Hue Bridge Pro and my HC2 with Hue Plugin has no luck in identifying the new Bridge Pro. Hopefully someone smarter than me will find a solution to get it back up and running. 

    • 0
    Posted

    Same issue here. If someone find a way to integrate properly the new Hue Bridge pro in a HC3, please share with us the solution.

     

    Many thanks in advance

     

    • 0
    Posted

    I can't connect the pro with HC3, Fibaro is finding it, but can't connect

    • 0
    Posted

    Hi  @all, I have same problem. Hue Bridge Pro and HC3 - I cannot find bridge. Very uhappy with that because I have Philips Hue in my whole appartment. 

     

    Already wrote Fibaro, but did not get solution.

     

    Is there anybody who know when we get update of Hue Plugin?

     

    Thanks

     

    Patrik

    • 0
    Posted (edited)

    -- ============================================================
    -- Philips Hue Bridge (v1 API over HTTP) -> Fibaro HC3 Quick App +Bridge Pro
    -- FINAL STABLE (Lights + Sensors) + DISCOVERY LOCK + HC3 onAction ROUTING
    -- + PERSISTENT CHILD MAP (deviceId -> Hue ID)
    --
    -- REQUIRED QA VARIABLES (create in QA UI -> Variables):
    --   HUE_BRIDGE_IP      = fill in you bridge ID
    --   HUE_USERNAME       =  fill in your username
    --   CHILD_MAP          = {}   (JSON)
    -- OPTIONAL:
    --   POLL_INTERVAL_MS   = 10000 (default 10000, minimum 2000)
    --   DISCOVERY_DONE     = 0  after it will be 1
    -- ============================================================

    local DEFAULT_BRIDGE_IP = "192.168.68.178"
    local DEFAULT_POLL_MS   = 10000

    local function countTable(t)
      local c = 0
      for _ in pairs(t or {}) do c = c + 1 end
      return c
    end

    local function pctFromBri(bri)
      if bri == nil then return nil end
      return math.floor((bri / 254) * 100 + 0.5)
    end

    local function briFromPct(pct)
      pct = tonumber(pct) or 0
      if pct < 0 then pct = 0 end
      if pct > 100 then pct = 100 end
      return math.floor((pct / 100) * 254 + 0.5)
    end

    local function luxFromLightlevel(lightlevel)
      if lightlevel == nil then return nil end
      local lux = math.floor(10 ^ ((tonumber(lightlevel) - 1) / 10000))
      if lux < 0 then lux = 0 end
      return lux
    end

    -- ---------------- PERSISTENT CHILD MAP ----------------
    function QuickApp:loadChildMap()
      local raw = self:getVariable("CHILD_MAP") or "{}"
      local ok, decoded = pcall(json.decode, raw)
      if ok and type(decoded) == "table" then
        self._childMap = decoded
      else
        self._childMap = {}
      end
    end

    function QuickApp:saveChildMap()
      if type(self._childMap) ~= "table" then self._childMap = {} end
      self:setVariable("CHILD_MAP", json.encode(self._childMap))
    end

    function QuickApp:setChildHueId(childDeviceId, hueId)
      self._childMap = self._childMap or {}
      self._childMap[tostring(childDeviceId)] = { kind = "light", id = tostring(hueId) }
      self:saveChildMap()
    end

    function QuickApp:setChildSensorId(childDeviceId, sensorId)
      self._childMap = self._childMap or {}
      self._childMap[tostring(childDeviceId)] = { kind = "sensor", id = tostring(sensorId) }
      self:saveChildMap()
    end

    function QuickApp:attachRuntimeIdsFromMap()
      self:loadChildMap()
      for _, child in pairs(self.childDevices or {}) do
        local rec = self._childMap[tostring(child.id)]
        if rec and rec.kind == "light" then
          child.hueId = rec.id
        elseif rec and rec.kind == "sensor" then
          child.sensorId = rec.id
        end
      end
    end

    -- ---------------- CONFIG + HTTP ----------------
    function QuickApp:loadConfig()
      self.hue = self.hue or {}
      self._busy = false

      local ip = (self:getVariable("HUE_BRIDGE_IP") or ""):gsub("%s+", "")
      local user = (self:getVariable("HUE_USERNAME") or ""):gsub("%s+", "")
      local poll = tonumber(self:getVariable("POLL_INTERVAL_M") or "") or DEFAULT_POLL_MS

      if ip == "" then ip = DEFAULT_BRIDGE_IP end
      if not poll or poll < 2000 then poll = DEFAULT_POLL_MS end

      self.hue.bridge = { ip = ip, username = user }
      self.hue.pollInterval = poll

      self:debug("Hue config: ip=" .. tostring(ip) .. " pollMs=" .. tostring(poll))

      if user == "" then
        self:error("Hue username missing. Set QA variable HUE_USERNAME.")
      end
    end

    function QuickApp:hueRequest(method, path, body, cbOk, cbErr)
      local ip = (self.hue and self.hue.bridge and self.hue.bridge.ip) or ""
      local user = (self.hue and self.hue.bridge and self.hue.bridge.username) or ""

      if ip == "" or user == "" then
        if cbErr then cbErr("Hue config missing (ip/username)") end
        return
      end

      local url = "http://" .. ip .. "/api/" .. user .. path
      local http = net.HTTPClient()

      local opts = {
        method = method,
        timeout = 7000,
        headers = { ["Content-Type"] = "application/json" },
        checkCertificate = false
      }
      if body ~= nil then opts.data = json.encode(body) end

      http:request(url, {
        options = opts,
        success = function(resp)
          local data = nil
          if resp and resp.data and resp.data ~= "" then
            local ok, decoded = pcall(json.decode, resp.data)
            if ok then data = decoded else
              self:error("JSON decode failed: " .. tostring(url) .. " data=" .. tostring(resp.data))
            end
          end
          if cbOk then cbOk(data, resp) end
        end,
        error = function(err)
          self:error("HTTP error " .. tostring(url) .. " -> " .. tostring(err))
          if cbErr then cbErr(err) end
        end
      })
    end

    -- ---------------- INIT + POLL ----------------
    function QuickApp:onInit()
      self:debug("Hue QA init (DISCOVERY LOCK enabled)")

      self:initChildDevices()
      self:attachRuntimeIdsFromMap()

      self:loadConfig()
      if (self.hue.bridge.username or "") == "" then return end

      local done = (self:getVariable("DISCOVERY_DONE") or "0"):gsub("%s+", "")
      self:debug("DISCOVERY_DONE=" .. tostring(done))

      if done ~= "1" then
        self:debug("First run -> discoverAll() and lock discovery")
        fibaro.setTimeout(500, function()
          self:discoverAll()
          self:setVariable("DISCOVERY_DONE", "1")
          self:debug("DISCOVERY_DONE set to 1 (auto)")
        end)
      else
        self:debug("Discovery already done -> refreshAll() only")
        fibaro.setTimeout(500, function() self:refreshAll() end)
      end

      fibaro.setTimeout(2500, function() self:startPolling(self.hue.pollInterval) end)
    end

    function QuickApp:startPolling(intervalMs)
      self._pollInterval = intervalMs or DEFAULT_POLL_MS
      self:debug("Start polling: " .. tostring(self._pollInterval) .. " ms")

      local function tick()
        self:refreshAll()
        fibaro.setTimeout(self._pollInterval, tick)
      end
      tick()
    end

    -- ---------------- HC3 ACTION ROUTING ----------------
    function QuickApp:onAction(event)
      if not event then return end

      local devId = tonumber(event.deviceId)
      local action = tostring(event.actionName or "")
      local args = event.args or {}

      local child = nil
      for _, c in pairs(self.childDevices or {}) do
        if tonumber(c.id) == devId then child = c break end
      end

      if not child then
        self:warning("onAction: child not found for deviceId=" .. tostring(devId) .. " action=" .. action)
        return
      end

      if action == "turnOn" then
        child:turnOn()
      elseif action == "turnOff" then
        child:turnOff()
      elseif action == "setValue" or action == "setBrightness" or action == "setLevel" then
        child:setValue(args[1])
      else
        self:warning("onAction: unsupported action=" .. action .. " deviceId=" .. tostring(devId))
      end
    end

    -- ---------------- DISCOVER / REFRESH WRAPPERS ----------------
    function QuickApp:discoverAll()
      if self._busy then return end
      self._busy = true
      self:discoverLights(function()
        fibaro.setTimeout(250, function()
          self:discoverSensors(function()
            self._busy = false
            self:refreshAll()
          end)
        end)
      end)
    end

    function QuickApp:refreshAll()
      if self._busy then return end
      self._busy = true
      self:refreshLights(function()
        fibaro.setTimeout(250, function()
          self:refreshSensors(function()
            self._busy = false
          end)
        end)
      end)
    end

    -- ---------------- LIGHTS ----------------
    function QuickApp:discoverLights(done)
      self:hueRequest("GET", "/lights", nil,
        function(data)
          if type(data) ~= "table" then
            self:error("Hue /lights returned no table")
            if done then done() end
            return
          end

          self:debug("Discover lights: " .. tostring(countTable(data)))

          for hueId, obj in pairs(data) do
            local name = (obj and obj.name) and obj.name or ("Hue " .. tostring(hueId))

            -- Create new child per Hue light
            local existingChild = nil
            -- Try find existing mapped child for this hueId (by scanning map)
            for _, c in pairs(self.childDevices or {}) do
              if c.hueId and tostring(c.hueId) == tostring(hueId) then
                existingChild = c
                break
              end
            end

            if not existingChild then
              local ch = self:createChildDevice({
                name = name,
                type = "com.fibaro.multilevelSwitch",
                initialProperties = { value = 0 }
              })
              -- Persist mapping: numeric deviceId -> Hue ID
              ch.hueId = tostring(hueId)
              self:setChildHueId(ch.id, hueId)
              self:debug("Created light child: deviceId=" .. tostring(ch.id) .. " -> hueId=" .. tostring(hueId) .. " (" .. name .. ")")
            end
          end

          if done then done() end
        end,
        function(err)
          self:error("Discover lights failed: " .. tostring(err))
          if done then done() end
        end
      )
    end

    function QuickApp:refreshLights(done)
      self:hueRequest("GET", "/lights", nil,
        function(data)
          if type(data) ~= "table" then
            if done then done() end
            return
          end

          -- Update by matching hueId to child.hueId (runtime)
          for _, child in pairs(self.childDevices or {}) do
            if child.hueId and data[tostring(child.hueId)] then
              local obj = data[tostring(child.hueId)]
              local st = (obj and obj.state) or {}
              local on = (st.on == true)
              local lvl = pctFromBri(st.bri)
              if lvl == nil then lvl = on and 100 or 0 else lvl = on and lvl or 0 end
              child:updateProperty("value", lvl)
            end
          end

          if done then done() end
        end,
        function(err)
          self:error("Refresh lights failed: " .. tostring(err))
          if done then done() end
        end
      )
    end

    -- ---------------- SENSORS ----------------
    function QuickApp:discoverSensors(done)
      self:hueRequest("GET", "/sensors", nil,
        function(data)
          if type(data) ~= "table" then
            self:error("Hue /sensors returned no table")
            if done then done() end
            return
          end

          self:debug("Discover sensors: " .. tostring(countTable(data)))

          for sensorId, obj in pairs(data) do
            local sType = obj and obj.type or ""
            local name = obj and obj.name or ("Hue sensor " .. tostring(sensorId))

            local deviceType = nil
            if sType == "ZLLPresence" then
              deviceType = "com.fibaro.motionSensor"
            elseif sType == "ZLLTemperature" then
              deviceType = "com.fibaro.temperatureSensor"
            elseif sType == "ZLLLightLevel" then
              deviceType = "com.fibaro.lightSensor"
            elseif sType == "Daylight" then
              deviceType = "com.fibaro.binarySensor"
            end

            if deviceType then
              local existingChild = nil
              for _, c in pairs(self.childDevices or {}) do
                if c.sensorId and tostring(c.sensorId) == tostring(sensorId) then
                  existingChild = c
                  break
                end
              end

              if not existingChild then
                local ch = self:createChildDevice({
                  name = name,
                  type = deviceType,
                  initialProperties = {}
                })
                ch.sensorId = tostring(sensorId)
                self:setChildSensorId(ch.id, sensorId)
                self:debug("Created sensor child: deviceId=" .. tostring(ch.id) .. " -> sensorId=" .. tostring(sensorId) .. " (" .. name .. ", " .. sType .. ")")
              end
            end
          end

          if done then done() end
        end,
        function(err)
          self:error("Discover sensors failed: " .. tostring(err))
          if done then done() end
        end
      )
    end

    function QuickApp:refreshSensors(done)
      self:hueRequest("GET", "/sensors", nil,
        function(data)
          if type(data) ~= "table" then
            if done then done() end
            return
          end

          for _, child in pairs(self.childDevices or {}) do
            if child.sensorId and data[tostring(child.sensorId)] then
              local obj = data[tostring(child.sensorId)]
              local st = obj.state or {}
              local cfg = obj.config or {}
              local sType = obj.type or ""

              if cfg.battery ~= nil then
                child:updateProperty("batteryLevel", tonumber(cfg.battery) or cfg.battery)
              end

              if sType == "ZLLPresence" and st.presence ~= nil then
                child:updateProperty("value", st.presence and 1 or 0)
              elseif sType == "ZLLTemperature" and st.temperature ~= nil then
                child:updateProperty("value", (tonumber(st.temperature) or 0) / 100)
              elseif sType == "ZLLLightLevel" and st.lightlevel ~= nil then
                child:updateProperty("value", luxFromLightlevel(st.lightlevel) or 0)
              elseif sType == "Daylight" and st.daylight ~= nil then
                child:updateProperty("value", st.daylight and 1 or 0)
              end
            end
          end

          if done then done() end
        end,
        function(err)
          self:error("Refresh sensors failed: " .. tostring(err))
          if done then done() end
        end
      )
    end

    -- ---------------- CHILD ACTIONS (LIGHTS ONLY) ----------------
    function QuickAppChild:turnOn()
      if not self.hueId then
        self.parent:warning("turnOn ignored: child has no hueId (child numeric id=" .. tostring(self.id) .. ")")
        return
      end
      local hueId = tostring(self.hueId)
      self.parent:debug("turnOn Hue light " .. hueId .. " (child deviceId " .. tostring(self.id) .. ")")
      self.parent:hueRequest("PUT", "/lights/" .. hueId .. "/state", { on = true })
      self:updateProperty("value", 100)
    end

    function QuickAppChild:turnOff()
      if not self.hueId then
        self.parent:warning("turnOff ignored: child has no hueId (child numeric id=" .. tostring(self.id) .. ")")
        return
      end
      local hueId = tostring(self.hueId)
      self.parent:debug("turnOff Hue light " .. hueId .. " (child deviceId " .. tostring(self.id) .. ")")
      self.parent:hueRequest("PUT", "/lights/" .. hueId .. "/state", { on = false })
      self:updateProperty("value", 0)
    end

    function QuickAppChild:setValue(level)
      if not self.hueId then
        self.parent:warning("setValue ignored: child has no hueId (child numeric id=" .. tostring(self.id) .. ")")
        return
      end

      local hueId = tostring(self.hueId)
      local pct = tonumber(level) or 0

      local body
      if pct <= 0 then
        body = { on = false }
      else
        body = { on = true, bri = briFromPct(pct) }
      end

      self.parent:debug("setValue Hue light " .. hueId .. " -> " .. tostring(pct) .. "% (child deviceId " .. tostring(self.id) .. ")")
      self.parent:hueRequest("PUT", "/lights/" .. hueId .. "/state", body)
      self:updateProperty("value", pct)
    end

    function QuickAppChild:setBrightness(level) return self:setValue(level) end
    function QuickAppChild:setLevel(level) return self:setValue(level) end
     

    It work, quick app, general, created

     

    First Variable, 

    Naam Waarde Opmerking
    HUE_BRIDGE_IP         192.168.68.                          IP-adres van je Hue Bridge
    HUE_USERNAME                            Hue API user
    DISCOVERY_DONE 0                         Wordt automatisch 1 na eerste succesvolle discovery
    CHILD_MAP {}                                  Verplicht – koppelt HC3 deviceId ↔ Hue ID

     

     

     

     

    Edited by tjeerdhage
    • 0
    Posted

    It was a long evening but it finaly it works.

    • Like 1
    • Thanks 1
    • 0
    Posted

    I transferred everything to my new Pro Bridge from the Bridge that was connected to the HC2, and now half the house has no lights. Has anyone managed to fix this problem?:-(

    • 0
    Posted

    Hi tjeerdhage,

     

    thank you for providing support integrating HUE PRO into Fibaro Home Center 3. I moved on to replacing my two HUE by one HUE PRO. I tried to get your script working in my HC3 but I am not knowledgeable in setting up devices and unfortunately was not able to make things running. Could you provide some guidance "for dummies" on how to get your solution to work :(?

     

    Thank you !!!

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...