Garage Door Open Alert
Domoticz

Garage Door Open Alert

This script monitors the state of the garage door and alerts the user if it remains open for more than 10 minutes. Notifications are sent to the AWTRIX3 smart pixel clock and optionally through the Domoticz app or email for immediate awareness, enhancing home security.
A flow by Galadril

Download flow

Flow Details

πŸ”„ Activation and Scope:

  • The script is active, as indicated by active = true.
  • It runs every minute, as specified by the timer configuration (timer = { 'every minute' }).
  • The script specifically monitors the device named 'Garage door' for its state and last update time.

πŸ“ Logging:

  • The script logs informational and warning messages with a marker labeled "AWTRIX3_GARAGE_DOOR".
  • Logging level is set to domoticz.LOG_INFO, ensuring relevant actions and checks are recorded for troubleshooting or monitoring.

βš™οΈ Execution Logic:

  1. Garage Door State Check:

    • The script checks if the 'Garage door' device state is 'Open'.
  2. Time Condition:

    • If the garage door has been open for more than 10 minutes (garageDoor.lastUpdate.minutesAgo > 10), the following actions are triggered:

      • Log a Warning: A warning message is logged, indicating the garage door has been open for over 10 minutes.

      • AWTRIX3 Notification:

        • A JSON payload is created with the text "Garage OPEN!" and an associated icon (50087).
        • The payload is sent to the 'AWTRIX3 - Send Notification' device to display the alert on the AWTRIX3 smart pixel clock.
        • If the AWTRIX3 notification device is not found, an error message is logged.
      • Optional Domoticz Notification:

        • A high-priority notification is sent via the Domoticz app or email, informing the user that the garage door has been open for more than 10 minutes.

πŸ”Œ Purpose:
This script is designed to enhance home security by notifying the user when the garage door has been left open for an extended period. It integrates with the AWTRIX3 display for a visual alert and optionally uses Domoticz notifications for immediate awareness. This ensures timely action can be taken to secure the property.


More information:

return { active = true, on = { timer = { 'every minute' } -- Check every minute }, logging = { level = domoticz.LOG_INFO, marker = "AWTRIX3_GARAGE_DOOR" }, execute = function(domoticz) local garageDoor = domoticz.devices('Garage door') -- Check if the garage door is open and has been open for more than 10 minutes if garageDoor.state == 'Open' and garageDoor.lastUpdate.minutesAgo > 10 then domoticz.log('Garage door has been open for more than 10 minutes!', domoticz.LOG_WARNING) -- Prepare JSON payload for AWTRIX3 local payload = { text = "Garage OPEN!", icon = 50087 } local payloadJSON = domoticz.utils.toJSON(payload) domoticz.log("Sending to AWTRIX3: " .. payloadJSON, domoticz.LOG_INFO) -- Send the JSON to the AWTRIX3 device local awtrixDevice = domoticz.devices('AWTRIX3 - Send Notification') if awtrixDevice then awtrixDevice.setDescription(payloadJSON) awtrixDevice.switchOn().afterSec(2) else domoticz.log("AWTRIX3 - Send Notification device not found", domoticz.LOG_ERROR) end -- Optional: Notify via Domoticz app or email domoticz.notify( 'Garage Door Alert', 'The garage door has been open for more than 10 minutes!', domoticz.PRIORITY_HIGH ) end end }
-- Flow first published on January 16, 2025.