Reading lux sensor
Moderator: leecollings
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Reading lux sensor
Does somebody know how to retrieve the number of lumen/lux from a lux sensor? Thanks at forehand! I want to use it in a lua-script.....
-
- Posts: 858
- Joined: Sunday 23 February 2014 17:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: mixed
- Location: Hengelo(Ov)/NL
- Contact:
Re: Reading lux sensor
Which type/model of lux-sensor?
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
- madpatrick
- Posts: 667
- Joined: Monday 26 December 2016 12:17
- Target OS: Linux
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: Reading lux sensor
In Dzvents it is like this
454 is of course your device number
Code: Select all
execute = function(dz)
local lux = dz.devices(454).lux
if lux = 100 then .....
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Re: Reading lux sensor
I'm using a ZW100 Multisensor 6+ from Aeon Labs; the same brand as my controller, that's a ZW090 Z-stick Gen5 from Aeon labs. Need more info? Please tell me?
Last edited by pkelderman on Monday 12 September 2022 19:12, edited 2 times in total.
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Re: Reading lux sensor
I tried;
current = otherdevices_humidity[TempEnVocht]
current = devices(Lichtsterkte)
the first one works, the second gives:
2022-09-12 19:09:00.140 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:29: attempt to call a nil value (global 'devices')
current = otherdevices_humidity[TempEnVocht]
current = devices(Lichtsterkte)
the first one works, the second gives:
2022-09-12 19:09:00.140 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:29: attempt to call a nil value (global 'devices')
- madpatrick
- Posts: 667
- Joined: Monday 26 December 2016 12:17
- Target OS: Linux
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: Reading lux sensor
You need to add .lux after device namepkelderman wrote: ↑Monday 12 September 2022 19:11 I tried;
current = otherdevices_humidity[TempEnVocht]
current = devices(Lichtsterkte)
the first one works, the second gives:
2022-09-12 19:09:00.140 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:29: attempt to call a nil value (global 'devices')
Code: Select all
current = devices(Lichtsterkte).lux
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Re: Reading lux sensor
I have tried:
local Lichtsterkte = 'Lichtsterkte'
current = devices(Lichtsterkte).lux
print(current)
The log says:
2022-09-13 14:35:00.160 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:34: attempt to call a nil value (global 'devices')
local Lichtsterkte = 'Lichtsterkte'
current = devices(Lichtsterkte).lux
print(current)
The log says:
2022-09-13 14:35:00.160 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:34: attempt to call a nil value (global 'devices')
- madpatrick
- Posts: 667
- Joined: Monday 26 December 2016 12:17
- Target OS: Linux
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: Reading lux sensor
Can you post the complete script.pkelderman wrote: ↑Tuesday 13 September 2022 14:38 I have tried:
local Lichtsterkte = 'Lichtsterkte'
current = devices(Lichtsterkte).lux
print(current)
The log says:
2022-09-13 14:35:00.160 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:34: attempt to call a nil value (global 'devices')
I'm aan NoNo on Lua and little bit better in Dvents, but maybe i can assist in getting you in the right direction
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
-
- Posts: 160
- Joined: Wednesday 02 October 2019 7:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands
- Contact:
Re: Reading lux sensor
Try:
current = tonumber(otherdevices['Lichtsterkte'])
Then don't use:
if current==100 then
But use f.i.
if current >90 and current <110 then
Chances are the value of 100 is skipped due to the refresh interval.
current = tonumber(otherdevices['Lichtsterkte'])
Then don't use:
if current==100 then
But use f.i.
if current >90 and current <110 then
Chances are the value of 100 is skipped due to the refresh interval.
rpi4 - zigbee2mqtt - roborock - espeasy - rfxcom - homewizard p1 - otgw - homebridge - surveillance station - egardia - goodwe - open weather map - wol - BBQ detection - rsync backup
-
- Posts: 648
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Reading lux sensor
And "dz.devices" instead of just "devices"madpatrick wrote: ↑Monday 12 September 2022 19:17You need to add .lux after device namepkelderman wrote: ↑Monday 12 September 2022 19:11 I tried;
current = otherdevices_humidity[TempEnVocht]
current = devices(Lichtsterkte)
the first one works, the second gives:
2022-09-12 19:09:00.140 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:29: attempt to call a nil value (global 'devices')
Code: Select all
current = devices(Lichtsterkte).lux
- jvdz
- Posts: 2328
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Reading lux sensor
Think this is a regular LUA time script looking at the script path, so otherdevices is the arrayname to use!
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Re: Reading lux sensor
@ asonneveld
I tried next solution:
current = tonumber(otherdevices['Lichtsterkte'])
print(current)
the result:
39
Wow it works! Thanks a lot!
I tried next solution:
current = tonumber(otherdevices['Lichtsterkte'])
print(current)
the result:
39
Wow it works! Thanks a lot!
Who is online
Users browsing this forum: No registered users and 1 guest