TSL2561 errors on python script

Python and python framework

Moderator: leecollings

Post Reply
samourai47
Posts: 50
Joined: Wednesday 06 March 2019 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

TSL2561 errors on python script

Post by samourai47 »

Hello
I have tsl2561 installed on i2c controlleur in my RPI3 .
I used this script
import urllib
import smbus
import time

# Get I2C bus
bus = smbus.SMBus(1)

bus.write_byte_data(0x39, 0x00 | 0x80, 0x03)
bus.write_byte_data(0x39, 0x01 | 0x80, 0x02)

time.sleep(0.5)
data = bus.read_i2c_block_data(0x39, 0x0C | 0x80, 2)
data1 = bus.read_i2c_block_data(0x39, 0x0E | 0x80, 2)

# Convert the data
ch0 = data[1] * 256 + data[0]
ch1 = data1[1] * 256 + data1[0]

# Output data to screen
print "Full Spectrum(IR + Visible) :%d lux" %ch0
print "Infrared Value :%d lux" %ch1
print "Visible Value :%d lux" %(ch0 - ch1)

httpresponse = urllib.urlopen('http://192.168.0.120:8080/json.htm?type ... '+str(ch0)+'')
httpresponse = urllib.urlopen('http://192.168.0.120:8080/json.htm?type ... value=Full Value: '+str(ch0)+'; Visible Value: '+str(ch0 - ch1)+'; Infrared Value: '+str(ch1)+'')

But if the script works fine i have all time this kind of errors...
2019-12-29 11:21:57.343 Error: I2C_TSL2561: Error reading ch1!...
2019-12-29 11:31:27.876 Error: I2C_TSL2561: Error reading ch0!...
2019-12-29 11:37:58.227 Error: I2C_TSL2561: Error reading ch1!...
2019-12-29 11:52:29.015 Error: I2C_TSL2561: Error reading ch0!...
2019-12-29 11:55:59.204 Error: I2C_TSL2561: Error reading ch0!...
2019-12-29 12:04:59.743 Error: I2C_TSL2561: Error reading ch0!...
2019-12-29 12:27:31.037 Error: I2C_TSL2561: Error reading ch0!...
2019-12-29 12:29:01.117 Error: I2C_TSL2561: Error reading ch1!...

Have you some idea for this?
Thank's
samourai47
Posts: 50
Joined: Wednesday 06 March 2019 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TSL2561 errors on python script

Post by samourai47 »

Hello
No idea?
i always have this probleme...
Post Reply