<?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 openClose door sensor automation not always executed in Home Automation</title>
    <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717888#M55450</link>
    <description>&lt;P&gt;I have a scripted automation updating an helper sensor accordingly to the status openClose on some contact physical sensor. The automation looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;metadata:
  name: Porta ingresso handler
  description: Scripted automation

automations:
  - starters:
      - type: device.state.OpenClose
        state: openPercent
        is: 100
        device: Porta Ingresso - Ingresso

    actions:
      - type: device.command.OnOff
        on: true
        devices: Sensore porta ingresso - Ingresso

  - starters:
      - type: device.state.OpenClose
        state: openPercent
        is: 0
        device: Porta Ingresso - Ingresso

    actions:
      - type: device.command.OnOff
        on: false
        devices: Sensore porta ingresso - Ingresso&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that often, when the door is opened and closed quickly, the physical sensor switch back to closed as normal but the helper sensor does not get updated resulting in the helper remaining true even if the door is actually closed.&lt;/P&gt;&lt;P&gt;I would really appreciate any help.&lt;/P&gt;</description>
    <pubDate>Wed, 14 May 2025 05:31:20 GMT</pubDate>
    <dc:creator>Leonardo-R</dc:creator>
    <dc:date>2025-05-14T05:31:20Z</dc:date>
    <item>
      <title>openClose door sensor automation not always executed</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717888#M55450</link>
      <description>&lt;P&gt;I have a scripted automation updating an helper sensor accordingly to the status openClose on some contact physical sensor. The automation looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;metadata:
  name: Porta ingresso handler
  description: Scripted automation

automations:
  - starters:
      - type: device.state.OpenClose
        state: openPercent
        is: 100
        device: Porta Ingresso - Ingresso

    actions:
      - type: device.command.OnOff
        on: true
        devices: Sensore porta ingresso - Ingresso

  - starters:
      - type: device.state.OpenClose
        state: openPercent
        is: 0
        device: Porta Ingresso - Ingresso

    actions:
      - type: device.command.OnOff
        on: false
        devices: Sensore porta ingresso - Ingresso&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that often, when the door is opened and closed quickly, the physical sensor switch back to closed as normal but the helper sensor does not get updated resulting in the helper remaining true even if the door is actually closed.&lt;/P&gt;&lt;P&gt;I would really appreciate any help.&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 05:31:20 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717888#M55450</guid>
      <dc:creator>Leonardo-R</dc:creator>
      <dc:date>2025-05-14T05:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: openClose door sensor automation not always executed</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717924#M55453</link>
      <description>&lt;P&gt;It is likely due to your automation not catching those rapid state changes. When the door opens and closes in quick succession, the physical sensor might correctly switch states, but the automation might not execute fast enough to keep up, resulting in the helper sensor getting stuck in an incorrect state (often remaining "on" even when the door is actually closed).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To fix this, you can introduce a delay condition in your automation logic. This ensures that the door must stay in the "open" or "closed" state for a few seconds before the automation reacts. For example, you can require the door to remain open or closed for at least 5 seconds before updating the helper sensor. This prevents brief, unintended or transient state changes from triggering your actions. In YAML, this is done by adding a for: 5s parameter to the starters block, so the system only runs the command if the door remains in that state for a full 5 seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your automation platform doesn’t support using for directly in the trigger, you can instead introduce a short delay within the action block itself. This way, after the door changes state, the automation waits a few seconds before updating the helper sensor. During that wait, if the door changes back, the action will not execute, effectively filtering out quick toggles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, make sure all devices involved are reliably connected and responsive. Missed or delayed automation steps can also happen due to network lags or hardware performance issues. Checking logs or event history might help identify if the automation is even firing when expected.&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 10:42:20 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717924#M55453</guid>
      <dc:creator>iqbal1</dc:creator>
      <dc:date>2025-05-14T10:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: openClose door sensor automation not always executed</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717940#M55457</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.googlenestcommunity.com/t5/user/viewprofilepage/user-id/735951"&gt;@iqbal1&lt;/a&gt;&amp;nbsp;thanks for your reply.&lt;/P&gt;&lt;P&gt;I already tried using a "for: 5sec" into che close starter. I thought that if the automation would for the door to be closed fro 5 seconds this would do the trick. Unfortunately with no luck. I'll try to use 1 min delay for the closing starter even if it seems that closing the door to quickly will stop the script execution no matter what.&lt;/P&gt;&lt;P&gt;what do you think?&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 12:32:45 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/717940#M55457</guid>
      <dc:creator>Leonardo-R</dc:creator>
      <dc:date>2025-05-14T12:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: openClose door sensor automation not always executed</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/718336#M55480</link>
      <description>&lt;P&gt;Just an update. I thing I found a quite solid implementation and it seems it's working better:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Goole home detect the door open.&lt;/LI&gt;&lt;LI&gt;Google home update the sensor. Not handling the door closed event.&lt;/LI&gt;&lt;LI&gt;Home assistant intercept the update and start waiting 1 min before automatically update the sensor to closed.&lt;/LI&gt;&lt;LI&gt;Google home intercept the sensor update to closed and, if the door is still open, re-update the sensor to open.&lt;/LI&gt;&lt;LI&gt;Home assistant start waiting again before repeating the auto close action.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This way I found a workable way for my scenario.&lt;/P&gt;&lt;P&gt;Hope it helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 08:17:09 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/718336#M55480</guid>
      <dc:creator>Leonardo-R</dc:creator>
      <dc:date>2025-05-16T08:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: openClose door sensor automation not always executed</title>
      <link>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/718502#M55486</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;a href="https://www.googlenestcommunity.com/t5/user/viewprofilepage/user-id/360419"&gt;@Leonardo-R&lt;/a&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thank you for reaching out to the community! I understand that you experienced some issues with your scripted automations involving a door sensor, where the door was closing or opening a little too quickly. I'm happy to hear that you've already found a workaround for this issue, and thank you for sharing that solution here. Let me also share some information with you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To better understand the functionality of these automations, I want to share two helpful Help Center articles with you:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://support.google.com/googlenest/answer/13323253?hl=en#zippy=%2Cwith-the-google-home-app" target="_self"&gt;&lt;SPAN&gt;Create advanced home automations with the script editor.&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://support.google.com/googlenest/answer/13460475" target="_self"&gt;&lt;SPAN&gt;Write scripted automations with the script editor.&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this can be helpful for you in case you notice the issue again! Please always remember that you can reach out to us, and we will be happy to help you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Debora&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 May 2025 05:05:49 GMT</pubDate>
      <guid>https://www.googlenestcommunity.com/t5/Home-Automation/openClose-door-sensor-automation-not-always-executed/m-p/718502#M55486</guid>
      <dc:creator>DeboraJ</dc:creator>
      <dc:date>2025-05-17T05:05:49Z</dc:date>
    </item>
  </channel>
</rss>

