Need some help with reading a Xiaomi Pir with Lux sensor. Would like to read this and use it in a script but do not know how to handle it. I can not find an example in the manual.
Can someone help me on my way?
Use LUX with Dzvents
Moderator: leecollings
Re: Use LUX with Dzvents
Use the 'device.lua' from the examples/templates and use the lux attribute from https://www.domoticz.com/wiki/DzVents:_ ... _scripting
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Use LUX with Dzvents
Try this.
Code: Select all
return {
on = { devices = { "Xiaomi Pir with Lux sensor" }}, -- change to the name you gave this device
execute = function(dz, item)
local Lux = item.lux
local Lights = dz.devices("Your light")
local maxLux = 30 -- lights will only switched On if lux is less than this
local maxSeconds = 300 -- Lights will stay on for this amount of seconds after PIR state changed to Off
if Lux < maxLux and item.state == "On" then
Lights.cancelQueuedCommands()
Lights.switchOn().checkFirst()
elseif item.state == "Off" and Lights.state == "On" then
Lights.switchOff().afterSec(maxSeconds)
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 139
- Joined: Thursday 05 June 2014 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: 's-Hertogenbosch, NL
- Contact:
Re: Use LUX with Dzvents
I already did. I found only this info:EddyG wrote: ↑Monday 04 March 2019 20:55 Use the 'device.lua' from the examples/templates and use the lux attribute from https://www.domoticz.com/wiki/DzVents:_ ... _scripting
Lux sensor
lux: Number. Lux level for light sensors.
updateLux(lux): Function. Supports command options.
-
- Posts: 139
- Joined: Thursday 05 June 2014 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: 's-Hertogenbosch, NL
- Contact:
Re: Use LUX with Dzvents
Thanks, for now i solved with a dummy (Lux) in Blocky and further in Dzvents.waaren wrote: ↑Monday 04 March 2019 23:03Try this.Code: Select all
return { on = { devices = { "Xiaomi Pir with Lux sensor" }}, -- change to the name you gave this device execute = function(dz, item) local Lux = item.lux local Lights = dz.devices("Your light") local maxLux = 30 -- lights will only switched On if lux is less than this local maxSeconds = 300 -- Lights will stay on for this amount of seconds after PIR state changed to Off if Lux < maxLux and item.state == "On" then Lights.cancelQueuedCommands() Lights.switchOn().checkFirst() elseif item.state == "Off" and Lights.state == "On" then Lights.switchOff().afterSec(maxSeconds) end end }
Who is online
Users browsing this forum: Google [Bot] and 1 guest