Flic Home

    Community

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

    pico

    @pico

    1
    Reputation
    2
    Profile views
    23
    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

    • Recently Saved Module Script Lost If Hub Loses Power

      I've got a Flic Hub LR on firmware 4.6.0. I've noticed if I reboot the hub within a couple minutes after saving a module file I've just edited that the file can be completely empty or incomplete after the reboot.

      But, if I reboot 10min or more after saving, the files are intact. I haven't noticed the same issue with a module's datastore.db contents which seem to stay intact even when edited shortly before the reboot.

      Is there some delay before a saved script file is flushed to storage?

      posted in Flic Hub SDK
      pico
      pico
    • Flic Hub LR 4.6.0 drops a Thread lock when a command times out, and after about 10 minutes idle

      I've got a Flic Hub LR on Firmware 4.6.0 connected via Ethernet. It has been a reliable Matter controller for 47 Wi-Fi devices, but my one Thread device has been flakey via Flic.

      • Ultraloq Bolt Fingerprint lock (battery, Matter over Thread), firmware 02.37.0028. Multi-admin: Apple Home, SmartThings, Flic Hub.
      • Thread border routers: two HomePod minis and an Apple TV 4K (27.2); two SmartThings Hub v3 (000.062.00016, separate Thread network, no devices).
      • Measured with a Hub SDK module: Identify (IdentifyTime 0), reachable from getNodes() and nodeUpdate, connected from matter.subscribe().

      I've see that a command that times out drops the node: sendCommand calls back after 70 to 175s (50: CHIP Error 0x00000032: Timeout where recorded), and the node goes unreachable in the same second. Eight times today. With nothing sent, the node dropped 10 minutes after the last answered command. After a drop, sendCommand fails in about 50ms with 72: node not connected, for minutes to hours. Today, answered commands took 44 to 112s. Ping to the lock through each border router works and takes about 2.7s. The node reported reachable and connected for 14 minutes, then the first command failed in 153ms with error 72 and then the flags go false. A hub restart reconnects the node within about 20s, but the first command after 7 of 8 restarts today failed and dropped it again. Last night, a test command running every 3 minutes all answered for 1.5h, until an automatic router reboot, and then connected never returned, though commands succeeded for another 3h. Today, most commands timed out, at intervals of 3, 7 and 15 minutes. Throughout all the issues via Flic, Apple Home and SmartThings continue control the lock, and all border routers announce its Thread prefix. Rebooting Thread hubs, battery pulls and re-adding the lock to the Flic Hub did not help.

      Is this a known issue? Are there any logs I can collect or more details I can provide?

      posted in Flic Hub
      pico
      pico
    • RE: Flic Duo Position Detection (On the Wall vs Handheld)

      @Emil Thank you!!!

      posted in Flic Hub SDK
      pico
      pico
    • Flic Duo Position Detection (On the Wall vs Handheld)

      I would like to be able to determine if a Flic Duo is on the wall or handheld in FlicScript.

      I see there is gesture and orientation (x, y, and z dict) attributes, but I'm not certain exactly what orientation parameters are best to accurately determine if a Flic Duo is currently mounted on the wall.

      Is it possible to add a definitive position attribute (or something similar gesture) to know if a Flic Duo is currently on the wall? Or, would it be possible to share the exact orientation conditions that y'all use internally when someone configures an action through the app to determine if the Flic Duo is on the wall or handheld?

      posted in Flic Hub SDK
      pico
      pico
    • RE: Crash with MQTT

      I just noticed this post https://community.flic.io/topic/18577/mqtt-issue-on-firmware-version-4-4-5 and updated Flic Hub to version 4.4.6 which appears to have solved the crash.

      posted in Flic Hub SDK
      pico
      pico
    • Crash with MQTT

      I have been using MQTT properly with the following code for a long time, and then yesterday I noticed my buttons weren't responding and when checking the Flic Hub Studio console I see that my script is crashing over and over again when running mqttClient.connect() with the following error:

      TypeError: Invalid type
          at invoke (native)
          at connectWithHostAndPort (core.js:1273)
          at <anonymous> (core.js:1332)
          at func (core.js:2325)
          at nextTickHandler (core.js:2334)
      

      Here is my whole MQTT code, and I am using the latest version of mqtt.js that is posted on https://github.com/50ButtonsEach/flic-hub-sdk-mqtt-js

      const mqttClient = require('./mqtt').create(mqttBroker, {username: mqttUsername, password: mqttPassword}) // https://github.com/50ButtonsEach/flic-hub-sdk-mqtt-js
      
      mqttClient.on('connected', () => {
      	console.log(`Connected to MQTT Broker ${mqttBroker}`)
      	mqttClient.subscribe('[TOPIC]')
      })
      
      mqttClient.on('disconnected', () => {
      	throw new Error(`DISCONNECTED from MQTT Broker ${mqttBroker}`) // Error to restart script if disconnected from MQTT broker.
      })
      
      mqttClient.on('publish', (pub) => {
      	console.log(`\nReceived MQTT Message on Topic: ${pub.topic}\n${pub.message}`)
      
      	// Handle button actions here.
      })
      
      mqttClient.connect()
      setInterval(() => { if (!mqttClient.connected) throw new Error('MQTT Broker NOT CONNECTED') }, 900000)
      // Check every 15 minutes that MQTT Broker is connected, and throw error to restart script if not.
      // This check is important if fails to connect to MQTT Broker at launch, when the "disconnected" event would never be sent.
      
      posted in Flic Hub SDK
      pico
      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