wait for x seconds  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

wait for x seconds

Post by pvklink »

Hi, I build a small security system with domoticz as my professional system is becoming old and partially integrated in my domoticz.
I have two doorsensors as a test and use the security panel and a remote key.
My prof alarm system also switches the security panel after some soldering, so i have a working basis!

I bought two sensors, the wifi kerui works great with open and close, the other not, this is '$doorsensor_meterkast_2.
When i
a. switch off the alarm with a remote key it takes some time before the security panel is switch off
b. When i open the door and the doorsensor gives a message, it will trigger an alarm when the secpanel is armed
Question:
1. if the panel is still busy with switching to off is it possible that my door open message still activates the alarm? or is it queued?
2. do i have to create a wait timer before check the panel status? and how?
3. The cheaper sensor '$doorsensor_meterkast_2 sends only an on message i think, i attached a dump with:
http://192.168.20.35:82/json.htm?type=d ... ayhidden=1
when i open/close the sensors i see data and status change from Action, to ALarm etc. but when i use these values as item.state it does not work
Can you look at my datadump for an explanation

PM: i use 2 extra sensors that are copies off my real sensors because dashticz interpretates these sensors wrong and diferently...

Code: Select all

--http://192.168.20.35:82/json.htm?type=devices&rid=1774&displayhidden=1
--kijk naar status en data
return {
    on =        {       
                	    devices         =   {'$doorsensor*'}
                },                         
              
    logging =   {       level   =   domoticz.LOG_ERROR,      -- change to LOG_ERROR when script runs without problems otherwise LOG_DEBUG                             
                },                                           

    execute = function(dz,item,info)
    _G.logMarker = _G.moduleLabel -- marker wordt scriptnaam

    local securityPanel = dz.devices(1728) --security panel
    local messageTable = {}

    if item.name == '$doorsensor_meterkast_2' then      
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is:' .. item.state)
        if item.state == 'Alarm' then    
            dz.devices('doorsensor_meterkast_2').open().checkFirst()
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is alarm...')
        elseif item.state == 'Motion' then    
            dz.devices('doorsensor_meterkast_2').open().checkFirst()
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is motion...')
        else
            dz.devices('doorsensor_meterkast_2').close().checkFirst()
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. item.state .. ' status: deur is:' .. item.state)
        end
    -- function wilcard gebruiken om alle sensoren gelijk te behandeln
    elseif item.name == '$doorsensor_tuindeur_1' then 
        if item.state == 'Open' then    
            dz.devices('doorsensor_tuindeur_1').open().checkFirst()
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is open...')
            if (securityPanel.state ~= 'Disarmed') then
                dz.devices('Alarm_knop').switchOn().checkFirst()
            end

        else
            dz.devices('doorsensor_tuindeur_1').close().checkFirst()
            dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is dicht...')
        end
    end
    dz.helpers.globalMessage2(dz,item,info,messageTable,'chg') -- dump

end
}
Attachments
sensor_open.png
sensor_open.png (120.05 KiB) Viewed 2018 times
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: wait for x seconds

Post by waaren »

pvklink wrote: Wednesday 30 October 2019 15:41 when i open/close the sensors i see data and status change from Action, to ALarm etc. but when i use these values as item.state it does not work
Can you please include a dz.devices('devicename').dump in your script and share the resulting loglines ?
Try the same after removing the $ from the name and if the resulting log is different than also share.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: wait for x seconds

Post by pvklink »

ok,

this is the code when removeing the $ and after open the sensor

Code: Select all

 
2019-10-31 20:55:18.897 Status: dzVents: > urlDecode()
2019-10-31 20:55:18.897 Status: dzVents: > toCelsius()
2019-10-31 20:55:18.897 Status: dzVents: > print()
2019-10-31 20:55:18.897 Status: dzVents: > osExecute()
2019-10-31 20:55:18.897 Status: dzVents: > leftPad()
2019-10-31 20:55:18.897 Status: dzVents: > round()
2019-10-31 20:55:18.897 Status: dzVents: > rightPad()
2019-10-31 20:55:18.897 Status: dzVents: > centerPad()
2019-10-31 20:55:18.897 Status: dzVents: > urlEncode()
2019-10-31 20:55:18.897 Status: dzVents: > sceneExists()
2019-10-31 20:55:18.897 Status: dzVents: > yday: 304
2019-10-31 20:55:18.897 Status: dzVents: > ruleMatchesTime()
2019-10-31 20:55:18.898 Status: dzVents: > raw: 2019-10-31 20:54:47
2019-10-31 20:55:18.898 Status: dzVents: > ruleIsAtSunrise()
2019-10-31 20:55:18.898 Status: dzVents: > minutesAgo: 0
2019-10-31 20:55:18.898 Status: dzVents: > ruleIsAtCivilTwilightEnd()
2019-10-31 20:55:18.898 Status: dzVents: > wday: 5
2019-10-31 20:55:18.898 Status: dzVents: > compare()
2019-10-31 20:55:18.898 Status: dzVents: > seconds: 47
2019-10-31 20:55:18.898 Status: dzVents: > current:
2019-10-31 20:55:18.898 Status: dzVents: > wday: 5
2019-10-31 20:55:18.898 Status: dzVents: > sec: 18
2019-10-31 20:55:18.898 Status: dzVents: > month: 10
2019-10-31 20:55:18.898 Status: dzVents: > day: 31
2019-10-31 20:55:18.898 Status: dzVents: > min: 55
2019-10-31 20:55:18.898 Status: dzVents: > yday: 304
2019-10-31 20:55:18.898 Status: dzVents: > hour: 20
2019-10-31 20:55:18.898 Status: dzVents: > isdst: false
2019-10-31 20:55:18.898 Status: dzVents: > year: 2019
2019-10-31 20:55:18.898 Status: dzVents: > dDate: 1572551687
2019-10-31 20:55:18.898 Status: dzVents: > minutes: 54
2019-10-31 20:55:18.898 Status: dzVents: > getISO()
2019-10-31 20:55:18.898 Status: dzVents: > msAgo: 31778
2019-10-31 20:55:18.898 Status: dzVents: > rawDate: 2019-10-31
2019-10-31 20:55:18.898 Status: dzVents: > ruleIsAtCivilTwilightStart()
2019-10-31 20:55:18.898 Status: dzVents: > isdst: false
2019-10-31 20:55:18.898 Status: dzVents: > dayAbbrOfWeek: thu
2019-10-31 20:55:18.898 Status: dzVents: > secondsAgo: 31
2019-10-31 20:55:18.898 Status: dzVents: > ruleIsAfterSunrise()
2019-10-31 20:55:18.898 Status: dzVents: > updateWeight()
2019-10-31 20:55:18.898 Status: dzVents: > isDevice: true
2019-10-31 20:55:18.898 Status: dzVents: > updateTempHum()
2019-10-31 20:55:18.898 Status: dzVents: > nValue: 2
2019-10-31 20:55:18.899 Status: dzVents: > switchType: Door Contact
2019-10-31 20:55:18.899 Status: dzVents: > sValue: Open
2019-10-31 20:55:18.899 Status: dzVents: > updateRain()
2019-10-31 20:55:18.899 Status: dzVents: > setHex()
2019-10-31 20:55:18.899 Status: dzVents: > close()
2019-10-31 20:55:18.899 Status: dzVents: > updateUV()
2019-10-31 20:55:18.899 Status: dzVents: > setKelvin()
2019-10-31 20:55:18.899 Status: dzVents: > isScene: false
2019-10-31 20:55:18.899 Status: dzVents: > isTimer: false
2019-10-31 20:55:18.899 Status: dzVents: > startPlaylist()
2019-10-31 20:55:18.899 Status: dzVents: > _state: Open
2019-10-31 20:55:18.899 Status: dzVents: > setDiscoMode()
2019-10-31 20:55:18.899 Status: dzVents: > setWhiteMode()
2019-10-31 20:55:18.899 Status: dzVents: > name: doorsensor_meterkast_2x
2019-10-31 20:55:18.899 Status: dzVents: > icon: security
2019-10-31 20:55:18.899 Status: dzVents: > kodiPlayPlaylist()
2019-10-31 20:55:18.899 Status: dzVents: > updateHumidity()
2019-10-31 20:55:18.899 Status: dzVents: > dimTo()
2019-10-31 20:55:18.899 Status: dzVents: > setIcon()
2019-10-31 20:55:18.899 Status: dzVents: > kodiPlayFavorites()
2019-10-31 20:55:18.899 Status: dzVents: > kodiSetVolume()
2019-10-31 20:55:18.899 Status: dzVents: > description:
2019-10-31 20:55:18.899 Status: dzVents: > hardwareId: 2
2019-10-31 20:55:18.899 Status: dzVents: > rename()
2019-10-31 20:55:18.899 Status: dzVents: > kodiPlay()
2019-10-31 20:55:18.899 Status: dzVents: > changed: true
2019-10-31 20:55:18.899 Status: dzVents: > kodiSwitchOff()
2019-10-31 20:55:18.899 Status: dzVents: > play()
2019-10-31 20:55:18.899 Status: dzVents: > updateLux()
2019-10-31 20:55:18.899 Status: dzVents: > updateMode()
2019-10-31 20:55:18.899 Status: dzVents: > _nValue: 2
2019-10-31 20:55:18.900 Status: dzVents: > updateVisibility()
2019-10-31 20:55:18.900 Status: dzVents: > activate()
2019-10-31 20:55:18.900 Status: dzVents: > isHTTPResponse: false
2019-10-31 20:55:18.900 Status: dzVents: > stop()
2019-10-31 20:55:18.900 Status: dzVents: > quietOn()
2019-10-31 20:55:18.900 Status: dzVents: > dump()
2019-10-31 20:55:18.900 Status: dzVents: > cancelQueuedCommands()
2019-10-31 20:55:18.900 Status: dzVents: > updateTempBaro()
2019-10-31 20:55:18.900 Status: dzVents: > quietOff()
2019-10-31 20:55:18.900 Status: dzVents: > setLevel()
2019-10-31 20:55:18.900 Status: dzVents: > updateCustomSensor()
2019-10-31 20:55:18.900 Status: dzVents: > switchOn()
2019-10-31 20:55:18.900 Status: dzVents: > onkyoEISCPCommand()
2019-10-31 20:55:18.900 Status: dzVents: > incrementCounter()
2019-10-31 20:55:18.900 Status: dzVents: > isSecurity: false
2019-10-31 20:55:18.900 Status: dzVents: > setHue()
2019-10-31 20:55:18.900 Status: dzVents: > updateCounter()
2019-10-31 20:55:18.900 Status: dzVents: > kodiExecuteAddOn()
2019-10-31 20:55:18.900 Status: dzVents: > updatePressure()
2019-10-31 20:55:18.900 Status: dzVents: > switchSelector()
2019-10-31 20:55:18.900 Status: dzVents: > active: true
2019-10-31 20:55:18.900 Status: dzVents: > signalLevel: 5
2019-10-31 20:55:18.900 Status: dzVents: > kodiPause()
 
this is the code when removeing the $ and after close the sensor

Code: Select all

2019-10-31 20:58:31.237 Status: dzVents: > sec: 31
2019-10-31 20:58:31.238 Status: dzVents: > min: 58
2019-10-31 20:58:31.238 Status: dzVents: > wday: 5
2019-10-31 20:58:31.238 Status: dzVents: > year: 2019
2019-10-31 20:58:31.238 Status: dzVents: > yday: 304
2019-10-31 20:58:31.238 Status: dzVents: > month: 10
2019-10-31 20:58:31.238 Status: dzVents: > hour: 20
2019-10-31 20:58:31.238 Status: dzVents: > isdst: false
2019-10-31 20:58:31.238 Status: dzVents: > day: 31
2019-10-31 20:58:31.238 Status: dzVents: > ruleIsAtSunrise()
2019-10-31 20:58:31.238 Status: dzVents: > ruleMatchesTimeRange()
2019-10-31 20:58:31.238 Status: dzVents: > ruleIsAtNight()
2019-10-31 20:58:31.238 Status: dzVents: > ruleIsAtSunset()
2019-10-31 20:58:31.238 Status: dzVents: > ruleIsInWeek()
2019-10-31 20:58:31.238 Status: dzVents: > ruleMatchesTime()
2019-10-31 20:58:31.239 Status: dzVents: > msAgo: 193112
2019-10-31 20:58:31.239 Status: dzVents: > milliSeconds: 0
2019-10-31 20:58:31.239 Status: dzVents: > isUTC: false
2019-10-31 20:58:31.239 Status: dzVents: > ruleMatchesMinuteSpecification()
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsAtDayTime()
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsAtCivilDayTime()
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsAfterSunset()
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsBeforeSunset()
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsBeforeSunrise()
2019-10-31 20:58:31.239 Status: dzVents: > dDate: 1572551718
2019-10-31 20:58:31.239 Status: dzVents: > hour: 20
2019-10-31 20:58:31.239 Status: dzVents: > rawTime: 20:55:18
2019-10-31 20:58:31.239 Status: dzVents: > ruleIsAfterCivilTwilightEnd()
2019-10-31 20:58:31.240 Status: dzVents: > ruleIsBeforeCivilTwilightEnd()
2019-10-31 20:58:31.240 Status: dzVents: > secondsAgo: 193
2019-10-31 20:58:31.240 Status: dzVents: > minutes: 55
2019-10-31 20:58:31.240 Status: dzVents: > ruleIsBeforeCivilTwilightStart()
2019-10-31 20:58:31.240 Status: dzVents: > week: 44
2019-10-31 20:58:31.240 Status: dzVents: > ruleIsOnDate()
2019-10-31 20:58:31.240 Status: dzVents: > minutesAgo: 3
2019-10-31 20:58:31.240 Status: dzVents: > ruleIsOnDay()
2019-10-31 20:58:31.240 Status: dzVents: > getISO()
2019-10-31 20:58:31.240 Status: dzVents: > year: 2019
2019-10-31 20:58:31.240 Status: dzVents: > isToday: true
2019-10-31 20:58:31.240 Status: dzVents: > rawDateTime: 2019-10-31 20:55:18
2019-10-31 20:58:31.240 Status: dzVents: > millisecondsAgo: 193112
2019-10-31 20:58:31.241 Status: dzVents: > compare()
2019-10-31 20:58:31.241 Status: dzVents: > isdst: false
2019-10-31 20:58:31.241 Status: dzVents: > utils:
2019-10-31 20:58:31.241 Status: dzVents: > log()
2019-10-31 20:58:31.241 Status: dzVents: > centerPad()
2019-10-31 20:58:31.241 Status: dzVents: > hsbToRGB()
2019-10-31 20:58:31.241 Status: dzVents: > deviceExists()
2019-10-31 20:58:31.241 Status: dzVents: > LOG_DEBUG: 4
2019-10-31 20:58:31.241 Status: dzVents: > leadingZeros()
2019-10-31 20:58:31.241 Status: dzVents: > urlDecode()
2019-10-31 20:58:31.241 Status: dzVents: > rgbToHSB()
2019-10-31 20:58:31.241 Status: dzVents: > toCelsius()
2019-10-31 20:58:31.241 Status: dzVents: > groupExists()
2019-10-31 20:58:31.242 Status: dzVents: > numDecimals()
2019-10-31 20:58:31.242 Status: dzVents: > leftPad()
2019-10-31 20:58:31.242 Status: dzVents: > LOG_MODULE_EXEC_INFO: 2
2019-10-31 20:58:31.242 Status: dzVents: > LOG_ERROR: 1
2019-10-31 20:58:31.242 Status: dzVents: > urlEncode()
2019-10-31 20:58:31.243 Status: dzVents: > cameraExists()
2019-10-31 20:58:31.243 Status: dzVents: > round()
2019-10-31 20:58:31.243 Status: dzVents: > LOG_FORCE: 0.5
2019-10-31 20:58:31.243 Status: dzVents: > dumpTable()
2019-10-31 20:58:31.243 Status: dzVents: > variableExists()
2019-10-31 20:58:31.243 Status: dzVents: > fromJSON()
2019-10-31 20:58:31.243 Status: dzVents: > LOG_INFO: 3
2019-10-31 20:58:31.243 Status: dzVents: > toJSON()
2019-10-31 20:58:31.243 Status: dzVents: > print()
2019-10-31 20:58:31.243 Status: dzVents: > inTable()
2019-10-31 20:58:31.243 Status: dzVents: > osExecute()
2019-10-31 20:58:31.243 Status: dzVents: > rightPad()
2019-10-31 20:58:31.243 Status: dzVents: > stringSplit()
2019-10-31 20:58:31.243 Status: dzVents: > DZVERSION: 2.4.29
2019-10-31 20:58:31.244 Status: dzVents: > sceneExists()
2019-10-31 20:58:31.244 Status: dzVents: > fileExists()
2019-10-31 20:58:31.244 Status: dzVents: > seconds: 18
2019-10-31 20:58:31.244 Status: dzVents: > name: doorsensor_meterkast_2x
2019-10-31 20:58:31.244 Status: dzVents: > id: 1774
2019-10-31 20:58:31.244 Status: dzVents: > updateVisibility()
2019-10-31 20:58:31.244 Status: dzVents: > updateAirQuality()
2019-10-31 20:58:31.244 Status: dzVents: > updateTemperature()
2019-10-31 20:58:31.244 Status: dzVents: > isDevice: true
2019-10-31 20:58:31.244 Status: dzVents: > updateHumidity()
2019-10-31 20:58:31.244 Status: dzVents: > kodiPlayPlaylist()
2019-10-31 20:58:31.244 Status: dzVents: > updateSoundLevel()
2019-10-31 20:58:31.244 Status: dzVents: > maxDimLevel: 0
2019-10-31 20:58:31.244 Status: dzVents: > updateCustomSensor()
2019-10-31 20:58:31.245 Status: dzVents: > timedOut: false
2019-10-31 20:58:31.245 Status: dzVents: > quietOff()
2019-10-31 20:58:31.245 Status: dzVents: > updateWind()
2019-10-31 20:58:31.245 Status: dzVents: > switchSelector()
2019-10-31 20:58:31.245 Status: dzVents: > setIcon()
2019-10-31 20:58:31.245 Status: dzVents: > cancelQueuedCommands()
2019-10-31 20:58:31.245 Status: dzVents: > dimTo()
2019-10-31 20:58:31.245 Status: dzVents: > protectionOn()
2019-10-31 20:58:31.245 Status: dzVents: > updateP1()
2019-10-31 20:58:31.245 Status: dzVents: > updateAlertSensor()
open state is _State: Open, nvalue=2, Svalue = Open
close state of this device is .... nothing

and when i do this a couple of times i also get _State: Open when closing it...
so not relyable, look likes a cheap device with no on/off or open/close

Think i use this as a toggle... and buy kerui ones, those gives open and close for $7

PROBLEM:
Only need to solve my problem that
1. when i put my domoticz security panel to not armed with an remote when i am outside and then
2. quickly open the door with the kerui sensor my alarm goes off. So after action 1 the command to disactivate the panel is to late to change the state because the door open gives an alarm when the security panel is armed.....
Last edited by pvklink on Thursday 31 October 2019 21:14, edited 1 time in total.
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: wait for x seconds

Post by waaren »

pvklink wrote: Thursday 31 October 2019 20:46 this is the code when removeing the $ and after pushing this the sensor gives Normaal
this is the code when removeing the $ and after pushing this the sensor gives Alarm
look likes a cheap device with no on/off
Sorry but these dumps only contain 100 lines each and do not contain the information I need. If you enable logging to an OS file (you can enable this in /etc/init.d/domoticz.sh) you can copy / paste the complete dump.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: wait for x seconds

Post by pvklink »

ahh, sorry i grabbed them from domoticz . i do it again... For understanding how it works this is a nice exercise!
i did enabled, so it must be there also!
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: wait for x seconds

Post by pvklink »

ok,

I included the logfile.

I only took the last hour for the named device and some open and close logs...

I removed all the other devices and other stuff...
domoticz.txt
(195.16 KiB) Downloaded 25 times
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: wait for x seconds  [Solved]

Post by waaren »

pvklink wrote: Thursday 31 October 2019 21:38 I included the logfile.
OK. What I see in the dumps is that the state can be 'Normal' or 'Open' (I guess 'Open' is "Alarm')
So if you change the

Code: Select all

if item.state == 'Alarm'
to

Code: Select all

if item.state == 'Open'  
and

Code: Select all

if item.state == 'Motion' 
to

Code: Select all

if item.state == 'Normal'
this part should work
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: wait for x seconds

Post by pvklink »

Thanks i will try that, and learned that with the dump() i can do this myself the next time !
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: wait for x seconds

Post by pvklink »

open, close, motion and alarm did not work, lots of times is sends open instead of close.. this var is not stable
i tried another var, nvalue (with your dump-advise), that did the trick!

if item.name == 'doorsensor_meterkast_2x' then
if dz.devices('doorsensor_meterkast_2x').nValue == 2 then
dz.devices('doorsensor_meterkast_2').open().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is open...')

elseif dz.devices('doorsensor_meterkast_2x').nValue == 4 then
dz.devices('doorsensor_meterkast_2').close().checkFirst()
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' SENSOREN: Beweging gedetecteerd op device: ' .. item.name .. ' om:' .. dz.time.rawTime .. ' status: deur is dicht...')

end
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest