AllskyTeam / allsky-modules

User modules for allsky
MIT License
17 stars 17 forks source link

Light module not working #91

Closed WirthmU closed 4 months ago

WirthmU commented 5 months ago

I have a TSL2561 sensor on the standard 0x29 address.

Unfortunately no json-file is created:

image

Any testing I could do?

I have used a simple python code and it gives me this: pi@meteotux:~/scripts $ sudo python3 TSL2561.py Full Spectrum(IR + Visible) :17 lux Infrared Value :4 lux Visible Value :13 lux

Alex-developer commented 5 months ago

Just tried mine and its working fine so ..

Feb 17 22:29:16 allskydev allskperiodic[204314]: INFO: ----------------------- Running Module allsky_light.py -----------------------
Feb 17 22:29:16 allskydev allskperiodic[204314]: INFO: Attempting to load allsky_light
Feb 17 22:29:16 allskydev allskperiodic[204314]: INFO: Lux 92.46243299797874, NELM -6.8358457579113825, SQM 6.8165743077427345
Feb 17 22:29:16 allskydev allskperiodic[204314]: INFO: Module allsky_light.py ran ok in 0.02s
Feb 17 22:29:16 allskydev allskperiodic[204314]: INFO: periodic flow Complete...

Which PI and OS are you using? I am using a pi 4 and bullseye lite

Is there anything logged in /var/log/allskyperiodic.log ?

WirthmU commented 5 months ago

I am using a Raspberry PI 4 Model B Rev. 1.2 with Bookworm.

The error message in the log-file is:

2024-02-18T16:42:02.881932+01:00 meteotux allskperiodic[255813]: ERROR: Module allsky_light.py failed on line 224 - Failed to find TSL2561! Part 0x0 Rev 0x0
2024-02-18T16:43:03.648465+01:00 meteotux allskperiodic[255924]: ERROR: Module allsky_light.py failed on line 224 - Failed to find TSL2561! Part 0x0 Rev 0x0
2024-02-18T16:44:04.427703+01:00 meteotux allskperiodic[256034]: ERROR: Module allsky_light.py failed on line 224 - Failed to find TSL2561! Part 0x0 Rev 0x0
Alex-developer commented 5 months ago

Looks like you may have the wrong i2c address in the module.

The 2561 has 3 possible 12c addresses 0x29, 0x39 and 0x49. The default is 0x39 which the module uses, it says it uses 0x29 but thats a typo which I will fix.

Put the i2c address of your 2561 in the module and see if that works.

WirthmU commented 5 months ago

I did set the address in the settings to 0x29, saved and did a re-boot. Strange enough the log shows: 2024-02-18T20:13:29.392199+01:00 meteotux allskperiodic[948]: ERROR: Module allsky_light.py failed on line 224 - No I2C device at address: 0x39

So I changed the address to 0x39 and 0x49. But whatever value I enter it always gives the same error: 2024-02-18T20:19:06.232122+01:00 meteotux allskperiodic[1230]: ERROR: Module allsky_light.py failed on line 224 - No I2C device at address: 0x39

Alex-developer commented 4 months ago

Hmm wierd

Whats the output of

i2cdetect -y -a 1

If you don't have i2cdetect installed you can install it with the following

sudo apt-get install i2c-tools

WirthmU commented 4 months ago
pi@meteotux:~ $ i2cdetect -y -a 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: 00 -- -- -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- 5b -- -- -- -- 
60: 60 -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Alex-developer commented 4 months ago
pi@meteotux:~ $ i2cdetect -y -a 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: 00 -- -- -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- 5b -- -- -- -- 
60: 60 -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

Thanks - I have found the problem and will add a fix

Alex-developer commented 4 months ago

I have added a fix for this. Can you try the new module, you will have to enter 0x29 as the i2c address

Thanks

Alex

WirthmU commented 4 months ago

With the new version it is working now - that's great!

pi@meteotux:~/allsky-modules $ cat /home/pi/allsky/config/overlay/extra/allskylight.json
{
    "AS_LIGHTLUX": "20.64502756305084",
    "AS_LIGHTNELM": "-5.391135777781152",
    "AS_LIGHTSQM": "8.263573974337595"
}