Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users
    1. Home
    2. pico
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 17
    • Best 1
    • Controversial 0
    • Groups 0

    pico

    @pico

    1
    Reputation
    2
    Profile views
    17
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    pico Unfollow Follow

    Best posts made by pico

    • RE: FlicScript Matter Examples

      @Emil Neat! I am seeing that setting MoveToLevel with OptionsOverride set to 1 does set the brightness when the light is off when it is turned back on via Matter, such as in the Apple Home app (which is something I've never been able to do via any exposed app controls). But, oddly Tapo itself seems to not honor that setting if I turn the light back on via the Tapo app, or more importantly via the wall switch. Seems like a Tapo quirk/bug and not an issue with FlicScript since it seems the setting is properly honored within the Matter protocol.

      From poking around more, I found the OnLevel attribute which looked interesting and I was able to set that with matterModule.writeAttribute(thisMatterDeviceID, 1, 'Level Control', 'OnLevel', brightnessLevel, () => {}). This appears to basically do what I want when the light is off, it will always get turned on to the specified brightness level. This has the effect of not keeping a manually set brightness, after the light is turned off and back on it will turn on to the specified OnLevel brightness instead of the previously manually set brightness, but I think that is actually totally fine for my desires in this project.

      This is so much fun to be able to work with Matter devices at such a low level! I really appreciate your advice and help with this all!

      posted in Flic Hub SDK
      pico
      pico

    Latest posts made by pico

    • RE: Can FlicScript Add Support for Local Timezones (with DST)

      @Emil Thanks for getting back to me. So no chance on adding Intl.DateTimeFormat API support to FlicScript or including a way to set the timezone in the app that is passed down into FlicScript?

      posted in Flic Hub SDK
      pico
      pico
    • Can FlicScript Add Support for Local Timezones (with DST)

      One of my scripts changes brightness based on the current time. I've noticed that FlicScript always uses UTC time, and there is no way to set a timezone in the app or even in code. When using new Date().toLocaleString('en-US', {timeZone: 'America/Los_Angeles'}) the UTC date is still returned.

      It isn't too hard to just get the UTC time and change the hours offset manually (which I'm currently doing), but it becomes a hassle when changes with Daylight Savings Time is factored in.

      Would is be possible to add a way to set the timezone in the app or something so that new Date() returns the date in the specified timezone (or the current location and timezone could be detected automatically), or at least make toLocaleString work properly so timezones can be adjusted manually an have DST accounted for automatically.

      Thank you!

      posted in Flic Hub SDK
      pico
      pico
    • RE: Matter writeAttribute Crashing

      @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?

      posted in Flic Hub SDK
      pico
      pico
    • RE: Matter writeAttribute Crashing

      @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?

      posted in Flic Hub SDK
      pico
      pico
    • Matter writeAttribute Crashing

      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)
      
      posted in Flic Hub SDK
      pico
      pico
    • RE: Flic Hub LR as MQTT Broker?

      @Emil So you're saying it's not an existing capability in mqtt.js on https://github.com/50ButtonsEach/flic-hub-sdk-mqtt-js and it is something I would have to write myself?

      posted in Flic Hub SDK
      pico
      pico
    • Flic Hub LR as MQTT Broker?

      Can the Flic Hub LR itself be an MQTT broker to not need another piece of hardware if I just want the Flic Hub LR to subscribe and respond to MQTT messages from other sources? This way, I could use the Flic Hub LR as basically an MQTT-to-Matter bridge without needing another Raspberry Pi running as the MQTT broker.

      posted in Flic Hub SDK
      pico
      pico
    • RE: Cross-Module Persistent Data Storage

      @Emil It would be awesome if you all could add a Global Datastore in the future! If you need any help testing, I would be happy to play with a beta version!

      The Govee lights I'm working with are an older model H7013 which are warm white dimmable string lights that support Wi-Fi and Bluetooth, but that means the integrations are pretty limited to IFTTT which can be slow, and I can't detect the current state. The LAN API is much faster and I can check the current state, which is great.

      I've looked into upgrading to newer Matter versions from Govee or anyone else but they are all more expensive than is worth it for me when what I have it working, and many newer models have more features/complexity than I really want (don't want RGB or anything, just want 2700K warm white and dimmable).

      posted in Flic Hub SDK
      pico
      pico
    • Cross-Module Persistent Data Storage

      I'm curious if there is any way to have any data storage available across modules. datastore module is available, but it is per-module (looks like it makes a SQLite DB within the module).

      I would like the be able to have an IP address discovered from one module available to another.

      For the background, I am using the UDP/dgram module to control Govee lights via their LAN API (which is something I've always wanted to play with and the Flic Hub LR made it so easy, thank you!!!). I have one module (we'll call it Module A) which is bound to a port which allows me to listen for a response from a Multicast message which contains the IPs of the Govee lights. I do some controls to the lights within that Module A, but I also want to be able to control the lights from within another module (Module B), which just requires the IPs and doesn't need to do all the overhead of listening to responses. But these IPs aren't static and I was wanting to be able to log/store the IPs from Module A and access them from Module B so that I don't have to manually update Module B whenever the IPs change. Is this possible in any way? Thank you!

      posted in Flic Hub SDK
      pico
      pico
    • RE: FlicScript Matter Examples

      PS. For anybody finding this in the future, I also tried setting the StartUpCurrentLevel attribute and that behaves the same as calling MoveToLevel with OptionsOverride set to 1 when the light is off, Matter honors it when turned back on, but Tapo does not.

      posted in Flic Hub SDK
      pico
      pico