<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Feedback on an automation i wrote in Smart Home Developer Forum</title>
    <link>https://www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/Feedback-on-an-automation-i-wrote/m-p/616535#M7019</link>
    <description>&lt;P&gt;Hello everyone.&lt;BR /&gt;&lt;BR /&gt;I am new to coding as a whole. But I adore automations, especially when they work, so I embarked on this path of reading and learning the principles.&lt;BR /&gt;I wanted to share my current automation, which I made using the script editor for Google Home, and I want your opinion on it.&lt;BR /&gt;&lt;BR /&gt;I primarily attempted to make this using the "and" and "not" operators, but it does not appear to read my criteria. So I went with the longer path. Could there be another approach to writing this script?&lt;BR /&gt;&lt;BR /&gt;Here's my script&lt;/P&gt;&lt;LI-CODE lang="python"&gt;metadata:
  name: Living Room - Revamp
  description: Turn on the light when someone is in living room
automations:
  - starters:
      - type: device.state.MotionDetection
        device: Living room - Living Room
        state: motionDetectionEventInProgress
        is: true
    condition:
      type: time.between
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      before: 07:00 # HH:MM (24 hours format). Adjust time as needed
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      after: 03:50 #
      weekdays:
        - MON
        - TUE
        - WED
        - THU
        - FRI
        - SAT
        - SUN
    actions:
      - type: device.command.OnOff
        devices:
          - Living Room - Living Room
        on: true
# The not and or wasn't working. Could be cause of the wrong time.between or command isn't program correctly
  - starters:
      - type: device.state.MotionDetection
        device: Living room - Living Room
        state: motionDetectionEventInProgress
        is: true
    condition:
      type: time.between
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      before: 20:40 # HH:MM (24 hours format). Adjust time as needed
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      after: 17:40 #
      weekdays:
        - MON
        - TUE
        - WED
        - THU
        - FRI
        - SAT
        - SUN
    actions:
      - type: device.command.OnOff
        devices:
          - Living Room - Living Room
        on: true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 28 Apr 2024 13:58:07 GMT</pubDate>
    <dc:creator>Drjay18</dc:creator>
    <dc:date>2024-04-28T13:58:07Z</dc:date>
    <item>
      <title>Feedback on an automation i wrote</title>
      <link>https://www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/Feedback-on-an-automation-i-wrote/m-p/616535#M7019</link>
      <description>&lt;P&gt;Hello everyone.&lt;BR /&gt;&lt;BR /&gt;I am new to coding as a whole. But I adore automations, especially when they work, so I embarked on this path of reading and learning the principles.&lt;BR /&gt;I wanted to share my current automation, which I made using the script editor for Google Home, and I want your opinion on it.&lt;BR /&gt;&lt;BR /&gt;I primarily attempted to make this using the "and" and "not" operators, but it does not appear to read my criteria. So I went with the longer path. Could there be another approach to writing this script?&lt;BR /&gt;&lt;BR /&gt;Here's my script&lt;/P&gt;&lt;LI-CODE lang="python"&gt;metadata:
  name: Living Room - Revamp
  description: Turn on the light when someone is in living room
automations:
  - starters:
      - type: device.state.MotionDetection
        device: Living room - Living Room
        state: motionDetectionEventInProgress
        is: true
    condition:
      type: time.between
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      before: 07:00 # HH:MM (24 hours format). Adjust time as needed
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      after: 03:50 #
      weekdays:
        - MON
        - TUE
        - WED
        - THU
        - FRI
        - SAT
        - SUN
    actions:
      - type: device.command.OnOff
        devices:
          - Living Room - Living Room
        on: true
# The not and or wasn't working. Could be cause of the wrong time.between or command isn't program correctly
  - starters:
      - type: device.state.MotionDetection
        device: Living room - Living Room
        state: motionDetectionEventInProgress
        is: true
    condition:
      type: time.between
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      before: 20:40 # HH:MM (24 hours format). Adjust time as needed
      # Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
      after: 17:40 #
      weekdays:
        - MON
        - TUE
        - WED
        - THU
        - FRI
        - SAT
        - SUN
    actions:
      - type: device.command.OnOff
        devices:
          - Living Room - Living Room
        on: true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Apr 2024 13:58:07 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/Feedback-on-an-automation-i-wrote/m-p/616535#M7019</guid>
      <dc:creator>Drjay18</dc:creator>
      <dc:date>2024-04-28T13:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Feedback on an automation i wrote</title>
      <link>https://www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/Feedback-on-an-automation-i-wrote/m-p/617595#M7039</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.googlenestcommunity.com/t5/user/viewprofilepage/user-id/543023"&gt;@Drjay18&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;One recommendation for your automation script to look more clean and understandable is to make use of nested conditional constructs, something like 'or' with 'and'. Currently, we don't seem to be supporting this particular aspect. I would recommend opening up a feature request in this regard on the &lt;A href="https://issuetracker.google.com/" target="_self"&gt;Public Issue Tracker&lt;/A&gt;, so that we can have this capability in our bag.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 17:03:24 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/Feedback-on-an-automation-i-wrote/m-p/617595#M7039</guid>
      <dc:creator>sipriyadarshi</dc:creator>
      <dc:date>2024-05-03T17:03:24Z</dc:date>
    </item>
  </channel>
</rss>

