Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove device lookup by name or number #1636

@farmio

Description

@farmio

def __getitem__(self, key: str | int) -> Device:

await xknx.devices["TestOutlet"].set_on()
would only work as long as devices name attributes are unique - which we don't check anywhere.
Lookup by number doesn't have any real use imho.

I think it would be ok to remove this functionality in the future as it is safer for an application using it to just keep a reference to the object.
If anyone has objections, please let us know.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions