Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users

    Matter writeAttribute Crashing

    Flic Hub SDK
    2
    6
    221
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pico
      pico last edited by pico

      Starting at least last night, using any writeAttribute Matter method started erroring with an uncatchable exception which completely crashes the script.

      This exact kind of code worked at least a week ago (maybe even earlier yesterday), and then last night when I was working on some changes I noticed a new crash that was not happening within my code.

      I'm not sure what would have caused this as I don't think my Matter devices had any firmware updates, nor the Flic Hub LR getting a firmware update.

      It appears that the attribute is getting set, but something after that point in underlying Flic code is not expecting a Success value.

      EXAMPLE CODE:

      const matterModule = require('matter')
      const matterDevices = matterModule.getNodes()
      
      const matterDeviceIDsForNames = {}
      for (const thisMatterDevice of matterDevices) {
      	matterDeviceIDsForNames[thisMatterDevice.name] = thisMatterDevice.nodeId
      }
      
      const thisMatterDeviceID = matterDeviceIDsForNames['Living Room Corner Lamp']
      
      const brightnessPercentage = 80
      const brightnessLevel = Math.round(254 * (brightnessPercentage / 100))
      
      matterModule.writeAttribute(thisMatterDeviceID, 1, 'Level Control', 'OnLevel', brightnessLevel, () => {})
      

      ERROR OUTPUT:

      SyntaxError: unexpected token: 'Success'
          at <input>:1
          at parse (native)
          at handlePacket (core.js:3259)
          at onPipeData (core.js:3336)
      
      Emil 1 Reply Last reply Reply Quote 0
      • Emil
        Emil FlicTeam @pico last edited by

        @pico The hub checks for updates automatically every 24 hours. Unfortunately there is no history on the device of updates. If there are new features for an update, we typically show those in the changelog of the Android/iOS app.

        1 Reply Last reply Reply Quote 0
        • pico
          pico @Emil last edited by

          @Emil Looks like it's fixed in 4.4.1, thank you so much!

          Out of curiosity, is there a set time that the Flic Hub LR auto-checks and installs updates? Also, there a log of update history on the device to see when updates were installed? And is there a changelog available anywhere?

          Emil 1 Reply Last reply Reply Quote 0
          • Emil
            Emil FlicTeam @pico last edited by

            @pico No, it was a firmware update. Please try to update to the latest firmware 4.4.1 and see if it resolves the issue.

            pico 1 Reply Last reply Reply Quote 0
            • pico
              pico @Emil last edited by

              @Emil Awesome, thank you so much!

              I'm glad this was easy to track down. I'm curious, is there any explanation as to how this popped up in previously working code when no firmware updates were done in the meantime? Does the Flic Hub LR have other OTA updates to the SDK runtime that are separate from the device firmware?

              Emil 1 Reply Last reply Reply Quote 0
              • Emil
                Emil FlicTeam @pico last edited by Emil

                @pico thanks for the report. Found the issue. Will fix the upcoming week.

                pico 1 Reply Last reply Reply Quote 0
                • First post
                  Last post