Skip to content

reload() method on devices not really a method? #103

@nestorix1343

Description

@nestorix1343

The devices classes (light, outlet, and so on) have a reload() method defined.

The fact that this is a method for a class object and the name "reload" suggests (at least that is what I think) to reload the instance to the current setting/status of the Dirigera hub.

However, the reload() method just returns a new class instance which is not logical in my point of view.

So if you have a variable containing a Light class, for instance:

some_light: Light = hub.get_light_by_id("some-id")
print(some_light.light_level)  # prints for instance 12
some_light.set_light_level(34)
some_light.reload()
print(some_light.light_level)  # prints still 12, expected 34 

One would expect that after the reload, some_light has its light level set to 34. This is not the case. This only works if you do:

some_light = some_light.reload()

However, that does not really look how classes and instances of classes should work.

Or am I completely wrong?

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