Local Tuya - Control Tuya devices locally (Fork from localtuya)

A related question regarding a device’s id and vs Localkey - do they or can they change? I’m asking as I removed a mostly working device from LocalTuya & am trying to add it again with corrected parameters but it’s failing to configure, though it s finding device. I’d recorded all the details I used previously inc Localkey but now when I re-add this device I see localTuya discovering a different key to the one I’d saved earlier. Neither work. Not sure that’s the issue but asking so I know. Thanks

They do change, every time you re-add a device to the app.

Hey @umu_ugg , just a Q , why did you fork it and not working together with the make-all edition?

Also, I’m still using the rosporgio edition, but indeed no updates anymore, is there an easy way to upgrade to your version? Or do I need to start from scratch and add each device again?

Thanks - understood
Cheers

:point_down:

This question is answered in above Posts (somewhere in first 1/3 of the Topic)

i got a bth01 thermometer to test, it’s bluetooth…

i don’t understand if i have to add the tuya gateway to localtuya or not.

if so (i need to buy it), will it work anyway if internet goes down?!

thanks

How do you use the bth01 now, through Tuya APP ( Without tuya-gateway ? )
If So, you don’t need the gateway

yes, i used the app for the first configuration of the thermometer… then i had the app closed, values weren’t updating; so a gateway is required
thanks

hmmm, how did you know/see the values weren’t updating, if you had the App closed ?

i mean on ha… btw, even with the app open i see no changes, localtuya doesn’t configure the device…
am i missing something?! is the gateway mandatory?!
thanks

Does your device work without a hub, in your phone APP ? TUYA Phone APP !

Thanks for a great fork, and the works that is going into it.

I had some water timers, working through gateways that just refused to work with the original repository, but because I am travelling at the moment, I spun up a test HA, and loaded your repo, and voila - amazing.

However, I am running into a different issue, and after quite a few days at this, I decided it is prudent to now ask for help.

I have some battery operated PIT sensors, and for the life of me, I cannot get the battery percentage to show on 5 of them. The one difference I picked up is that the one that “did” work, had a model of “CC-S2000”, and the others “Smart WiFi Motion Sensor Recharge”. This is literally the only difference.

I did some research, and from what I could find, it seems the model is captured in config/.storage/core.config_entries. I navigated there, made a backup copy of the file, and changed the model number of one of the ones that says battery state is unknown, to CC-S2000. I did a reboot, and even though it now says it is a CC-S2000, the battery percentage is not working.

The strange thing though that I saw while carefully editing the core.config_entries file, is that there are actually values recorded in this file for the actual battery percentages.

I looked at the file again, and compared the values to Smart Life for each of the devices, and they were correct.

So, the core.config_entries do have values for the batteries (accurate ones), but these values are not being displayed when I am checking the entities / device(s) in Local Tuya.

So, now I am unsure how to troubleshoot further and would love some ideas from thie great community.

Herewith some details from one of the devices as lsited in core.config_entries

              "bfc125793f2121xxxxxxxx": {                                                                  
              "friendly_name": "Garage Connex Motion Sensor 3 LT",                                       
              "host": "192.168.250.154",                                                                 
              "local_key": "GGaE3~2qxxxxxxxx",                                           
              "protocol_version": "3.3",                                                                 
              "enable_debug": false,                                                                     
              "device_sleep_time": 1800,                                                                 
              "entities": [                                                              
                {                                                                                        
                  "friendly_name": "Garage Motion Detection LT",                                         
                  "entity_category": "None",                                                             
                  "state_on": "pir",                                                     
                  "device_class": "motion",                                                              
                  "id": "1",                                                                             
                  "platform": "binary_sensor",                                                           
                  "icon": ""                                                             
                },                                                                                       
                {                                                                                        
                  "friendly_name": "Garage PIR Battery LT",                              
                  "entity_category": "diagnostic",                                                       
                  "unit_of_measurement": "%",                                                            
                  "device_class": "battery",                                                             
                  "state_class": "measurement",                                                          
                  "scaling": 1.0,                                                                        
                  "id": "4",                                                                             
                  "platform": "sensor",                                                                  
                  "icon": ""                                                                             
                }                                                                        
              ],                                                                                         
              "scan_interval": 5,                                                        
              "reset_dpids": "1,4",                                                                      
              "manual_dps_strings": "1,4",                                               
              "model": "Smart WiFi Motion Sensor Recharge ",                                             
              "product_key": "key3a8nxxxxxxxx",                                                         
              "device_id": "bfc125793f2121xxxxxxxx",                                                     
              "node_id": null,                                                           
              "dps_strings": [                                                                           
                "1 ( code: pir_state , value: pir )",                                                     
                "4 ( code: battery_percentage , value: 47 )"                                             
              ]                                                                                          
            },                     
  1. The model of device aren’t not used on localtuya control process at all it just an extra info.
  2. The data on core.config_entries are cached from the time you added the device so it won’t change ever because when you added the device it was “47” percentage,

I’m not sure what is exactly your issue, so basically the “Battery LT” doesn’t show the state of the battery and shows “unknown”? You can specify “device sleep time” and “scan interval” also you can’t set device_sleep_time and scan_interval if your device is low-power device remove set 0 in scan_interval and add 0 in manual_dps.

If you want to check that your device is low-power device or not set 0 in device sleep time and wait if it disconnect every some seconds then it it if not then you don’t need device sleep time here.