delfick / photons

Python3.6+ asyncio framework for interacting with LIFX devices
https://photons.delfick.com
MIT License
73 stars 6 forks source link

[interactor] Making scene doesn't work on candles #70

Closed delfick closed 3 years ago

delfick commented 3 years ago

As reported in https://github.com/delfick/photons/issues/61, creating a scene on a candle records a single colour instead of the matrix of zones.

delfick commented 3 years ago

@pimw1 I'm pushing out this fix and when https://github.com/delfick/photons/runs/3331419646?check_suite_focus=true is done I'll push out the change to the homeassistant plugin and let you know.

delfick commented 3 years ago

@pimw1 homeassistant should have the update now to go into version 0.9.1 and then it should work. Do reopen this issue if it doesn't.

pimw1 commented 3 years ago

Thank you delfick! I'll check it next week.

pimw1 commented 2 years ago

Sorry for the late reply, due to personal circumstances, i was unable to continue sooner. Anyhow, i'm back on track. I've installed version 0.91 and it is correctly capturing the matrix zones for the candle lights. Awesome. Thank you very much for the fix!

I've a small question: is it possible to apply a transition time (e.g. 2 seconds) when calling a scene? For example:

Creating the scene: curl -XPUT http://192.168.178.2:6100/v1/lifx/command \ -HContent-Type:application/json \ -d '{"command":"scene_capture", "args":{"label":"overdag","uuid":"overdag","matcher":{"serial":["d073dxxxxxx","d073dyyyyy"]}}}'

Applying the scene curl -XPUT http://192.168.178.2:6100/v1/lifx/command \ -HContent-Type:application/json \ -d '{"command":"scene_apply", "args":{"uuid":"overdag"}}'

It works beautifully, but is there a way to add a transition time to it?

delfick commented 2 years ago

Try adding an "overrides": {"duration": 2} to the args.

pimw1 commented 2 years ago

Very nice, that did the trick! I was trying "overrides": {"transition": 2} with no luck ;)

Is there any place where these kind of tips&tricks are documented? I could not find all information on https://photons.delfick.com/ (i could be overlooking some stuff).

delfick commented 2 years ago

Documentation is not one of my strong suits hahahah (and also the nature of how this project came to be meant the priority is more about doing something for enjoyment).

So essentially the best place becomes the source code or just living in my head :p

There will hopefully come a point next year where I've had the chance to properly recover from a truly horrible two years and I can put more time into photons again and continue to work towards improving these things.

pimw1 commented 2 years ago

Yeah, i fully get it. Making documentation sucks big time haha. And it is hobby project that you are doing in your free time, it should be fun. Your work and help is really appreciated, keep up the good work!

delfick commented 2 years ago

thanks :)

pimw1 commented 2 years ago

By the way, i'm making some dynamic restfull commands in home assistant so i've a more easy time when creating new automations. For example:

rest_command:
  lifx_scene_apply:
  url: 'http://127.0.0.1:6100/v1/lifx/command'
  method: "put"
  payload: |
    {
      "command": "scene_apply",
      "args": {
        "uuid":"{{scene}}",
        "overrides": {
          "duration": {{duration}}
        }
      }
    }

In the automation, i'm using the following: image

Anyhow, i've a question: is there an override attribute for color temperature (ideally in Kelvin)?

pimw1 commented 2 years ago

Aah i found it," kelvin" should work (e.g. value of 3500)

rest_command:
  lifx_scene_apply:
  url: 'http://127.0.0.1:6100/v1/lifx/command'
  method: "put"
  payload: |
    {
      "command": "scene_apply",
      "args": {
        "uuid":"{{scene}}",
        "overrides": {
          "duration": {{duration}},
          "kelvin":{{kelvin}}
        }
      }
    }
delfick commented 2 years ago

noice :)

pimw1 commented 2 years ago

I had quite some stability issues yesterday, despite my rock-solid dedicated 2.4 Ghz network from my Unifi AC Pro. I've quite some devices on my network, so i followed your advice of applying hardcoded discovery in lifx.yml

discovery_options:
  hardcoded_discovery:
    d073d5000001: "192.168.0.1"
    d073d5000002: "192.168.0.2"

And the good news is, it works flawlesly since that moment onwards! Happy days.

delfick commented 2 years ago

yay, the system works!

Also, this means your router is dropping broadcast traffic (routers are annoying and can de-prioritise the lights)

My understanding of why they do that is practically non-existent though hahaha

On Sun, 10 Oct 2021, 7:48 pm pimw1, @.***> wrote:

I had quite some stability issues yesterday, despite my rock-solid dedicated 2.4 Ghz network from my Unifi AC Pro. I've quite some devices on my network, so i followed your advice of applying hardcoded discovery in lifx.yaml

discovery_options: hardcoded_discovery: d073d5000001: "192.168.0.1" d073d5000002: "192.168.0.2"

And the good news is, it works flawlesly since that moment onwards! Happy days.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/70#issuecomment-939432958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5IPKVIJYXKUOXJNSI3UGFHO5ANCNFSM5CFS5GTQ . 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.

pimw1 commented 2 years ago

Yeah i am happy that it works! At the same time, i don't get why Lifx lights are sooo sensitive for these connectivty issues. Literly all my other devices are working 99.9% smoothly, and Lifx only like 90% (which is not enough for a smart bulb). I am glad that Photons Interactor is a good solution for that, well done.

delfick commented 2 years ago

I'm sure being a tiny wifi radio in a heat source doesn't help.

But I'm not a hardware or firmware person, so everything I know is a layer above connectivity problems.

On Sun, 10 Oct 2021, 8:32 pm pimw1, @.***> wrote:

Yeah i am happy that it works! At the same time, i don't get why Lifx lights are sooo sensitive for these connectivty issues. Literly all my other devices are working 99.9% smoothly, and Lifx only like 90% (which is not enough for a smart bulb). I am glad that Photons Interactor is a good solution for that, well done.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/70#issuecomment-939439670, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5JSVNG6FNH3XCUTTBLUGFMT3ANCNFSM5CFS5GTQ . 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.

pimw1 commented 2 years ago

Yeah, and i'm aware this is your hobby project, instead of your official job at Lifx. So i won't continue here about Lifx connectivity capabilities in general, it would not a be appropiate to do. Let's focus on the good stuff of Photons Interactor!

Speaking of which, do you know any solution for this? I've made another RestAPI Service in Home Assistant which is also incorporating the brightness variable. However, when not providing this value, the call won't succeed. In the majority of cases, i don't want to provide an override brightness value because it makes all sections in the bulb matrix equally bright (which is not nice to look at).

Is there a way to provide some kind of a "NA" / null value to Photons Interactor, so that it will leave the brightness of the scene untouched? In this way, i only need one RestAPI service instead of two (one with and one without the brightness variable).

  lifx_scene_apply_brightness:
    url: 'http://127.0.0.1:6100/v1/lifx/command'
    method: "put"
    payload: |
      {
        "command": "scene_apply",
        "args": {
          "uuid":"{{scene}}",
          "overrides": {
            "duration": {{duration}},
            "brightness": {{brightness}}
          }
        }
      }
delfick commented 2 years ago

Yeah, and i'm aware this is your hobby project, instead of your official job at Lifx

Especially since I don't work there anymore since July :p

Is there a way to provide some kind of a "NA" / null value

Sure, I can make that happen. So if you provide null then it is the same as not specifying the override at all. That's a code change, but it should be easy.

pimw1 commented 2 years ago

That would be so cool! Is it possible to do the same for other variables, such as kelvin?

pimw1 commented 2 years ago

By the way, with that stuff in place, we are already getting pretty close to an alpha version of some kind of Home Assistant HACS Integration ;)

delfick commented 2 years ago

That would be so cool! Is it possible to do the same for other variables, such as kelvin?

yeap, all things in overrides. Essentially a

overrides = {overrides but without values that are none}

before the rest of the command

By the way, with that stuff in place, we are already getting pretty close to an alpha version of some kind of Home Assistant HACS Integration ;)

:)

delfick commented 2 years ago

@pimw1 I've released 0.10.1 with that change.

Any value in overrides when you do a scene_apply will be ignored :)

pimw1 commented 2 years ago

Awesome!! i'll check it when i'm back from my holidays.

delfick commented 2 years ago

nice, enjoy your holiday!

pimw1 commented 2 years ago

thanks!