Why is HACS installing an older version of localtuya that the one on github?

EDIT : Ok so I’m just an idiot and didn’t realize / understand that it’s not because I see the changes on the master branch and in the “zip” file you get from the main page that it was actually in the latest release … The latest release - which is what HACS installs - doesn’t have the crucial code change yet, so it’s normal…


Hi everyone.

I was just wondering if someone who knows a little more about HACS and how it downloads / updates / lists versions and code from repos tell me if I am missing something obvious or if there is a bug / problem :

If you install localtuya (a Tuya Integration that allows to control Tuya Devices locally) from HACS, everything seems to be installing fine, but you don’t get the latest version of the code

One easy way to see it is to look at one file in particular :

custom_components/localtuya/pytuya/__init__.py

line 820 : the version installed by HACS :

if self.version in [3.2, 3.3]: # 3.2 behaves like 3.3 with type_0d

but it’s OLD - doesn’t include 3.4 devices … which is why the code has been updated in localtuya on github … in January 2023

if you go look at the current file on github :

https://github.com/rospogrigio/localtuya/blob/87d61eea6f4189bf1dc01614534e1fff84db4a7f/custom_components/localtuya/pytuya/__init__.py

line 820 is currently :

if self.version in [3.2, 3.3, 3.4]: # 3.2 behaves like 3.3 with type_0d

(it was updated more than 18 months ago to include 3.4 devices)

I realized this because this ommission of 3.4 in the list (it’s in the update_dps function that forces the update of values) means localtuya doesn’t work properly with some 3.4 devices.(The values are never updated)

I looked at the code in my custom_components folder, realized the update_dps was missing 3.4, and edited it myself and now eveything works … but then I was curious as to why the code was not updated to include the 3.4 devices, went to github, and realized that … well … it was, and for some reason, HACS installs an older version of localtuya, or, at least, of the pytuya/__init__.py file

I checked if I was installing a different repository on HACS, but no, it’s the same : https://github.com/rospogrigio/localtuya

So the question is : am I missing something ? How is HACS getting the code it installs - does it get it directly from github ? Does someone have to manually package it and chose the wrong pytuya file ?

If I am just not undestanding something, can someone explains ? (I am relatively new to HA and HACS - well, a few months now but still - and I only ever used HACS to install localtuya I think, so … maybe I am missing something ?)

If not, who should I contact ? HACS creators, of localtuya creators on github ?

Thanks

HACS is not, you are looking at unreleased changes…
5.2.1 is the latest release of that repo, which contains;

You might find this fork of local tuya is better as it is kept more up to date.

@ludeeus Ah … ok thank you !

I admit I know next to nothing on how github projects work, and I assumed the code in the “master” branch - the one you get when you go to the project page and download the zip file, was the same one you would get in the latest release.

(I thought anything not “committed” was elsewhere - not in the file you get on the main page)

Thank you !

@reste_narquois Thank you !

I will test it but since it has the critical 3.4 in update_dps I don’t see any reason why it shouldn’t work for me and others in the same situation.

Otherwise it should be possible to download the beta version in HACS too, which might bring you up to the version you need.

@WallyR : Sadly no beta versions to install for the “main” localtuya fork (the rospogrigio one - the one listed in HACS by default) - the latest version you can install is 5.2.1, which is too old and doesn’t contains the 3.4 update fix.

@reste_narquois : I tested this fork, and it works out of the box, as expected. Thank you !! (It seems to be updated regularly - with amost a version per month or every two months).

I have so many devices configured as is, so I won’t make the switch on my “main” HA install, but if / when I need to reinstall, I definitely will use this fork - thanks again !

1 Like