Activate themes, effects and more for lifx

Is it possible to activate the scenes, effects, themes or time planing that are configured in the lifx app by Hass? Or are they saved inside of the app?

Would be great if I could activate the scenes and the other stuff from Hass without writing scripts or automations for all of them.

By the way, has someone some effects, themes or other cool lighting stuff he could share? :sunglasses:

LIFX schedules are in the cloud so not part of HA. Effects are coming soon when I complete the new LIFX library for HA.

3 Likes

Canā€™t wait for it. :blush:

Thanks for the update and for your hard work. Happy Holidays!

Have lifx effects been implemented yet?

Been busy with a full course load this semester and unable to sit down and really churn through what needs to be done, but others seem to have started looking into helping.

Thanks, I wish I knew python better :slight_smile:

Hi, how is it going? Donā€™t mean to bother you, just wondering if you have in mind to continue with this project.
Thanks, wish you the best.

Good news :slight_smile: ā€¦ Home Assistant 0.43 added support for some of this:

  • Scenes created in the smartphone app can now be activated (via the LIFX Cloud, so a bit slow)
  • A few effects are now available. These are built from scratch for Home Assistant, so they are not exactly like the smartphone effects.
  • I am looking into themes but these will also have to be built from scratch for Home Assistant.
  • Schedules are completely in the LIFX Cloud and quite frankly a bit useless if you run Home Assistant ā€¦
1 Like

Any progress on the theme part?

Cheers!!!

Sorry, no real progress on themes. I did not lose the motivation yet but other things have kept popping up.

1 Like

So it looks like the LIFX APIā€™s do support effects: https://api.developer.lifx.com/docs/morph-effect

Would it be possible for the Home Assistant LIFX component to leverage these effects directly?

2 Likes

Yes, supporting firmware effects would be possible. I am not currently working on the LIFX integration though. Also, I do not have any LIFX Tile so somebody else would have to do the implementation.

Any updates on this? Would love to be at least able to stop effects on the tiles.

Would love to see the Lifx Themes in Hassio, ā€œBlendā€ theme is awesome!
Is it possible to activate the ā€œThemes Blend / Warmingā€ using Home assistant?

1 Like

LIFX has a public and well-documented REST API, which means with a little effort you can trigger themes using a REST template (and then fire from an automation, script, etc). Like you, I wanted to get Morph working so I setup a rest_command with the following in my config (note: be sure to prepend your token with ā€œBearerā€ followed by the token). Here are the steps:

  1. Go to https://cloud.lifx.com/settings, sign in with your Lifx account and generate a bearer token, youā€™ll use this to authenticate against the API

  2. Place this in your secrets.yaml file (or directly in config, not recommended).

secrets.yaml:
...
lifx_token: Bearer <token you just created>
  1. Go to your configuration.yaml file and add the rest_command config below, feel free to adapt as per the lifx API documentation to suit your needs:
rest_command:
    lifx_tiles_morph:
        url: https://api.lifx.com/v1/lights/{light_id OR all}/effects/morph
        method: POST
        headers:
          authorization: !secret lifx_token
        payload: '{"power_on": true}'
  1. Restart your server to pull in the new config
  2. From here, you can set your LIFX light(s) using the command you just configured as a service, such as from an automation:

That should get you up and running! At some point Iā€™ll look into if I can submit a PR to add this natively to the componentā€¦

@aicarmic, thanks that worked perfectly. To take it a step further, I set up my rest_command to parse a payload provided to it into the request payload.

rest_command:
  lifx_effect:
    url: https://api.lifx.com/v1/lights/{{ selector or "all" }}/effects/{{ effect or "flame" }}
    method: POST
    headers:
      authorization: !secret lifx_token
      content-type: application/json
    payload: "{{ (payload | tojson) if payload else '{\"power_on\": true}' }}"

Button in Lovelace

name: Breathe Blue Living Room
tap_action:
  action: call-service
  service: rest_command.lifx_effect
  service_data:
    effect: breathe
    selector: 'group:Living Room'
    payload:
      color: blue
      cycles: 10
type: button

Using the api docs, it is then is very easy to set up new effects on a dashboard or trigger them from scripts.

1 Like

Nice! Glad it worked and cool idea to pass configurable payloads.

1 Like

This would be amazing.

1 Like

Looks like some minor modifications are needed for the latest HA release and LIFX API. The following works well:

url: "https://api.lifx.com/v1/lights/{{ selector or 'all' }}/effects/{{ effect or 'flame' }}"
method: post
headers:
  authorization: !secret lifx_token
  accept: 'application/json'
payload: "{{ (payload | tojson) if payload else '{\"power_on\": true}' }}"
content_type: 'application/json; charset=utf-8'

Changed to the latest way to specify the content_type header and also added the accept header.

1 Like