Lifx Photons

Not sure if this would be better posted in the dev section.

I was recently shown this Lifx library and wondering if anyone in the community has worked with it before, and if any effort has been put into integrating it with HASS. This lifx library seems to be more feature rich than the current lifx lib and specifically has better support for some of the newer devices like the beam and tiles. It even comes with ~8 tile animations including a clock and marque.

Of note this appears to have been written by a lifx dev, so I assume its a fairly good integration into the lifx apis.

I’m not a python dev atm so I’m not great at evaluating this to see if its worth putting effort into implementing

github: https://github.com/delfick/photons-core
docs: https://delfick.github.io/photons-core/

This would indeed be great!

From a cursory glance, Photons looks like it could be a good replacement for the aiolifx library. Being written by a LIFX employee should be an advantage since I assume he will have easy/cheap access to new LIFX products.

I know the above is not too useful but I thought I would give my nod of approval since I was the one implementing the current aiolifx-based integration (however, I am currently on hiatus so I will not be doing the conversion).

So, is there a bounty system on Home-Assistant? I wouldn’t mind paying some coffees/RedBulls to a Dev to take a look at this!

1 Like

Is there any reason to do work in creating this integration? Is something broken in the existing aiolifx stuff?

I got some LIFX bulbs recently and I’m a Python dev…

I don’t think anything is broken per se but some special features on products like Z and Tile are not supported.

Ya to expand a bit on what @amelchio said , the current library works great for the standard Lifx bulbs (A19 / BR30). I have ~15 Lifx bulbs of various models and I have 0 problems with them and the current library. The real aim in switching libraries would be to get better support for the more non-standard Lifx products like the light strip, Beam, and Tiles. The current library DOES work with these products, but it doesn’t leverage the products fully. The biggest gap really comes in on the Tiles. These are LED matrices, and all you can really do with them in the current library is set the whole tile to 1 color. The library I proposed above lets you finely control them to do stuff like turn them into marque, clocks, and some other really cool effects. It seemed like this other library does also have slightly better support for some of the strips too, but it didn’t seem all that much better tbh.

The library also comes with an animation framework to create custom animations. I’m pretty sure tho that the existing library has something similar, but I havent looked at it in a while.

At the end of the day I personally would like to have better support for Tiles, so if adding better Tile support is on the table to aiolifx I’m all for it too. As long as any dev is willing to guide me a bit, I’m happy to do any testing with my devices

3 Likes

One of the reasons would be, as they said, a better support for Tiles and Strips.

Anyone ever gave this a try?

The Bounty offer still stands

The Bounty offer still stands

I contacted the dev of Photons and the interactor has since been integrated into Home Assistant as a custom add-on. More information can be found here:

https://photons.delfick.com/apps/interactor/homeassistant.html#

I can say from experience that it works very well. I would suggest using a couple templated REST commands in Home Assistant to alter the parameters you want before sending the command to your devices using Photons (as opposed to making a new command for every device, animation, color, etc).

1 Like

Hey, thanks for this post. I’m starting to use the photons interactor but I’m really lost. I’ve managed to to test the example provided in the photons documentation and I could also start the animation demo but I can’t get any further than that. Could you provide some of your examples or some documentation on how to properly build the JSONs? thanks in advanced

I actually have no experience using/building JSON files, and have been using REST commands to interact with the addon itself by changing the payload. For example, I use the following command to apply a theme to my devices and then start the “move” effect at the same time - one command.

photons_effects_move_new_theme:
  url: 'http://192.168.1.205:6100/v1/lifx/command'
  method: "put"
  payload: '{"command": "effects/run", "args": {"matcher": {"label": {{ label }} }, "linear_animation": "MOVE", "linear_options": {"power_on": false, "speed": {{ speed }} }, "apply_theme": true, "theme_options": {"colors": {{ colors }}, "power_on": false, "overrides": {"brightness": {{ brightness }} } } }}'

You can use these REST commands to basically control the entirety of Photons, such as applying themes, starting effects, starting Photons-specific animations, etc. The only thing that changes is the payload, which I can give more examples if you need, but I think the link above might have some as well.

Anyway, I made separate, generic REST commands for everything like applying themes, stopping effects, etc, and you’ll notice variables like {{ label }} and {{ colors }}, which allow for dynamic REST commands to change the devices, speed, colors, brightness, etc. at the script level instead of needing separate REST commands for every possible combination.

So here’s a simple script I have that runs the above REST command:

photons_move_cooling_beam:
  sequence:
    - service: rest_command.photons_effects_move_new_theme
      data:
        label: '"Beam"'
        speed: 10
        colors: >
          ["hex:#0f4ffb", "hex:#198df8", "hex:#5cf7f1", "hex:#adfed4", "hex:#d4fff3"]
        brightness: '{{ state_attr("light.beam", "brightness")|float / 256 }}'

You can see the service is simply the REST command itself, and then you can specify all the data below, where "Beam" is the name of my Beam, the speed at which the Move effect is applied, the colors of the theme you want, and then the brightness. And you can make many more scripts that apply the same REST command but with different parameters, if you’d like.

2 Likes

I’ve been working on and off to try and port the lifx integration to Photons and came to the conclusion (as a Photons contributor and in discussions with the Photons author) that using it in its current state as a library is not feasible.

However, I’ve did some amount of work on a custom component that used Photons Interactor instead. This is far more reasonable, about as performant, but would require users to deploy Interactor either as an addon or manually. If there is any interest, I could look at resuming that effort?

1 Like

I would be interested in using it

Would be keen, I’ve got Photons as a a Docker container, so a custom add-on would be great.

I’ll see what state my Interactor component is in and let you know.

1 Like

Turns out I didn’t really spend much time on an Interactor-based component and spent more time working on a pure Photons component. I’m going to have a play this weekend with seeing what an Interactor component might look like before deciding whether or not to try and build it properly.