Skip to content

[bug] Duplicated functions decorated with @service are not exposed as such #121

Closed
@wsw70

Description

@wsw70

I was debugging a time-based automation today that was not working and decided to expose it as a service. There was no way for me to make it seen in the HA dev tools.

I then realized that my code was similar to:

@service
def hello(**data):
    log.info("hello 1")

@service
def hello(**data):
    log.info("hello 2")

Specifically: I mistakenly called two functions the same.

There was no message in the HA logs about this. While it is conceivable that two functions are called the same (this is correct Python code and the second function wins) it is probably a mistake.

The fact that the service is not exposed is more "bug-like" and I guess that maybe some warning should be issued.

This is really low priority and I do not actually know whether this even qualifies as a bug, I just wanted to mention that in case it is by design and not documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions