Hi All,
Is there any way to get a lastupdate within seconds?
I want try to create a script that looks to follow:
Switch test goes active
if lastupdate is < 1 sec then action 1
else action 2
When i use switch and press 1 time i want turn lights on normal
When i press it again within 1 second then turn lights on with a different color
.lastupdate
Moderator: leecollings
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
.lastupdate
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: .lastupdate
idea is not working at all... grrrr
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: .lastupdate
Yes, But are you that quick ?
Code: Select all
return {
on = { devices = { "Your device name" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Long time ago there was ... "},
execute = function(dz, item )
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
if item.state == "On" then
logWrite(item.name .. " was previously updated " .. item.lastUpdate.millisecondsAgo .. " milliseconds ago")
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
Who is online
Users browsing this forum: No registered users and 1 guest