-
Notifications
You must be signed in to change notification settings - Fork 561
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
Add support for unique_id and available #2
Add support for unique_id and available #2
Conversation
Disclaimer: I only have switches so only that platform is tested. |
Mmm... tried to install your modifications and localtuya won't even start, none of my devices is available and I don't get any log messages... |
That's strange. Do you mean that the entities themselves aren't created or are they created but just not usable in the UI? |
Did they get different entity ids? |
Sorry, my fault (created a wrong symlink for testing). I managed to run your code but I don't like the approach of exporting the unique_id and having them edited via the UI, because they are the same used by the official tuya integration, and my localtuya was thought to be used also in combination with the tuya integration, if anyone needs it (or also for debug purposes). |
Ok, great! I understand your concern regarding that. We could just prefix the |
Nice idea. Would rather limit to |
Sure! I can update and push it now. |
Avoid collisions with the tuya integration.
Should be ok now! |
Mmm, not working as expected... all my devices have been duplicated with "_2" as postfix; plus, we need to handle correctly the subswitches, since I get these errors: |
Ok, so, I believe it works as expected but maybe not the way you want. A config entry (I.e. one Since the same physical device now is represented by two config entries, you will get two different entity ids since they are unique. You kinda worked around that by setting the entity id manually, something that isn't allowed anymore. Doing so did however bypass the entity Id generation (as long as only one integration is enabled at the time). It is however not meant to be used like that and thus not allowed. I can't force you into changing behavior but I would strongly advice you to. The sub switches is something I will have to look in to. I guess they are for double gang switches for instances? I have one of those, not plugged in yet though. |
Yes, I get that error for a double gang switch, and for a plug that provides both a plug and a USB outlet, and that are seen as two devices. |
By the way, appending the |
OK, i appended the |
Awesome, thanks! 👍 |
Update sensor.py: Long term statistics
This adds support for
unique_id
andavailable
. Benefits are:unavailable
if an update fails, e.g. due to network problems, which makes it easier to spot if a device is not working