-
Notifications
You must be signed in to change notification settings - Fork 55
[bug] Duplicated functions decorated with @service are not exposed as such #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There may be something @craigbarratt can do about this, but, in general, this is just how Python works.
|
Yes, I completely understand that part - this is why I mentioned that the two defs are correct Python code. I just thought that in the context of automations this is probably a mistake, and especially the fact that I will close the issue, that could be useful if someone finds it when searching fr a similar problem. |
While redefining a function is normal (as discussed), it is a bug that the 2nd definition isn't exposed as a service. So re-opening until that bug is fixed. |
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:
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.
The text was updated successfully, but these errors were encountered: