Closed obaldius closed 2 years ago
first of all, congrats for this work.
Thanks!
I managed to create a handfull of rest_command requests to make use of the HTTP API. So far so good, it's working great
wooh!
Problem is I don't understand the documentation. is there any documentation newbie proof on how to properly build the JSON messages?
Yeah, Documentation isn't great and I never found time to fix that (especially since I barely program in my free time anymore after my mental health tanked since August 2020. Much better now but I don't think I'll return to the level of programming I used to do lol)
How, for example, can I set the speed of the morph effect?
So. In this case, we're passing those matrix_options into the SetTileEffect high level message object - https://github.com/delfick/photons/blob/main/apps/interactor/interactor/commander/commands/effects.py#L77
And it ends up passing things into a lifx binary SetTileEffect message - https://github.com/delfick/photons/blob/e2e28aff2b87d1c3c03135d1765e6c675636b6ae/modules/photons_control/tile.py#L97
So for the speed of the effect, you can specify speed
in seconds.
{
"command": "effects/run",
"args": {
"matcher": {
"product_identifier": "lifx_tile"
},
"matrix_animation": "MORPH",
"matrix_options": {
"speed": 10,
"palette": [
"red",
{"hue": 60, "saturation": 1, "brightness": 1, "kelvin": 3500},
{"hue": 120, "saturation": 1, "brightness": 1, "kelvin": 3500},
{"hue": 180, "saturation": 1, "brightness": 1, "kelvin": 3500},
"purple"
]
}
}
}
Don't be afraid to ask more questions :)
I'm aware a lot of the time the interactor commands code need to be read to understand what they do and how to make them do certain things.
also, there is a help page for effects/run
that mentions matrix_options
but it certainly is vague about it hahah
╰─ ./command help '{"command": "effects/run"}'
Command effects/run
===================
Start or stop a firmware animation on devices that support them
Arguments
---------
matcher: string or dictionary
What lights to target. If this isn't specified then we interact with all
the lights that can be found on the network.
This can be specfied as either a space separated key=value string or as
a dictionary.
For example,
"label=kitchen,bathroom location_name=home"
or
``{"label": ["kitchen", "bathroom"], "location_name": "home"}``
See https://photons.delfick.com/interacting/device_finder.html#valid-filters
for more information on what filters are available.
timeout: float (default 20)
The max amount of time we wait for replies from the lights
apply_theme: boolean (default False)
Whether to apply a theme to the devices before running an animation
theme_options: dictionary
Any options to give to applying a theme
matrix_animation:
The animation to run for matrix devices.
This can be FLAME, MORPH or OFF.
If you don't supply this these devices will not run any animation"
matrix_options: dictionary
Any options to give to the matrix animation. For example duration
linear_animation:
The animation to run for linear devices.
Currently only MOVE or OFF are supported
If you don't supply this these devices will not run any animation"
linear_options: dictionary
Any options to give to the linear animation. For example duration
Yeah, Documentation isn't great and I never found time to fix that (especially since I barely program in my free time anymore after my mental health tanked since August 2020. Much better now but I don't think I'll return to the level of programming I used to do lol)
Don't take me wrong. Documentation might be great but we don't have the same progamming skills :). I hope you are much better at that, take it easy. As I suspected what's happening is Node Red isn't showing me the whole help info. The string is so long it gets cut midway. Now with the hints you gave me I hope I'll bother you as little as possible but it's nice to know I can come back :).
Again, just in case I don't come back, thanks a lot for this work and take care. Have some good hollydays
Excuse me @delfick for coming back so soon ^^. Could you tell what's wrong with the "fade_in_speed" syntax? I haven't been able to set that neither the twinkles_color_range field... I can't figure out the proper syntax
thanks
EDIT
Sorry I forgot to add one of my numerours attempts, but I can't get it to work. Could you please share an example for the animations options? thanks
I tried this among other things to no avail
I've been looking for an excuse to get my Tiles back onto a wall and in service. If I can get at least one set operational, I'll play with my HA/Node-RED instance and see if I can work this out too.
Hopefuly @Djelibeybi or @Final-Hawk can help you with hassio, I don't use that system and definitely don't have time to look at it anytime soon.
In the meantime, I recommend using https://github.com/delfick/photons/blob/main/apps/interactor/command
So instead of
curl -XPUT http://192.168.1.29:6100/v1/lifx/command \ -HContent-Type:aplication/json -d '{"command": "help", "args": {"command": "effects/run"}'
you instead say
./command help '{"command": "effects/run"}'
I have just been fiddling with the twinkle options. This is what worked for me.
curl -XPUT http://127.0.0.1:6100/v1/lifx/command \ -HContent-Type:application/json -d {"command": "animation/start", "args": {"animations": [["twinkles", {"twinkles_color_range": "50-100", "fade_in_speed": "0.1"}]]}}
I moved the twinkles part of this conversation into it's own discussion to keep things on topic :)
On Sat, 18 Dec 2021, 1:55 pm Joshua, @.***> wrote:
I have just been fiddling with the twinkle options. This is what worked for me.
curl -XPUT http://127.0.0.1:6100/v1/lifx/command \ -HContent-Type:application/json -d {"command": "animation/start", "args": {"animations": [["twinkles", {"twinkles_color_range": "50-100", "fade_in_speed": "0.1"}]]}}
— Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/82#issuecomment-997131039, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5MO2U6BB4HLE5AVKXTURPZ2LANCNFSM5KHGV3PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
@Final-Hawk Thanks a lot for that example. I would've never got to that. How did you get to that? Is there some clue somewhere in the docs?
Came back to thank you all guys. Thanks to you I managed to set this beautiful christmass lights before it was too late ^^.
Thanks @delfick for this great work
wooh! that's awesome :)
On Sun, 19 Dec 2021, 11:21 am obaldius, @.***> wrote:
Came back to thank you all guys. Thanks to you I managed to set this beautiful christmass lights before it was too late ^^.
Thanks @delfick https://github.com/delfick for this great work
— Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/82#issuecomment-997304872, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5J6XRXCKOMGWIYRTALURUQPFANCNFSM5KHGV3PQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
Hi,
first of all, congrats for this work.
I managed to create a handfull of rest_command requests to make use of the HTTP API. So far so good, it's working great.
Now I want to move to Lifx photons using the Home Assistant addon. I've succeded in making a couple of requests, changing some bulbs colors and setting some firmware effects.
Problem is I don't understand the documentation. I learnt from a guy that in order to set a palette to the morph effect I have to add "matrix_options" whithin the JSON as shown below. But that "matrix_options" thing is nowehere in the addon documentation nor in the help command. How am I supposed to know I must set that or other things in order to achieve my goals? How, for example, can I set the speed of the morph effect? is there any documentation newbie proof on how to properly build the JSON messages?
Thanks in advanced