Get Doors Status

From Domoticz
Jump to navigation Jump to search

Purpose

This script will trigger a bash script at a specific time when the device "Sensor" is open

Dependencies - hardware / software / operating system

This script will work on all type of hardware / software / operating system.

It could be use to trigger any bash script such :

Domoticz Setup - switches, variables, version

  • Replace "sensor1, sensor2" variable by your device name. e.g. : "Kitchen - Door Sensor"

Installation instructions

Copy this script in your domoticz\scripts\lua\ folder.

Script with comments

-- script name : script_time_doorisopen.lua
-- This script will trigger a bash script at a specific time when the device "Sensor" is open
-- Replace "sensor1, sensor2" variable by your weather station device name. e.g. : "Kitchen - Door Sensor"
 
local sensor1 = 'Kitchen - Door Sensor'
local sensor2 = 'Hall - Door Sensor'
 
commandArray = {}
 
ReportHour=21
ReportMinute=00
 
-- Time to run?
time = os.date("*t")
if time.hour == ReportHour and time.min == ReportMinute then

        if ((otherdevices[sensor1] == 'Open') ) then

        os.execute ("/root/domoticz/domoticz/scripts/google_voice.sh Kitchen door is open")

        end

        if ((otherdevices[sensor2] == 'Open')) then

        os.execute ("/root/domoticz/domoticz/scripts/google_voice.sh Hall door is open")

        end
 
end

return commandArray

Example of use (if relevant) i.e. output files / screen displays

N/A