delfick / photons

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

feat: add matrix and linear options to effects/stop #65

Closed Djelibeybi closed 3 years ago

Djelibeybi commented 3 years ago

This exposes the power_on argument so that users can stop effects when the devices are soft off.

This resolves issue #64 (or at least the initial request) which is to prevent a device from powering on.

Signed-off-by: Avi Miller me@dje.li

delfick commented 3 years ago

I kinda want tests. https://github.com/delfick/photons/blob/main/apps/interactor/tests/commander/commands/test_effects.py

Annoyingly I thought I had tests for options but it seems I don't for effects/start either.

(I'd add calls to a GetPower command before and after with and without power_on option).

Also, commit message is good, but can the first sentence be [interactor] matrix and linear options for effects/stop please? :)

Djelibeybi commented 3 years ago

Yep, let me throw in some tests.

Djelibeybi commented 3 years ago

I'd add calls to a GetPower command before and after with and without power_on option

I'm not sure I understand what you mean by this?

delfick commented 3 years ago

I meant the interactor command for sending messages.

But easier would be something like

device = fake.for_serial("d073d5000001")

# for testing off
assert device.attrs.power == 0

# for testing on
assert device.attrs.power == 65535
Djelibeybi commented 3 years ago

Gotcha. Ok, let me simplify this. :)

Djelibeybi commented 3 years ago

I added three tests. Let me know if this is enough, not enough, etc.

Djelibeybi commented 3 years ago

Aside: VSCode's auto-linter hates the test_<blah>.py files. It's just red wavy lines as far as the eye can see.

delfick commented 3 years ago

Nice!

Are you able to add test that shows the power goes stays off if power_on is false please?

Aside: VSCode's auto-linter hates the test_.py files. It's just red wavy lines as far as the eye can see.

lol It's very standard naming scheme and it's how pytest discovers tests

Djelibeybi commented 3 years ago

Are you able to add test that shows the power goes stays off if power_on is false please?

Sure. Done. :)

delfick commented 3 years ago

Perfect. Thanks.