स्क्रिप्ट किए गए ऑटोमेशन का उदाहरण

इन उदाहरणों को देखते समय, बाईं ओर मौजूद साइडबार में ऑटोमेशन स्क्रिप्ट के ऐसे शब्दों को ढूंढें जिनका मतलब आपको समझ न आ रहा हो.

स्विच की मदद से लाइट कंट्रोल करना

metadata:
  name: Switch-controlled light
  description: When a switch is moved to the on position, turn on a light.
automations:
- starters:
  - type: device.state.OnOff
    device: Office Switch - Office
    state: on
    is: true
  actions:
  - type: device.command.OnOff
    devices:
    - Christmas lights - Living Room
    on: true

लाइट और ब्लाइंड को शेड्यूल करना

metadata:
  name: Nighttime dim lights and close blinds
  description: At 10pm, dim the lights and close the blinds.
automations:
- starters:
  - type: time.schedule
    at: 22:00
  actions:
  # Adjusting brightness will automatically turn on the lights.
  # No need to add a separate OnOff command.
  - type: device.command.BrightnessAbsolute
    devices:
    - Light - Living Room
    brightness: 50
  - type: device.command.OpenClose
    devices:
    - blinds1 - Living Room
    openPercent: 0

घर में मौजूद लोगों के हिसाब से कैमरे को कंट्रोल करना

metadata:
  name: Person detection cameras
  description: When the first person comes home, turn off cameras.
automations:
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: HOME
  actions:
  - type: device.command.OnOff
    devices:
    - Camera - Living room
    on: false

जब घर में कोई न हो, तब वैक्यूम करने की सुविधा

metadata:
  name: Empty home vacuum
  description: When the home is unoccupied, run the vacuum.
automations:
# Turn on robot vacuum when everyone is away
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: AWAY
  actions:
  - type: device.command.StartStop
    devices:
    - VACUUM - LIVING_ROOM
    start: true
# Turn off robot vacuum when someone is home
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: HOME
  actions:
  - type: device.command.StartStop
    devices:
    - VACUUM - LIVING_ROOM
    start: false

शाम के बाद, लिविंग रूम में टीवी चालू होने पर लाइटें कम करना और ब्लिंड को नीचे करना

metadata:
  name: Nighttime lights and blinds
  description: After dark, when the TV is on, dim the light and lower the blinds.
automations:
- starters:
  - type: device.state.OnOff
    device: TV - Living Room
    state: on
    is: true
  condition:
    type: time.between
    after: SUNSET
    before: SUNRISE
  actions:
  # Adjusting brightness will automatically turn on the lights.
  # No need to add a separate OnOff command.
  - type: device.command.BrightnessAbsolute
    devices:
    - Light - Living Room
    brightness: 5
  - type: device.command.OpenClose
    devices:
    - Blind - Living Room
    openPercent: 0

ठंडे मौसम में हीटिंग

metadata:
  name: Cool weather heating
  description: If it is cool, open blinds, turn on fans, and adjust thermostats.
automations:
- starters:
  - type: device.state.TemperatureSetting
    state: thermostatTemperatureAmbient
    device: thermostat - Family Room
    lessThan: 18C
  actions:
  - type: device.command.OpenClose
    devices:
    - blinds - Bedroom
    openPercent: 100
  - type: device.command.OnOff
    devices: fan - Bedroom
    on: true
  - type: device.command.ThermostatTemperatureSetpoint
    devices:
    - thermostat - Family Room
    thermostatTemperatureSetpoint: 21C

गर्म मौसम में वेंटिलेशन

metadata:
  name: Warm weather ventilation
  description: If it is warm, close blinds, turn on fans, and adjust thermostats.
automations:
- starters:
  - type: device.state.TemperatureSetting
    device: Nest Thermostat
    state: thermostatTemperatureAmbient
    greaterThan: 25C
  actions:
  - type: device.command.OpenClose
    devices:
      - blind1 - Living Room
      - blind2 - Bedroom
    openPercent: 0
  - type: device.command.OnOff
    devices:
    - fan1 - Bedroom
    on: true
  - type: device.command.ThermostatTemperatureSetpoint
    devices:
    - thermostat - Bedroom
    thermostatTemperatureSetpoint: 22C

एक से ज़्यादा बार शेड्यूल की गई लाइटिंग

metadata:
  name: Scheduled lighting
  description: Turn on the lights at sunset, dim them at 10pm and turn them off at midnight.
automations:
# At sunset
- starters:
  - type: time.schedule
    at: SUNSET
  actions:
  # Adjusting brightness will automatically turn on the lights.
  # No need to add a separate OnOff command.
  - type: device.command.BrightnessAbsolute
    devices:
    - Christmas lights - Living Room
    brightness: 100

# At 10 PM
- starters:
  - type: time.schedule
    at: 22:00
  actions:
  - type: device.command.BrightnessAbsolute
    devices:
    - Christmas lights - Living Room
    brightness: 50

# At midnight
- starters:
  - type: time.schedule
    at: 00:00
  actions:
  - type: device.command.OnOff
    devices: Christmas lights - Living Room
    on: false

दो लाइटों को सिंक करना

metadata:
  name: Synchronize two lights
  description: If one light is turned on, turn the other on, and if one light is turned off, turn the other off.
automations:
- starters:
  - type: device.state.OnOff
    device: Light A - Office
    state: on
    is: true

  condition:
    type: device.state.OnOff
    device: Light B - Living Room
    state: on
    is: false

  actions:
  - type: device.command.OnOff
    devices:
    - Light B - Living Room
    on: true

- starters:
  - type: device.state.OnOff
    device: Light A - Office
    state: on
    is: false

  condition:
    type: device.state.OnOff
    device: Light B - Living Room
    state: on
    is: true

  actions:
  - type: device.command.OnOff
    devices:
    - Light B - Living Room
    on: false

- starters:
  - type: device.state.OnOff
    device: Light B - Living Room
    state: on
    is: true

  condition:
    type: device.state.OnOff
    device: Light A - Office
    state: on
    is: false

  actions:
  - type: device.command.OnOff
    device: Light A - Office
    on: true

- starters:
  - type: device.state.OnOff
    device: Light B - Living Room
    state: on
    is: false

  condition:
    type: device.state.OnOff
    device: Light A - Office
    state: on
    is: true

  actions:
  - type: device.command.OnOff
    devices:
    - Light A - Office
    on: false

स्मोक अलार्म चालू होने पर लाइटें फ़्लैश करना

metadata:
  name: Smoke detector lights
  description: When smoke is detected, flash lights red and blue.
automations:
- starters:
  - type: device.state.SensorState
    device: Smoke Detector - Kitchen
    state: currentSensorStateData.SmokeLevel.currentSensorState
    is: high
  actions:
  # Setting color will automatically turn on the lights.
  # No need to add a separate OnOff command.
  - type: device.command.ColorAbsolute
    devices:
    - Light - Living Room
    color:
      name: "red"
  - type: time.delay
    for: 5sec
  - type: device.command.OnOff
    devices: Light - Living Room
    on: false
  - type: time.delay
    for: 5sec
  - type: device.command.ColorAbsolute
    devices:
    - Light - Living Room
    color:
      name: "blue"
  - type: time.delay
    for: 5sec
  - type: device.command.OnOff
    devices:
    - Light - Living Room
    on: false
  - type: time.delay
    for: 5sec
  - type: device.command.ColorAbsolute
    devices:
    - Light - Living Room
    color:
      name: "red"

घर के अंदर की हवा की क्वालिटी खराब होने पर, एयर प्यूरीफ़ायर चालू करना

metadata:
  name: Low air quality air purifier
  description: When indoor air quality is poor turn on air purifier at high speed.
automations:
- starters:
  - type: device.state.SensorState
    device: Air Sensor - Living Room
    state: currentSensorStateData.AirQuality.currentSensorState
    is: poor
  actions:
  - type: device.command.OnOff
    devices:
    - Air Purifier - Living Room
    on: true
  - type: device.command.SetFanSpeed
    devices:
    - Air Purifier - Living Room
    fanSpeed: "speed_high"

रात में अनलॉक करने पर सूचना पाना

metadata:
  name: Nighttime unlocking lights
  description: At night, when a lock is unlocked, turn on the light at full brightness.
automations:
- starters:
  - type: device.state.LockUnlock
    device: Front Door - Living Room
    state: isLocked
    is: false
  condition:
    type: time.between
    after: SUNSET
    before: SUNRISE
  actions:
  # Adjusting brightness will automatically turn on the lights.
  # No need to add a separate OnOff command.
  - type: device.command.BrightnessAbsolute
    devices:
    - Light - Bedroom
    brightness: 100

कार्बन मोनोऑक्साइड का पता चलने पर लाइटें चमकना

metadata:
  name: Carbon monoxide detection lights
  description: When carbon monoxide is detected, flash the lights.
automations:
- starters:
  - type: device.state.SensorState
    device: coDetector - Living Room
    state: currentSensorStateData.CarbonMonoxideLevel.currentSensorState
    is: carbon monoxide detected
  actions:
  # Only works for lights that support Pulse effect
  - type: device.command.LightEffectPulse
    devices:
    - Light - Bedroom
    - Light - Living Room
    duration: 5min

मोशन से ट्रिगर होने वाली लाइटें

metadata:
  name: Motion detection lights
  description: When motion is detected, turn on the lights, then turn them off after five minutes of stillness.
automations:
- starters:
  - type: device.state.MotionDetection
    device: sensor - Living Room
    state: motionDetectionEventInProgress
    is: true
  actions:
  - type: device.command.OnOff
    devices:
    - light - Living Room
    on: true

- starters:
  - type: device.state.MotionDetection
    device: sensor - Living Room
    state: motionDetectionEventInProgress
    is: false
    for: 5min
  actions:
  - type: device.command.OnOff
    devices:
    - light - Living Room
    on: false

ऑक्युपेंसी सेंसर के साथ मोशन से ट्रिगर होने वाली लाइटें

metadata:
  name: Occupancy sensor lights
  description: When an occupant is detected, turn on the lights, then turn them off after five minutes.
automations:
- starters:
  - type: device.state.OccupancySensing
    device: sensor - Living Room
    state: occupancy
    is: OCCUPIED
  actions:
  - type: device.command.OnOff
    devices:
    - light - Living Room
    on: true

- starters:
  - type: device.state.OccupancySensing
    device: sensor - Living Room
    state: occupancy
    is: UNOCCUPIED
    for: 5min
  actions:
  - type: device.command.OnOff
    devices:
    - light - Living Room
    on: false

घर से बाहर जाने पर कैमरे चालू करना

metadata:
  name: Occupancy sensor cameras
  description: Once the home is unoccupied, turn on cameras.
automations:
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: AWAY
  actions:
  - type: device.command.OnOff
    devices:
    - Camera - Living Room
    on: true

दरवाज़े की घंटी बजने पर लाइट की सूचना

metadata:
  name: Doorbell light alert
  description: When someone rings the doorbell, blink the lights in occupied room.
automations:
- starters:
  - type: device.event.DoorbellPress
    device: Front Door doorbell - Front Door
  condition:
    type: device.state.OccupancySensing
    device: sensor - Living Room
    state: occupancy
    is: OCCUPIED
  actions:
  - type: device.command.LightEffectPulse
    devices:
    - light - Living Room
    duration: 5min

मूवी नाइट का सीन

metadata:
  name: Movie night blinds, lights, and appliances
  description: When Assistant hears the utterance "movie night", lower the blinds, turn off the lights, and pause certain noisy appliances.
automations:
- starters:
  - type: assistant.event.OkGoogle
    eventData: query
    is: "Movie Night"
  actions:
  - type: device.command.OnOff
    devices:
    - light - Living Room
    on: false
  - type: device.command.OpenClose
    devices:
    - blinds - Living Room
    openPercent: 0
  - type: device.command.PauseUnpause
    devices:
    - washer - Hall
    pause: true

होम और अवे लाइटिंग

metadata:
  name: Occupancy sensor lights
  description: After dark, when someone arrives home, turn on lights, and turn off all lights when the home is unoccupied.
automations:
# Turn on certain lights after someone gets home after dark
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: HOME
  condition:
    type: time.between
    after: SUNSET
    before: SUNRISE
  actions:
  - type: device.command.OnOff
    devices:
    - light1 - Living Room
    - light2 - Front door
    on: true
# Turn off all lights when everyone is away during the day
- starters:
  - type: home.state.HomePresence
    state: homePresenceMode
    is: AWAY
  condition:
    type: time.between
    after: SUNRISE
    before: SUNSET
  actions:
  - type: device.command.OnOff
    devices:
    - light1 - Living Room
    - light2 - Front door
    - light3 - Bedroom
    on: false

पैकेज डिलीवर होने पर सूचना भेजना

metadata:
  name: Package Delivered
  description: When a package is delivered, send a notification.
automations:
- starters:
  - type: device.event.PackageDelivered
    device: Camera - Frontdoor
  actions:
  - type: home.command.Notification
    title: Package Delivered
    body: A package is delivered
    members:
    - cloudysanfrancisco@gmail.com

जब मैं सुबह अपने कॉरिडोर से पहली बार गुज़रूं (मोशन सेंसर), तो सभी ब्लाइंड खोलें और ट्रिगर को 20 घंटे के लिए बंद करें

metadata:
  name: Open blinds
  description: Open blinds in the morning after motion is detected.
automations:
- starters:
  - type: device.event.MotionDetection
    device: Camera - Hallway
    suppressFor: 20 hours
  condition:
    type: time.between
    after: 5:00
    before: 12:00
  actions:
  - type: device.command.OpenClose
    openPercent: 100
    devices:
    - Blinds1 - Living Room
    - Blinds2 - Family Room

कामकाजी दिनों में घर में किसी व्यक्ति के मूवमेंट का पता चलने पर सूचना पाना

metadata:
  name: Motion at home
  description: Send a notification when movement is detected at home on a weekday
automations:
- starters:
  - type: device.event.MotionDetection
    device: Camera - Frontdoor
  - type: device.event.MotionDetection
    device: Thermostat - Downstairs
  - type: device.event.MotionDetection
    device: SmokeDetector - Upstairs
  condition:
    type: time.between
    after: 09:00
    before: 18:00
    weekdays:
      - MON
      - TUE
      - WED
      - THU
      - FRI
  actions:
  - type: home.command.Notification
    title: Motion at home
    members:
    - cloudysanfrancisco@gmail.com
    - jeffersonloveshiking@gmail.com