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

Posts made by pico
-
RE: Flic Hub LR as MQTT Broker?
-
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.
-
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).
-
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!
-
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 callingMoveToLevel
withOptionsOverride
set to1
when the light is off, Matter honors it when turned back on, but Tapo does not. -
RE: FlicScript Matter Examples
@Emil Neat! I am seeing that setting
MoveToLevel
withOptionsOverride
set to1
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 withmatterModule.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 specifiedOnLevel
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!
-
RE: FlicScript Matter Examples
@Emil About needing the current state on demand rather than listing for updates... I want to write a script to adjust the brightness of lights throughout the day (dimming them hourly throughout the evening). This is also why I asked about sleeping in FlicScript.
I've already done this functionality through IFTTT using their scripting capabilities and jumping through hoops triggering Tapo shortcuts for turning lights back off after a delay if they were off before changing the brightness, but I'm hoping to make it simpler and more efficient through FlicScript.
The catch is that to adjust the brightness you need to turn the light on. So, if the light is already on, I can set the new brightness and that's that. But, if the light is off, it needs to be turned on to the new brightness and then turned back off so that when it's next turned on manually it will be at the desired brightness. To do this properly, I need to know if the light was currently on or off before adjusting the brightness so that it can be back in its previous state after the change is done. It's a little weird to have my lights turn on and off throughout the evening but not being blasted will full brightness lights later into the evening is nice.
It would be amazing if it were possible to adjust the "remembered" brightness without turning the light on, but from what you described before it sounds like that's not possible even with this more direct access to the Matter devices. Or am I mistaken? I haven't had a chance to test that deeply yet. Would
writeAttribute
be able to adjust the brightness without turning a light on? -
RE: FlicScript Matter Examples
@Emil Thank you so much, this is exactly the info I was hoping for! I've already done a proof of concept and it was so awesome to be able to toggle my Matter light via script, it's gonna be so much fun to control my house this way!
About getting the current status, the only way is via the asynchronous subscription? There is no synchronous way to just directly query the current status? If so, I can build a synchronous function around a subscription that is awaited and then canceled when the value is retrieved. Just want to be sure that is the best option before I move forward with that.
Also, out of curiosity, what would the
writeAttribute
method be used for? -
RE: Sleeping in FlicScript
@Emil Thank you! This is exactly the confirmation I needed to get started with my project! It's so cool to be able to script Matter devices!
-
Sleeping in FlicScript
I would like to have a run a script every hour to check the time and change the brightness of a light throughout the evening.
Is it possible for the Flic Hub LR to run a script on a schedule, or would I need to have the script running continuously manually create a loop using
setTimeout
to sleep for an hour? Or is there some better way to sleep in a loop, like how a script can wait for a button press but being trigger at a time instead of on an event?Would it be horribly inefficient for the hub to have script sleeping for long periods using
setTimeout
or is that effectively the same as having a script running continuously and waiting for a button press?Thank you!
-
RE: FlicScript Matter Examples
@Emil Thank you! I would like to control plugs and light switches, both with basic on/off and some with dimming. I also have one color changing bulb I would like to be able to set color temperature and brightness on. But would like to just start with the basics of turning a plug on and off and then move to brightness and then to color.
Also, would like to be able to see the current on/off state of a device, is that possible?
If the specific devices are important, I'm using Tapo stuff:
Basic Plug: https://www.tapo.com/us/product/smart-plug/tapo-p125m/
Dimmable Plug: https://www.tapo.com/us/product/smart-plug/tapo-p135-kit/Basic Switch: https://www.tapo.com/us/product/smart-switch/tapo-s505/
Dimmable Switch: https://www.tapo.com/us/product/smart-switch/tapo-s505d/Multicolor Bulb: https://www.tapo.com/us/product/smart-light-bulb/tapo-l535e/
-
FlicScript Matter Examples
I'm curious about controlling Matter devices via FlicScript. I was able to use getNodes to list my Matter devices, but I'm having a hard time understanding exactly what would need to be passed to the sendCommand method.
Are there any working example scripts on how to control Matter devices?