<?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 Re: Is there a way for nested conditions? in Home Automation</title>
    <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600548#M44971</link>
    <description>&lt;P&gt;I can't see the much needed hyphens in your code by the multiple starters.&lt;/P&gt;&lt;P&gt;My identation was also seemed correct.&lt;/P&gt;&lt;P&gt;The error message was about repeating columns error in struct.&lt;/P&gt;&lt;P&gt;Where can i make the logical and formula definition?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Feb 2024 16:44:45 GMT</pubDate>
    <dc:creator>zludany</dc:creator>
    <dc:date>2024-02-26T16:44:45Z</dc:date>
    <item>
      <title>Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/599787#M44929</link>
      <description>&lt;P&gt;Why is the automation script below having an error thrown: redundant struct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;metadata:&lt;/P&gt;&lt;P&gt;&amp;nbsp; name: fitness custom&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;d&lt;/SPAN&gt;&lt;SPAN&gt;escription: Scripted automation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;automations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; starters:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: assistant.event.OkGoogle&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eventData: query&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; is: "training time"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: device.state.TemperatureControl&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; state: temperatureAmbient&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; lessThan: 18C&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; device: Thermal sensor Wellness - Wellness room&lt;/P&gt;&lt;P&gt;&amp;nbsp; actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: device.command.ActivateScene # Activate or deactivate a scene.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; activate: true&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; devices: Wintertime Wellness ON&lt;/P&gt;&lt;P&gt;&amp;nbsp; starters:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: assistant.event.OkGoogle&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; eventData: query&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; is: "training time"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: device.state.TemperatureControl&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; state: temperatureAmbient&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; greaterThan: 22C&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; device: Thermal sensor Wellness - Wellness room&lt;/P&gt;&lt;P&gt;&amp;nbsp; actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; - type: device.command.ActivateScene # Activate or deactivate a scene.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; activate: true&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; devices: Summertime Wellness ON&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 17:53:16 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/599787#M44929</guid>
      <dc:creator>zludany</dc:creator>
      <dc:date>2024-02-24T17:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600229#M44949</link>
      <description>&lt;P&gt;In order to have more than one starter you need a hyphen in front of each occurrence of the word "starter" with the appropriate indenting.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 22:35:27 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600229#M44949</guid>
      <dc:creator>salbando</dc:creator>
      <dc:date>2024-02-25T22:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600370#M44959</link>
      <description>&lt;P&gt;Ok, where to put the hyphen??&lt;/P&gt;&lt;P&gt;I haven't seen hyphens in front of starters neither in code examples, nor by the pilot.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 07:16:02 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600370#M44959</guid>
      <dc:creator>zludany</dc:creator>
      <dc:date>2024-02-26T07:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600447#M44963</link>
      <description>&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;metadata:
  name: Dog or cat notification
  description: Testing out the dog and cat sensing
automations:
  - starters:
      type: device.event.AnimalCatDetection
      device: Front Yard camera - Front Yard
    actions:
      type: home.command.Notification
      title: Cat
      body: I tawt I taw a puddy tat
      members:
        - John G - #
        - Krista G - #
  - starters:
      type: device.event.AnimalDogDetection
      device: Front Yard camera - Front Yard
    actions:
      type: home.command.Notification
      title: Dog
      body: Oh, dog!
      members:
        - John G - #
        - Krista G - #&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should also remind you that in your example in the first starter block if either is true then that action will be performed. In other words, if you say "training time" OR the temperature is less than 18C then you action will be performed. It doesn't seem to me that this is your intent.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 14:54:37 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600447#M44963</guid>
      <dc:creator>salbando</dc:creator>
      <dc:date>2024-02-26T14:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600548#M44971</link>
      <description>&lt;P&gt;I can't see the much needed hyphens in your code by the multiple starters.&lt;/P&gt;&lt;P&gt;My identation was also seemed correct.&lt;/P&gt;&lt;P&gt;The error message was about repeating columns error in struct.&lt;/P&gt;&lt;P&gt;Where can i make the logical and formula definition?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 16:44:45 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600548#M44971</guid>
      <dc:creator>zludany</dc:creator>
      <dc:date>2024-02-26T16:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600553#M44973</link>
      <description>&lt;P&gt;The hyphen is how YAML stores multiple values for each key. If your familiar with programming it is how YAML stores array values. Without it, the script will see it as redundant or repeated values for the same single variable.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 17:13:56 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600553#M44973</guid>
      <dc:creator>salbando</dc:creator>
      <dc:date>2024-02-26T17:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600635#M44982</link>
      <description>&lt;P&gt;Ok, thanks, but how to put AND clause between the starters?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 22:14:46 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600635#M44982</guid>
      <dc:creator>zludany</dc:creator>
      <dc:date>2024-02-26T22:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600651#M44983</link>
      <description>&lt;P&gt;In general, all starters are always "or", but they are also a type of conditional because they are basically saying, "If starter, then 'the rest of the script tries to execute'." An "if" inside of another "if" is logically equivalent to an "and". Therefore, by making your ambient temperature a conditional, you will effectively achieve an "and". So your script would look something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;metadata:
  name: fitness custom
  description: Scripted automation

automations:
  - starters:
      type: assistant.event.OkGoogle
      eventData: query
      is: training time
    condition:
      type: device.state.TemperatureControl
      state: temperatureAmbient
      lessThan: 18C
      device: Thermal sensor Wellness - Wellness room
    actions:
      type: device.command.ActivateScene # Activate or deactivate a scene.
      activate: true
      devices: Wintertime Wellness ON
      
  - starters:
      type: assistant.event.OkGoogle
      eventData: query
      is: training time
    condition:
      type: device.state.TemperatureControl
      state: temperatureAmbient
      greaterThan: 22C
      device: Thermal sensor Wellness - Wellness room
    actions:
      type: device.command.ActivateScene # Activate or deactivate a scene.
      activate: true
      devices: Summertime Wellness ON&lt;/LI-CODE&gt;&lt;P&gt;You will notice that the hyphen that you had on "type" isn't necessary (it doesn't hurt either) because there is only one "type" per block now. Also, you don't need quotes in your OkGoogle query because you aren't using any other delimiter like apostrophe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 23:42:09 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600651#M44983</guid>
      <dc:creator>salbando</dc:creator>
      <dc:date>2024-02-26T23:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way for nested conditions?</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600704#M44988</link>
      <description>&lt;P&gt;Thanks man.&lt;/P&gt;&lt;P&gt;I did it in parallel on my way, however it was the hard way figuring out on your own.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 03:03:42 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/Is-there-a-way-for-nested-conditions/m-p/600704#M44988</guid>
      <dc:creator>zludany</dc:creator>
      <dc:date>2024-02-27T03:03:42Z</dc:date>
    </item>
  </channel>
</rss>

