Skip to content

Add defaults to the YeelightBulb class. #1

@skorokithakis

Description

@skorokithakis

It would be nice if the defaults could be overridden when instantiating YeelightBulb. For example:

pyyeelight.YeelightBulb(ip="192.168.0.1", effect=effect=EFFECT_SMOOTH, transition_time=300)

Then, all subsequent commands would use these defaults.

This can be achieved easily with two properties:

YeelightBulb.effect = EFFECT_SUDDEN
YeelightBulb.transition_time = MIN_TRANSITION_TIME

Then, each command would have something like:

def set_hsv_color(self, hue, saturation, effect=None, transition_time=None):
    # Code...
    schema({'hue': hue, 'saturation': saturation, 'effect': effect or self.effect, 'transition_time': transition_time or self.transition_time})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions