Request for integration with Tuya

Hello @pierre-gilles,

I think I’m ready for a review of this PR that updates the Tuya integration by preparing the groundwork for the new connection and local detection:

Once this one is validated, I will update the following PR which adds protocol 3.5 necessary for new devices. A big advantage compared to HA is that this will be part of Gladys itself, whereas for HA you have to go through an external HACS integration. Additionally, we were able to integrate the creation of a GitHub issue that provides all the info to add devices/features not supported in Gladys:

And finally another one will come with the setup of the base mapping for cloud vs local devices. I took the Smart Sockets to work on this base which will make it easier to add future devices/features:

Thanks in advance.

EDIT: After a full recheck, I saw that the PR should have been split into more elements. So I preferred to put it on standby. I just reopened it. @pierre-gilles it is ready for review. I’m referring to this one:

Once the previous one is validated, I will update the following PRs :

  • Addition of protocol 3.5 required for recent devices. Big advantage compared to Home Assistant (HA): this will be an integral part of Gladys, whereas for Home Assistant you have to go through an external HACS integration:
  • Implementation of the base mapping of cloud vs local devices. I used the Smart Sockets to work on this base which will make it easier to add future devices/features:

They are also ready and are just waiting for the first one ^^

Then I separated a PR for integrating the automatic creation of GitHub issues.

Thanks a lot for the PRs, I’ll let you know once I’ve had a chance to look!

@Papashultz and @GBoulvin, I just restarted a build on the same test image, I would be very interested in your new test and your feedback.

For info @GBoulvin I added support for these issues:

I think and hope that the last one also handles @Papashultz’s pilot wire

And for info, here’s what the Issues look like now:

New issue addressed in PR:

  • Device :

  • Dashboard

  • Horizontal sweep :

  • Vertical sweep :

  • Mode :

  • Fan speed :

Hello!

Thanks for this update!

For my part, the “Smart meter” is still shown as “not supported”:

For the LSC sockets, one of the two (protocol 3.5) is functional and listed as supported:

However, the second (protocol 3.4) returns an error for me (both locally and in the cloud).

I created a GitHub issue using the button and here’s the result (looks pro!):

If I can help, don’t hesitate to ask!

Hello @GBoulvin,

Thanks for your tests

What a disappointment … I was hoping this one would match on the first try ^^

Re-test with the image of the day !

For the Smart Meter, the commas are missing :

But all features appear correctly :

However, the devices disappeared from the dashboard after updating locally (it was resolved, wasn’t it?)

Hi @GBoulvin

Sorry for the delay, it was a test… unfortunately inconclusive!! Well, there was mainly an omission. The image has been updated and is being built => 5 to 20 minutes.

Yes, in that case it can be normal, I changed things in the feature so it probably broke the old device (no automatic migration). Since we’re in dev, I don’t do a migration that would break the old device being modified ^^

Yes, that’s intentional for now. The local UDP scan is longer and depends on the local network, so I preferred to keep it as a manual action so as not to slow down cloud discovery.

That’s consistent with how local UDP works: depending on the network (AP isolation, VLAN, broadcast/multicast filtering, device that broadcasts little), the IP may not surface automatically.
In these cases, manual entry remains necessary. Wouldn’t this be a device on a different network or one that would take longer to respond in your opinion?

Hello @Papashultz and @GBoulvin,

By the way, @pierre-gilles has started reviewing the first PR on Tuya. Would you be able to test the first PR once it is validated on the code side, starting from a copy of your production base to ensure that nothing breaks on the equipment in operation?

I was able to test on my side with 2 outlets (the only supported devices on the current version for me), but it doesn’t go very far.

Other calls for contributors if you have the possibility to test as a Tuya device owner:

The test image will be available under docker pull terdious/gladys:tuya-PR1

Good evening @Terdious
I’m coming in after the fight, but I’ve tested your image. Here’s what I tested for devices:

. All work, there’s only one that doesn’t work completely, it’s the color bulb. You can already see on the dashboard that the colors are dark,
. This is because the lamp is not well recognized, functions such as white mode, color mode, scenario mode are missing, which are in the Tuya app. But the problem was already present before you took over the project. I hope this can help you, thanks for your work. Good evening

Hello @Psoy!!

Thank you so much!! You are doing great after the fight, quite the opposite!!

Great reassuring return!!

If you want to test more, you can test docker pull terdious/gladys:tuya-test right now, it should allow you to create a GitHub issue so that I can add complete recognition of devices that are missing things. If they are present in the issue, I can work on them from time to time when I have some free time ^^

Hello @Terdious
I tested with this image docker pull terdious/gladys:tuya-PR1
I will install docker pull terdious/gladys:tuya-test, but for the GitHub issue, I will come back to you, because I don’t master it yet :wink:

It will be done automatically, you’ll see! And I’m actually interested in having your feedback on understanding the little thread to follow ^^ :wink:

The goal during this development was to continue what has been done on a few other integrations but with even more guidance!! And without creating duplicate requests

Thanks for your feedback @Psoy!

If someone else could test the image, that would be great! After that, I’m good to go to deploy this first PR.

Thanks @Terdious for the development :raising_hands:

I’m afraid not, it will be difficult to move forward unfortunately.

For my part, I did have a real need. I motivated myself and even though it was much more complicated for the air conditioning than what I had imagined here, it is entirely installed in HA. And it works very well. It cost me to have to recreate all my pro scenes in HA, but it has the merit of working (and saving me money for two weeks).

Having been in a fast-paced period at work for two weeks, and now entering the outdoor period (work / maintenance), I preferred to warn here that I would not have much availability, as every year, until October.

For my part, I will no longer have an urgent need for this integration, I will try to follow if there is an evolution and if I find some availability at that time I will do what is needed for those who need it.

The automatic activity control on the GitHub PR will do the job to close otherwise.

See you soon! And have a good spring/summer everyone.

Thanks for your feedback and involvement @Terdious :slightly_smiling_face:

I think the good days are back and activity is naturally slowing down, you’re not the only one being busier these days :grinning_face_with_smiling_eyes:

I see it on social media too, I have fewer views than at the beginning of the year!

I hope we’ll have more testers :crossed_fingers:

Hello everyone, @pierre-gilles,

For your information, the 2nd PR for adding support for protocol 3.5 is ready for review on my side:

I just started updating the previous test docker image docker pull terdious/gladys:tuya-PR1 (I shouldn’t have named it that ^^)

If anyone is available to test again, that would be great (sorry, I’m going to spam the people I know are interested here, don’t hesitate to tell me if you no longer want to be mentioned).
@Psoy, @GBoulvin, @Papashultz, if you have the opportunity, thank you in advance.

EDIT:
No issues on my side launching PR2 above master after adding a Tuya device in protocol 3.3. But I don’t have a protocol 3.5 device to test (I have a thermostat but it will only be supported in PR6 or 7). If @GBoulvin you could test this image, I think you have one, even if not all features are supported.

Hello!

Protocol 3.5 works fine! However, I can’t get version 3.4 to work. It used to work, I think… The error message is: « Local read failure: Local poll timeout. »

I tested it from a clean image.

Edit: After re-reading previous messages, it seems it wasn’t working after all…

Thanks @GBoulvin for your test.

Indeed, from what I can see (and thanks to the new analysis by Claude Opus 4.7), protocol 3.4 is not implemented. I won’t have enough time to work on it quickly, but I will of course continue the work in this direction.