Error while reading Luxmeter

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Error while reading Luxmeter

Post by athoopen »

All,

I could do with some help ;) I just added aTuya wifi Luxmeter. On the UI every thing is working as expected. However if I read the settings from dzVents I get an error on reading the data. The script is simple:

Code: Select all

return 
{
    on =
    {
        -- devices = { 'Luxmeter' }
	timer = { "at 13:13", } --TESTING ONLY
    },

    logging = 
    {
        level = domoticz.LOG_INFO, 
        marker = 'LuxTEST'
    },

    execute = function(domoticz, item)

        local luxmeter = domoticz.devices(3827) -- idx Luxmeter = 3827
        
        domoticz.log('Devicename: ' .. luxmeter.name, domoticz.LOG_INFO )
        domoticz.log('Data: ' .. luxmeter.data , domoticz.LOG_INFO )
    end
}
But the log reads:

Code: Select all

feb 15 13:13:00 domoticz domoticz[19193]: dzVents: LuxTEST: Devicename: Luxmeter
feb 15 13:13:00 domoticz domoticz[19193]: dzVents: LuxTEST: An error occurred when calling event handler LuxTEST
feb 15 13:13:00 domoticz domoticz[19193]: dzVents: LuxTEST: ...i/domoticz/scripts/dzVents/generated_scripts/LuxTEST.lua:20: attempt to concatenate a nil value (field 'data')
It's not the 13:13 :lol: :lol: :lol:
If I read the values via https://domoticz/json.htm?type=devices&rid=3827 I get:

Code: Select all

ActTime:	1739621604
AstrTwilightEnd:	"19:46"
AstrTwilightStart:	"06:00"
 ...
 ...
app_version:	"2024.7"
result:	
  0:	
    AddjMulti:	1
     ...
     ...
    CustomImage:	0
    Data:	"1000 Lux"
    Description:	""
    Favorite:	1
     ...
     ...
    LastUpdate:	"2025-02-15 09:40:11"
    Name:	"Luxmeter"
    Notifications:	"false"
      ...
      ...
It reads the name, but not the data...
I also tried to read other data like HardwareID but got the same error: ...(attempt to concatenate a nil value (field 'hardwareid')
I must be doing something wrong. Any tips and trics to get me going?
Cheers,
Arjan
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by Xenomes »

Did you try to change luxmeter.data to luxmeter.state?

Code: Select all

domoticz.log('Lux Value: ' .. tostring(luxmeter.state), domoticz.LOG_INFO)
or the sValue

Code: Select all

domoticz.log('sValue: ' .. luxmeter.sValue, domoticz.LOG_INFO)
Use the events information:
2025-02-15 15_20_58-Domoticz — Mozilla Firefox.png
2025-02-15 15_20_58-Domoticz — Mozilla Firefox.png (9.76 KiB) Viewed 1049 times
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by athoopen »

Looking at the events information, there was a change at 16:06 (I put it in darkness) : Status is empty, Waarde 0/3 (I think nValue 0 and sValue 3)
If I use https://domoticz/json.htm?type=devices&rid=3827 then it also shows "3 Lux". My scirpt

Code: Select all

return 
{
    on =
    {
        -- devices = { 'Luxmeter' }
		timer = { "at 16:27", } --TESTING ONLY
    },

    logging = 
    {
        level = domoticz.LOG_INFO, 
        marker = 'LuxTEST'
    },

    execute = function(domoticz, item)

        local luxmeter = domoticz.devices(3827) -- idx Luxmeter = 3827
        
        domoticz.log('Devicename: ' .. luxmeter.name, domoticz.LOG_INFO )
        domoticz.log('sValue: ' .. luxmeter.sValue , domoticz.LOG_INFO )
        domoticz.log('nValue: ' .. luxmeter.nValue , domoticz.LOG_INFO )
        domoticz.log('state: ' .. luxmeter.state , domoticz.LOG_INFO )
    end
}
shows

Code: Select all

feb 15 16:27:00 domoticz domoticz[6887]: dzVents: LuxTEST: Devicename: Luxmeter
feb 15 16:27:00 domoticz domoticz[6887]: dzVents: LuxTEST: sValue:
feb 15 16:27:00 domoticz domoticz[6887]: dzVents: LuxTEST: nValue: 1
feb 15 16:27:00 domoticz domoticz[6887]: dzVents: LuxTEST: state:
Cheers,
Arjan
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by athoopen »

Something strange is going on ....

The Luxmeter became red in the UI. I restarted domoticz (sudo systemctl restart domoticz),I turned to my syslog on linux level and saw:

Code: Select all

feb 15 16:43:13 domoticz domoticz[12414]: Tuya: (tinytuya) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-TinyTUYA-Plugin/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
feb 15 16:43:13 domoticz domoticz[12414]: Tuya: Traceback (most recent call last):
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:   File "/home/pi/domoticz/plugins/Domoticz-TinyTUYA-Plugin/plugin.py", line 77, in <module>
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:     import tinytuya
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:   File "/usr/local/lib/python3.9/dist-packages/tinytuya/__init__.py", line 92, in <module>
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:     from .core import *
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:   File "/usr/local/lib/python3.9/dist-packages/tinytuya/core/__init__.py", line 5, in <module>
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:     from .crypto_helper import *
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:   File "/usr/local/lib/python3.9/dist-packages/tinytuya/core/crypto_helper.py", line 39, in <module>
feb 15 16:43:13 domoticz domoticz[12414]: Tuya:     raise ModuleNotFoundError('No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes')
feb 15 16:43:13 domoticz domoticz[12414]: Tuya: ModuleNotFoundError: No crypto library found, please "pip install" cryptography, pycryptodome, or pyaes
There are also a lot of messages like:

Code: Select all

feb 15 16:45:04 domoticz domoticz[12414]: Tuya hardware (39) thread seems to have ended unexpectedly
I used the listed pip command to install the 3 modules, and restarted domoticz, but there was no change. Although the luxmeter did have a new value.
Just to be on the save side, I rebooted my pi.
Messages "Tuya hardware (39) thread seems to have ended unexpectedly" are still there. Logfile /var/log/messages do not show any complains about cryto

Ran my script again ... no change in output
Cheers,
Arjan
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by Xenomes »

athoopen wrote: Saturday 15 February 2025 16:57 I used the listed pip command to install the 3 modules, and restarted domoticz, but there was no change.
I think your Domoticz is running under the root account. So you need to use the sudo command when installing pip3 modules.

For your reading problem try the tostring for the logging.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by athoopen »

@xenomes you were right. After using sudo, I now have a clean log with much info/status info from Tuya (looking really nice!)
Updated the script a little bit with tostring():

Code: Select all

return 
{
    on =
    {
        -- devices = { 'Luxmeter' }
		timer = { "at 17:34", } --TESTING ONLY
    },
    logging = 
    {
        level = domoticz.LOG_INFO, 
        marker = 'LuxTEST'
    },
    execute = function(domoticz, item)
        local luxmeter = domoticz.devices(3827) -- idx Luxmeter = 3827
        
        domoticz.log('Devicename: ' .. luxmeter.name, domoticz.LOG_INFO )
        domoticz.log('sValue: ' .. luxmeter.sValue , domoticz.LOG_INFO )
        domoticz.log('tostring sValue: ' .. tostring(luxmeter.sValue) , domoticz.LOG_INFO )
        domoticz.log('nValue: ' .. luxmeter.nValue , domoticz.LOG_INFO )
        domoticz.log('state: ' .. luxmeter.state , domoticz.LOG_INFO )
    end
}
Output is now:

Code: Select all

feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: Devicename: Luxmeter
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: sValue:
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: tostring sValue:
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: nValue: 1
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: state:
Device status stated:

Code: Select all

3867	2025-02-16 17:31:30	Luxmeter		1/454.0
3827	2025-02-16 17:31:40	Luxmeter		1/454.0
This one triggered me, it shows that I have two Luxmeters. I only have one. I ran the script again with the other idx, but the output is the same.
After this I removed both from Domoticz. Waited until the "hardware" added the luxmeter again, watching the log (really nice!!!) :

Code: Select all

feb 16 17:46:39 domoticz domoticz[8321]: Tuya: Device name=Luxmeter id=bf8229507a9b71c4adakv3 category=lightsensor
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 StatusProperties= [{'code': 'bright_state', 'name': '亮度检测状态', 'type': 'Enum', 'values': '{"range":["low","middle","high"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"unit":"LUX","min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'find_me', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 result= [{'code': 'bright_state', 'value': 'high'}, {'code': 'bright_value', 'value': 184}, {'code': 'find_me', 'value': False}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device: bf8229507a9b71c4adakv3 Unit: 1 doesn't exsist. Nothing to update
Found that I forgot to delete the two lux meter switches (although I thought that it didn't influence anything, but you never know .. it's software :D ). Deleted them (now I have no "*lux*" devices which are listed). Waiting for a moment and looking at the log. Output was more or less the same, it also reported :

Code: Select all

feb 16 18:01:52 domoticz domoticz[8321]: Tuya: Device: bf8229507a9b71c4adakv3 Unit: 1 doesn't exsist. Nothing to update
Oke .. Unpowered the luxmeter, went to my Tuya App and removed (remove and clear data) it there. Powered up again and added to the Tuya App.
Successful added (Virtual ID ends with bggll). Back to the log of domoticz:

Code: Select all

feb 16 18:17:02 domoticz domoticz[8321]: Tuya: handleThread: 1 line 2545
feb 16 18:17:02 domoticz domoticz[8321]: Tuya: Device name=Luxmeter id=bf8229507a9b71c4adakv3 category=lightsensor
feb 16 18:17:02 domoticz domoticz[8321]: Tuya: handleThread: Credentials are incorrect or tuya subscription has expired! line 981
I don't know if the lasts line is related to the light sensor.... Nevertheless I will first have dinner :D , who knows it's then added ...
Nope .. maybe a restart of domoticz might help ... YES!
Looking at the log:

Code: Select all

feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name=LightSensor id=bff27908b7c1fb3e1bggll category=lightsensor
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll StatusProperties= [{'code': 'bright_state', 'name': '亮度检测状态', 'type': 'Enum', 'values': '{"range":["low","middle","high"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"unit":"LUX","min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'find_me', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll result= [{'code': 'bright_state', 'value': 'middle'}, {'code': 'bright_value', 'value': 67}, {'code': 'find_me', 'value': False}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Run Startup script
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Create device light sensor
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: (Tuya) Creating Unit 'LightSensor'.
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Update devices in Domoticz
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Update device value: bff27908b7c1fb3e1bggll Unit: 1 sValue: 67.0 nValue: 1 TimedOut=0
But I now have still two Luxmeters .... One with idx 3874, and one with 3875 :?: Let's run the script for both, first 3874

Code: Select all

feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: Devicename: LightSensor
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: sValue:
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: tostring sValue:
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: nValue: 1
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: state:
and then 3875

Code: Select all

feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: Devicename: LightSensor
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: sValue:
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: tostring sValue:
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: nValue: 1
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: state:
How to continue?
Cheers,
Arjan
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by Xenomes »

athoopen wrote: Sunday 16 February 2025 20:00 @xenomes you were right. After using sudo, I now have a clean log with much info/status info from Tuya (looking really nice!)
Updated the script a little bit with tostring():

Code: Select all

return 
{
    on =
    {
        -- devices = { 'Luxmeter' }
		timer = { "at 17:34", } --TESTING ONLY
    },
    logging = 
    {
        level = domoticz.LOG_INFO, 
        marker = 'LuxTEST'
    },
    execute = function(domoticz, item)
        local luxmeter = domoticz.devices(3827) -- idx Luxmeter = 3827
        
        domoticz.log('Devicename: ' .. luxmeter.name, domoticz.LOG_INFO )
        domoticz.log('sValue: ' .. luxmeter.sValue , domoticz.LOG_INFO )
        domoticz.log('tostring sValue: ' .. tostring(luxmeter.sValue) , domoticz.LOG_INFO )
        domoticz.log('nValue: ' .. luxmeter.nValue , domoticz.LOG_INFO )
        domoticz.log('state: ' .. luxmeter.state , domoticz.LOG_INFO )
    end
}
Output is now:

Code: Select all

feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: Devicename: Luxmeter
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: sValue:
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: tostring sValue:
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: nValue: 1
feb 16 17:34:00 domoticz domoticz[8321]: dzVents: LuxTEST: state:
Device status stated:

Code: Select all

3867	2025-02-16 17:31:30	Luxmeter		1/454.0
3827	2025-02-16 17:31:40	Luxmeter		1/454.0
Tip change it to

Code: Select all

timer = { "every minute"}
athoopen wrote: Sunday 16 February 2025 20:00 This one triggered me, it shows that I have two Luxmeters. I only have one. I ran the script again with the other idx, but the output is the same.
After this I removed both from Domoticz. Waited until the "hardware" added the luxmeter again, watching the log (really nice!!!) :

Code: Select all

feb 16 17:46:39 domoticz domoticz[8321]: Tuya: Device name=Luxmeter id=bf8229507a9b71c4adakv3 category=lightsensor
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 StatusProperties= [{'code': 'bright_state', 'name': '亮度检测状态', 'type': 'Enum', 'values': '{"range":["low","middle","high"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"unit":"LUX","min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'find_me', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device name= Luxmeter id= bf8229507a9b71c4adakv3 result= [{'code': 'bright_state', 'value': 'high'}, {'code': 'bright_value', 'value': 184}, {'code': 'find_me', 'value': False}]
feb 16 17:46:40 domoticz domoticz[8321]: Tuya: Device: bf8229507a9b71c4adakv3 Unit: 1 doesn't exsist. Nothing to update
Found that I forgot to delete the two lux meter switches (although I thought that it didn't influence anything, but you never know .. it's software :D ). Deleted them (now I have no "*lux*" devices which are listed). Waiting for a moment and looking at the log. Output was more or less the same, it also reported :

Code: Select all

feb 16 18:01:52 domoticz domoticz[8321]: Tuya: Device: bf8229507a9b71c4adakv3 Unit: 1 doesn't exsist. Nothing to update
Oke .. Unpowered the luxmeter, went to my Tuya App and removed (remove and clear data) it there. Powered up again and added to the Tuya App.
Successful added (Virtual ID ends with bggll). Back to the log of domoticz:

Code: Select all

feb 16 18:17:02 domoticz domoticz[8321]: Tuya: handleThread: 1 line 2545
feb 16 18:17:02 domoticz domoticz[8321]: Tuya: Device name=Luxmeter id=bf8229507a9b71c4adakv3 category=lightsensor
feb 16 18:17:02 domoticz domoticz[8321]: Tuya: handleThread: Credentials are incorrect or tuya subscription has expired! line 981
I don't know if the lasts line is related to the light sensor.... Nevertheless I will first have dinner :D , who knows it's then added ...
Nope .. maybe a restart of domoticz might help ... YES!
Looking at the log:

Code: Select all

feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name=LightSensor id=bff27908b7c1fb3e1bggll category=lightsensor
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll StatusProperties= [{'code': 'bright_state', 'name': '亮度检测状态', 'type': 'Enum', 'values': '{"range":["low","middle","high"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"unit":"LUX","min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'find_me', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll result= [{'code': 'bright_state', 'value': 'middle'}, {'code': 'bright_value', 'value': 67}, {'code': 'find_me', 'value': False}]
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Run Startup script
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Create device light sensor
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: (Tuya) Creating Unit 'LightSensor'.
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Update devices in Domoticz
feb 16 19:50:55 domoticz domoticz[12803]: Tuya: Update device value: bff27908b7c1fb3e1bggll Unit: 1 sValue: 67.0 nValue: 1 TimedOut=0
But I now have still two Luxmeters .... One with idx 3874, and one with 3875 :?: Let's run the script for both, first 3874

Code: Select all

feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: Devicename: LightSensor
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: sValue:
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: tostring sValue:
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: nValue: 1
feb 16 19:56:00 domoticz domoticz[12803]: dzVents: LuxTEST: state:
and then 3875

Code: Select all

feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: Devicename: LightSensor
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: sValue:
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: tostring sValue:
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: nValue: 1
feb 16 19:57:00 domoticz domoticz[12803]: dzVents: LuxTEST: state:
How to continue?
Okay that is strange, Are you sure you don't have the plugin installed two times?
I did a test with a lux meter i got this:

Code: Select all

2025-02-16 21:47:00.103  dzVents: LuxTEST: Devicename: Motion Sensor (Lux)
2025-02-16 21:47:00.103  dzVents: LuxTEST: sValue: 100
2025-02-16 21:47:00.103  dzVents: LuxTEST: tostring sValue: 100
2025-02-16 21:47:00.103  dzVents: LuxTEST: nValue: 0
2025-02-16 21:47:00.104  dzVents: LuxTEST: state: 100
I see the problem! category=lightsensor i did a merge of the sensor's but didn't do lightsensor, i will update the plugin.

Edit:
New version pushed, pull the new version and remove the old lux device then reboot Domoticz an new lux device is installed and is working with your script.
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by athoopen »

Removed lightsensors from domoticz, git pull, domoticz restart.

The log (with respect to the lightsensors) show:

Code: Select all

feb 17 19:52:43 domoticz domoticz[15783]: Tuya: Device name=LightSensor id=bff27908b7c1fb3e1bggll category=sensor
feb 17 19:52:44 domoticz domoticz[15783]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 17 19:52:44 domoticz domoticz[15783]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll StatusProperties...
feb 17 19:52:44 domoticz domoticz[15783]: Tuya: Device name= LightSensor id= bff27908b7c1fb3e1bggll result= [{'code': ...
feb 17 19:52:44 domoticz domoticz[15783]: Tuya: (Tuya) Creating Unit 'LightSensor (Lux)'.
Still two "LightSensor (Lux)" .. Now the script for idx 3881:

Code: Select all

feb 17 20:02:00 domoticz domoticz[15783]: dzVents: LuxTEST: There is no device with that name or id: 3881
feb 17 20:02:00 domoticz domoticz[15783]: dzVents: LuxTEST: An error occurred when calling event handler LuxTEST
feb 17 20:02:00 domoticz domoticz[15783]: dzVents: LuxTEST: ...i/domoticz/scripts/dzVents/generated_scripts/LuxTEST.lua:19: attempt to index a nil value (local 'luxmeter')
and for 3882 it's the same.

Removed both from domoticz and removed lightsensor from tuya app. Then restarted domoticz.
No Lightsensors more in Domticz. Added lightsensor back into tuya app (virtual id ends with j3je). And waited to have domoticz picked it up, it didn't pick it up. Gave it another round .... nope.

To give you as much as possible loginfo, I restarted domoticz and captured all tuya info and funny enough the lightsensor was back in business

Code: Select all

feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Initialized version 2.1.5, author 'Xenomes'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: TinyTUYA 2.1.5 plugin started
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: TinyTuyaVersion:1.16.1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'HardwareID':'39'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'HomeFolder':'/home/pi/domoticz/plugins/Domoticz-TinyTUYA-Plugin/'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'StartupFolder':'/home/pi/domoticz/'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'UserDataFolder':'/home/pi/domoticz/'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Database':'/home/pi/domoticz/domoticz.db'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Language':'nl'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Version':'2.1.5'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Author':'Xenomes'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Name':'Tuya'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Port':'0'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Username':'XXXXXXXXX'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Password':'YYYYYYYYYYYYYYYY'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Key':'tinytuya'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Mode1':'eu'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Mode2':'bff031e154ecf8410di3su'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Mode3':'900'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'Mode6':'-1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'DomoticzVersion':'2024.7'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'DomoticzHash':'b317cfab1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: 'DomoticzBuildTime':'2024-07-13 16:59:31'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device count: 12
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf0141ce43ae6f6c15n56n'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Buitenlamp Buitenschuur'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   'False'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 80
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf3bfc5a790cbb6f19uhda'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor R3'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf46ab2b9cf8c5a2d2mdux'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor L2'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf52465a4379790e38fxxf'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Leeslamp Links'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   ''
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf67a7b5935a04d109t7tx'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Kantoor Werk'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   'False'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 45
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bf79533fed518d0cb8ab3d'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Kantoor Privé'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   ''
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bfbc098077ac08f6fcsfdg'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Leeslamp Rechts'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   ''
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 0
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bfc0ed4f157da6f270gj01'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor R1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bfeb7b2f46ddac2cecfmdq'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor L1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bfeda5e343405d58e9dzdr'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor R2'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bff031e154ecf8410di3su'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Voordeur'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '100'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 100
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Device ID:       'bffd8f91e28fa61c11qjte'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Count:      '1'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit:           1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit Name:     'Sierverlichting Voor L3'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit nValue:    1
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit sValue:   '51'
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: --->Unit LastLevel: 51
feb 17 20:40:51 domoticz domoticz[25873]: Tuya: Pushing 'PollIntervalDirective' on to queue
feb 17 20:40:54 domoticz domoticz[25873]: Tuya: Scanning for tuya devices on network...
feb 17 20:40:54 domoticz domoticz[25873]: Remeha: Error making GET request: 'outdoorTemperature'
feb 17 20:41:00 domoticz domoticz[25873]: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
feb 17 20:41:03 domoticz domoticz[25873]: [web:443] Incoming connection from: 192.168.2.1
feb 17 20:41:03 domoticz domoticz[25873]: [web:443] Incoming connection from: 192.168.2.1
feb 17 20:41:07 domoticz domoticz[25873]: [web:8080] Incoming connection from: 192.168.2.18
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name=LightSensor id=bf39941f542926bc26j3je category=sensor
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= LightSensor id= bf39941f542926bc26j3je FunctionProperties= [{'code': 'find_me', 'desc': '{}', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= LightSensor id= bf39941f542926bc26j3je StatusProperties= [{'code': 'bright_state', 'name': '亮度检测状态', 'type': 'Enum', 'values': '{"range":["low","middle","high"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"unit":"LUX","min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'find_me', 'name': '找到我', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= LightSensor id= bf39941f542926bc26j3je result= [{'code': 'bright_state', 'value': 'middle'}, {'code': 'bright_value', 'value': 61}, {'code': 'find_me', 'value': False}]
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Run Startup script
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: (Tuya) Creating Unit 'LightSensor (Lux)'.
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Update devices in Domoticz
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Update device value: bf39941f542926bc26j3je Unit: 10 sValue: 61 nValue: 0 TimedOut=0
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name=Kantoor Privé id=bf79533fed518d0cb8ab3d category=light
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= Kantoor Privé id= bf79533fed518d0cb8ab3d FunctionProperties= [{'code': 'switch_led', 'desc': '{}', 'name': '开关', 'type': 'Boolean', 'values': '{}'}, {'code': 'work_mode', 'desc': '{"range":["white","colour","scene","music"]}', 'name': '模式', 'type': 'Enum', 'values': '{"range":["white","colour","scene","music"]}'}, {'code': 'bright_value', 'desc': '{"min":10,"max":1000,"scale":0,"step":1}', 'name': '白光亮度', 'type': 'Integer', 'values': '{"min":10,"max":1000,"scale":0,"step":1}'}, {'code': 'temp_value', 'desc': '{"min":0,"max":1000,"scale":0,"step":1}', 'name': '冷暖值', 'type': 'Integer', 'values': '{"min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'colour_data', 'desc': '{"maxlen":255}', 'name': '彩光', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'scene_data', 'desc': '{"maxlen":255}', 'name': '场景', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'countdown', 'desc': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}', 'name': '倒计时', 'type': 'Integer', 'values': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}'}, {'code': 'control_data', 'desc': '{"maxlen":255}', 'name': '实时调节', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'debug_data', 'desc': '{"maxlen":255}', 'name': 'Gamma调试', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'rhythm_mode', 'desc': '{"maxlen":255}', 'name': '生物节律', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'sleep_mode', 'desc': '{"maxlen":255}', 'name': '灯光助眠', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'wakeup_mode', 'desc': '{"maxlen":255}', 'name': '灯光唤醒', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'remote_switch', 'desc': '{}', 'name': 'Wi-Fi遥控器开关', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= Kantoor Privé id= bf79533fed518d0cb8ab3d StatusProperties= [{'code': 'switch_led', 'name': '开关', 'type': 'Boolean', 'values': '{}'}, {'code': 'work_mode', 'name': '模式', 'type': 'Enum', 'values': '{"range":["white","colour","scene","music"]}'}, {'code': 'bright_value', 'name': '白光亮度', 'type': 'Integer', 'values': '{"min":10,"max":1000,"scale":0,"step":1}'}, {'code': 'temp_value', 'name': '冷暖值', 'type': 'Integer', 'values': '{"min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'colour_data', 'name': '彩光', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'scene_data', 'name': '场景', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'countdown', 'name': '倒计时', 'type': 'Integer', 'values': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}'}, {'code': 'debug_data', 'name': 'Gamma调试', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'rhythm_mode', 'name': '生物节律', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'sleep_mode', 'name': '灯光助眠', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'wakeup_mode', 'name': '灯光唤醒', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'remote_switch', 'name': 'Wi-Fi遥控器开关', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:12 domoticz domoticz[25873]: Tuya: Device name= Kantoor Privé id= bf79533fed518d0cb8ab3d result= [{'code': 'switch_led', 'value': False}, {'code': 'work_mode', 'value': 'colour'}, {'code': 'bright_value', 'value': 208}, {'code': 'temp_value', 'value': 150}, {'code': 'colour_data', 'value': '010b03e8005f'}, {'code': 'scene_data', 'value': '000e0d0000000000000000c80000'}, {'code': 'countdown', 'value': 0}, {'code': 'debug_data', 'value': ''}, {'code': 'rhythm_mode', 'value': 'AAAAAAA='}, {'code': 'sleep_mode', 'value': 'AAA='}, {'code': 'wakeup_mode', 'value': 'AAA='}, {'code': 'remote_switch', 'value': True}]

---- removed data to save space :) ---

feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Device name=Sierverlichting Voor R3 id=bf3bfc5a790cbb6f19uhda category=light
feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Device name= Sierverlichting Voor R3 id= bf3bfc5a790cbb6f19uhda FunctionProperties= [{'code': 'switch_led', 'desc': '{}', 'name': '开关', 'type': 'Boolean', 'values': '{}'}, {'code': 'work_mode', 'desc': '{"range":["white","colour","scene","music"]}', 'name': '模式', 'type': 'Enum', 'values': '{"range":["white","colour","scene","music"]}'}, {'code': 'bright_value', 'desc': '{"min":10,"max":1000,"scale":0,"step":1}', 'name': '亮度值', 'type': 'Integer', 'values': '{"min":10,"max":1000,"scale":0,"step":1}'}, {'code': 'temp_value', 'desc': '{"min":0,"max":1000,"scale":0,"step":1}', 'name': '冷暖值', 'type': 'Integer', 'values': '{"min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'scene_data', 'desc': '{"maxlen":255}', 'name': '场景', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'countdown', 'desc': '{"min":0,"max":86400,"scale":0,"step":1}', 'name': '倒计时', 'type': 'Integer', 'values': '{"min":0,"max":86400,"scale":0,"step":1}'}, {'code': 'control_data', 'desc': '{"maxlen":255}', 'name': '调节', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'debug_data', 'desc': '{"maxlen":255}', 'name': '调试', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'rhythm_mode', 'desc': '{"maxlen":255}', 'name': '生物节律', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'sleep_mode', 'desc': '{"maxlen":255}', 'name': '入睡计划', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'wakeup_mode', 'desc': '{"maxlen":255}', 'name': '唤醒计划', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'remote_switch', 'desc': '{}', 'name': '遥控器开关', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Device name= Sierverlichting Voor R3 id= bf3bfc5a790cbb6f19uhda StatusProperties= [{'code': 'switch_led', 'name': '开关', 'type': 'Boolean', 'values': '{}'}, {'code': 'work_mode', 'name': '模式', 'type': 'Enum', 'values': '{"range":["white","colour","scene","music"]}'}, {'code': 'bright_value', 'name': '亮度值', 'type': 'Integer', 'values': '{"min":10,"max":1000,"scale":0,"step":1}'}, {'code': 'temp_value', 'name': '冷暖值', 'type': 'Integer', 'values': '{"min":0,"max":1000,"scale":0,"step":1}'}, {'code': 'scene_data', 'name': '场景', 'type': 'String', 'values': '{"maxlen":255}'}, {'code': 'countdown', 'name': '倒计时', 'type': 'Integer', 'values': '{"min":0,"max":86400,"scale":0,"step":1}'}, {'code': 'rhythm_mode', 'name': '生物节律', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'sleep_mode', 'name': '入睡计划', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'wakeup_mode', 'name': '唤醒计划', 'type': 'Raw', 'values': '{"maxlen":255}'}, {'code': 'remote_switch', 'name': '遥控器开关', 'type': 'Boolean', 'values': '{}'}]
feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Device name= Sierverlichting Voor R3 id= bf3bfc5a790cbb6f19uhda result= [{'code': 'switch_led', 'value': True}, {'code': 'work_mode', 'value': 'white'}, {'code': 'bright_value', 'value': 515}, {'code': 'temp_value', 'value': 222}, {'code': 'scene_data', 'value': '000e0d0000000000000000c80000'}, {'code': 'countdown', 'value': 0}, {'code': 'rhythm_mode', 'value': 'AAAAAAA='}, {'code': 'sleep_mode', 'value': 'AAA='}, {'code': 'wakeup_mode', 'value': 'AAA='}, {'code': 'remote_switch', 'value': True}]
feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Acquiring GIL for 'onStartCallback'
feb 17 20:41:16 domoticz domoticz[25873]: Tuya: Processing 'PollIntervalDirective' message
this is getting somewhere. But in the devices list it's listed twice, idx 3881 and 3882. Now the script, first 3881

Code: Select all

feb 17 20:46:00 domoticz domoticz[25873]: dzVents: LuxTEST: Devicename: LightSensor (Lux)
feb 17 20:46:00 domoticz domoticz[25873]: dzVents: LuxTEST: sValue: 61
feb 17 20:46:00 domoticz domoticz[25873]: dzVents: LuxTEST: tostring sValue: 61
feb 17 20:46:00 domoticz domoticz[25873]: dzVents: LuxTEST: nValue: 0
feb 17 20:46:00 domoticz domoticz[25873]: dzVents: LuxTEST: state: 61
and 3882 gave the same output

Yep, both give the correct data.

However, it's listed twice, actually all my tuya devices (mainly bulbs) are listed twice ....
Any idea how to continue...
Cheers,
Arjan
User avatar
Xenomes
Posts: 416
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by Xenomes »

Perfect! For the dual device, is it possible that in the plugin directory there are two version of the plugin?
HP T630 (256GB SSD/8GB Mem) - Ubuntu 24.04.2 LTS (64Bit) - Domoticz 2025.1 (Docker) Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
athoopen
Posts: 40
Joined: Wednesday 14 December 2022 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Error while reading Luxmeter

Post by athoopen »

In the plugin directory there is only 1, but in de hardware list there are 2 Tuya hardware devices. Already disabled one. Will look at it tonight.

Thanks for the help!!
Cheers,
Arjan
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest