home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.33k stars 650 forks source link

ButtonWidget executes a script twice if it runs longer than 15 seconds #3925

Open harmptor opened 1 year ago

harmptor commented 1 year ago

Home Assistant Android app version(s): 2023.9.2-full

Android version(s): 10

Device model(s): ONEPLUS A5000

Home Assistant version: 2023.9.3

Last working Home Assistant release (if known):

Description of problem, include YAML if issue is related to notifications: If a button widget fires a script directly via script.testscript, and that script runs for at least for 15 seconds, then it is executed a second time 15 or 16 seconds after its initial execution. There is no second execution if the script is configured to run less than 15 seconds or the script is aborted prematurely via script.turn_off. I feel like it has something to do with the animation the widget displays. It seems like it checks after 15 seconds if the animation is still supposed to show, and by that it accidentally triggers the script again. Maybe.

In this example, I got one HA trace for this script at 16:05:41 and another at 16:05:56. The script config is this

testscript:
  mode: parallel
  sequence: 
    - service: persistent_notification.create
      data:
        title: "Test notif {{ this.attributes.current }} {{ states.script.testscript.attributes.current }}"
        message: "{{ now().strftime('%Y-%m-%d %H:%M:%S')}}"
    - delay: 18

and I get notifications at 16:05:41 and 16:05:56.

All that doesn't happen with Quick Setting Tiles, only with widgets afaik. I enabled debug logging for the mobile_app integration and this is what was logged:

HA core log with mobile app debug enabled
2023-10-08 16:05:11.683 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type get_config: {}
2023-10-08 16:05:11.860 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type update_sensor_states: [{'unique_id': 'last_update', 'state': 'SensorWorker', 'type': 'sensor...
2023-10-08 16:05:12.930 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type get_config: {}
2023-10-08 16:05:13.218 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type update_sensor_states: [{'unique_id': 'last_update', 'state': 'io.homeassistant.companion.android.UPDATE_SENSORS', 'type': 'sensor...
2023-10-08 16:05:41.010 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type call_service: {'domain': 'script', 'service': 'testscript', 'service_data': {}}
2023-10-08 16:05:56.043 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type call_service: {'domain': 'script', 'service': 'testscript', 'service_data': {}}
2023-10-08 16:06:12.232 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type get_config: {}
2023-10-08 16:06:12.510 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type update_sensor_states: [{'unique_id': 'last_update', 'state': 'android.intent.action.SCREEN_OFF', 'type': 'sensor...
2023-10-08 16:06:40.133 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type get_config: {}
2023-10-08 16:06:40.379 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from dd for type update_sensor_states: [{'unique_id': 'last_update', 'state': 'android.intent.action.SCREEN_ON', 'type': 'sensor...

Companion App Logs:

10-08 16:05:23.415  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:05:23.506  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:05:23.506  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:05:23.506  5425  5425 D MediaPlayCtrlsWidget: Fetching media preview image
10-08 16:05:23.518  5425  5425 D MediaPlayCtrlsWidget: Fetch and load complete
10-08 16:05:40.596  5425  5425 D ButtonWidget: Broadcast received: 
10-08 16:05:40.596  5425  5425 D ButtonWidget: Broadcast action: io.homeassistant.companion.android.widgets.button.ButtonWidget.CALL_SERVICE
10-08 16:05:40.596  5425  5425 D ButtonWidget: AppWidgetId: 15
10-08 16:05:40.597  5425  5425 D ButtonWidget: Calling widget service
10-08 16:05:40.601  5425  5425 D ButtonWidget: Service Call Data loaded:
10-08 16:05:40.601  5425  5425 D ButtonWidget: domain: script
10-08 16:05:40.601  5425  5425 D ButtonWidget: service: testscript
10-08 16:05:40.601  5425  5425 D ButtonWidget: service_data: {}
10-08 16:05:40.604  5425  5425 D ButtonWidget: Sending service call to Home Assistant
10-08 16:05:40.608  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:05:52.210  5425 30051 D WebSocketRepository: Websocket: onMessage (text)
10-08 16:05:52.215  5425  7546 D WebSocketRepository: Message number 1052 received
10-08 16:05:52.227  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:05:52.227  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:05:52.232  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:05:52.232  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:05:52.307  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:05:52.307  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:05:52.307  5425  5425 D MediaPlayCtrlsWidget: Fetching media preview image
10-08 16:05:52.372  5425  5425 D MediaPlayCtrlsWidget: Fetch and load complete
10-08 16:06:11.604  5425  5425 D SensorReceiver: Received intent: android.intent.action.SCREEN_OFF
10-08 16:06:11.607  5425  5425 D LastUpdate: Last update is android.intent.action.SCREEN_OFF
10-08 16:06:11.614  5425  5425 D ButtonWidget: Broadcast received: 
10-08 16:06:11.614  5425  5425 D ButtonWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.614  5425  5425 D ButtonWidget: AppWidgetId: -1
10-08 16:06:11.614  5425  7546 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:11.618  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.618  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.618  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.619  5425  6453 D WebSocketRepository: Unsubscribing from subscribe_trigger with data {trigger={platform=state, entity_id=[media_player.spotify]}}
10-08 16:06:11.620  5425  6453 D WebSocketRepository: Sending message 1053: {type=unsubscribe_events, subscription=1052, id=1053}
10-08 16:06:11.620  5425  6453 D WebSocketRepository: Message number 1053 sent
10-08 16:06:11.621  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.621  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.621  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.635  5425  7963 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:11.637  5425  7963 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:11.638  5425  5854 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=xxxxxxxxxxxx, tags={ io.homeassistant.companion.android.websocket.WebsocketManager } ]
10-08 16:06:11.640  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.640  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.640  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.644  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.644  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.644  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.648  5425  5425 I chatty  : uid=10346(io.homeassistant.companion.android) identical 4 lines
10-08 16:06:11.649  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.649  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.649  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.651  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.651  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.651  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.662  5425  5425 I chatty  : uid=10346(io.homeassistant.companion.android) identical 13 lines
10-08 16:06:11.663  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.663  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.663  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.677  5425 30051 D WebSocketRepository: Websocket: onMessage (text)
10-08 16:06:11.679  5425  7963 D WebSocketRepository: Message number 1053 received
10-08 16:06:11.753  5425 30051 D WebSocketRepository: Websocket: onClosing code: 1000, reason: 
10-08 16:06:11.754  5425 30051 D WebSocketRepository: Websocket: onClosed
10-08 16:06:11.785  5425  7546 D NextAlarm: Next alarm is scheduled by com.urbandroid.sleep with trigger time 1696837500000
10-08 16:06:11.828  5425  7546 D StepsSensor: Steps sensor listener registered
10-08 16:06:11.833  5425  5425 D StepsSensor: Steps sensor listener unregistered
10-08 16:06:11.840  5425  7546 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:11.842  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.842  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.842  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.842  5425  7546 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:11.843  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.843  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.843  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.852  5425  5425 I chatty  : uid=10346(io.homeassistant.companion.android) identical 10 lines
10-08 16:06:11.853  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.853  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.853  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.869  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.869  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.869  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.886  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.886  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.886  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.888  5425  5425 I chatty  : uid=10346(io.homeassistant.companion.android) identical 2 lines
10-08 16:06:11.889  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.889  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.889  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.914  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.914  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.914  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:11.921  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:11.921  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
10-08 16:06:11.921  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:12.120  5425  7546 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:12.230  5425  6453 I SensorReceiver: Sensor updates and sync completed
10-08 16:06:20.765  5425  5425 D ButtonWidget: Service call sent successfully
10-08 16:06:39.548  5425  5425 D SensorReceiver: Received intent: android.intent.action.SCREEN_ON
10-08 16:06:39.550  5425  5425 D LastUpdate: Last update is android.intent.action.SCREEN_ON
10-08 16:06:39.558  5425  5425 D ButtonWidget: Broadcast received: 
10-08 16:06:39.558  5425  5425 D ButtonWidget: Broadcast action: android.intent.action.SCREEN_ON
10-08 16:06:39.558  5425  5425 D ButtonWidget: AppWidgetId: -1
10-08 16:06:39.560  5425  5425 D ButtonWidget: Updating all widgets
10-08 16:06:39.560  5425  6453 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.574  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.582  5425  5425 D MediaPlayCtrlsWidget: Broadcast received: 
10-08 16:06:39.582  5425  5425 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_ON
10-08 16:06:39.582  5425  5425 D MediaPlayCtrlsWidget: AppWidgetId: -1
10-08 16:06:39.582  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.585  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.603  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.603  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:06:39.607  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.607  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:06:39.609  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.609  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:06:39.609  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.609  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:06:39.676  5425  7963 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.678  5425  5425 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.678  5425  5425 D ServerConnectionInfo: Using external URL
10-08 16:06:39.678  5425  5425 D MediaPlayCtrlsWidget: Fetching media preview image
10-08 16:06:39.678  5425  7963 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.681  5425  5854 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=xxxxxxxxxxxx, tags={ io.homeassistant.companion.android.websocket.WebsocketManager } ]
10-08 16:06:39.685  5425  6453 D NextAlarm: Next alarm is scheduled by com.urbandroid.sleep with trigger time 1696837500000
10-08 16:06:39.694  5425  5425 D MediaPlayCtrlsWidget: Fetch and load complete
10-08 16:06:39.723  5425  6453 D StepsSensor: Steps sensor listener registered
10-08 16:06:39.742  5425  5425 D StepsSensor: Steps sensor listener unregistered
10-08 16:06:39.743  5425  6453 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.744  5425  6453 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.975  5425  6453 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: true
10-08 16:06:39.989  5425 30051 D WebSocketRepository: Websocket: onOpen
10-08 16:06:39.989  5425 30051 D WebSocketRepository: Websocket: onMessage (text)
10-08 16:06:39.990  5425  6453 D WebSocketRepository: Message number null received
10-08 16:06:39.990  5425  6453 D WebSocketRepository: Auth Requested
10-08 16:06:40.081  5425 30051 D WebSocketRepository: Websocket: onMessage (text)
10-08 16:06:40.085  5425  6453 D WebSocketRepository: Message number null received
10-08 16:06:40.085  5425  5425 D WebSocketRepository: Sending message 1054: {type=supported_features, id=1054, features={coalesce_messages=1}}
10-08 16:06:40.085  5425  5425 D WebSocketRepository: Sending message 1055: {type=subscribe_trigger, trigger={platform=state, entity_id=[media_player.spotify]}, id=1055}
10-08 16:06:40.086  5425  5425 D WebSocketRepository: Message number 1055 sent
10-08 16:06:40.089  5425  6453 I SensorReceiver: Sensor updates and sync completed
10-08 16:06:40.180  5425 30051 D WebSocketRepository: Websocket: onMessage (text)
10-08 16:06:40.182  5425  6453 D WebSocketRepository: Message number 1054 received

Screenshot or video of problem:

Additional information:

harmptor commented 1 year ago

On a likely related note: The widget's spinning animation cancels after 15s if the script's mode is set to single, even though the script is still running. If I change it to parallel it spins until the script has finished, which I assume to be the intended behaviour. (to be precise: it spins until the second execution finished, the second one being the unintentional one)

To me it feels like the widget tries to fire the script again after 15s in order to see if its running, and if its not (because its blocked by mode: single) it cancels its spinning animation. I hope this can help troubleshooting :)

dshokouhi commented 1 year ago

Strange the app logs show we only send the service call once but HA core logs show it got the response twice? We don't have any retry logic so I wonder where that is coming from? Very strange how the automation mode changes this behavior, makes me wonder if its a HA core issue as a result of that?

dshokouhi commented 1 year ago

Are you keeping the screen on the entire time with the spinning animation? If the screen is turning on and off then it is expected that the spinning animation will be removed. This has nothing to do with the service call itself and is only a visual change because in some cases the spinning never stops and the user cannot interact with the widget. If the service call was sent twice via the button action we would see that in the logs but we do not.

jpelgrom commented 1 year ago

Trying to reproduce this, but I'm not able to. Using the same example script as your code but it is correctly finishing after 18s, only being triggered once. Only difference is Home Assistant core is the latest here (2023.10.1), but I'm not aware of any changes that should affect it. 🤔

The widget's spinning animation cancels after 15s if the script's mode is set to single, even though the script is still running. If I change it to parallel it spins until the script has finished, which I assume to be the intended behaviour.

The behavior is actually supposed to be: it spins until finished (unless the system refreshes the widget like @dshokouhi mentions). I wonder if this issue may be device specific somehow. Would you able to test on another device?

harmptor commented 1 year ago

Yea its very strange. And I kept my screen on, yes. I dont understand. If you guys are unable to reproduce it's likely just an issue on my end and I will be closing this. I could dig up an old phone somewhere in the piles but I don't think its worth it, unless you guys want me to. Parallel to filing this issue I created a relay script that executes the actual script, it works for me and will do until I change phones or reset the app which I think will fix this issue.

harmptor commented 1 year ago

For anyone with the same issue, here's my remedy script:

widget_relay:
  alias: "widget_relay"
  description: "this functions as a relay script for mobile app widgets, because they fire twice"
  fields:
    script_to_run:
      description: "the entity_id(s) of the script(s) to run"
      default: "script.testscript"
      example: "script.testscript, script.anotherscript"
    script_to_wait_for:
      description: "the entity_id of the script to wait for"
      default: "script.testscript"
      example: "script.testscript"
    variables:
      description: "the variables to be sent to script_to_run as data"
      default: '{"shuffle": "true", "limit": 20}'
      example: '{"shuffle": "true", "limit": 20}'
  mode: parallel
  # max_exceeded: silent
  sequence:
    - variables:
        variables: "{{ variables|default('{}')|join(',')|from_json }}"
        first_script: >
          {% if script_to_run is string -%}
            {{ script_to_run.split(',')[0] }}
          {%- else -%}
            {{ script_to_run[0] }}
          {%- endif %}
        script_to_wait_for: "{{ (script_to_wait_for|default(first_script)) }}"
    - alias: "IF current > 0, then wait, else run script"
      if:
        - alias: current > 0
          condition: template
          value_template: "{{ this.attributes.current > 0 }}"
      then:
        - alias: wait for script to finish
          wait_template: "{{ is_state(script_to_wait_for, 'off') }}"
          timeout: "00:05:00"
          continue_on_timeout: false
      else: # if not current > 0
        - alias: send temp notif
          service: persistent_notification.create
          data:
            title: "Widget Relay Script:"
            message: |
              {{ now().strftime('%Y-%m-%d %H:%M:%S') }}

              waiting for {{ script_to_wait_for }} to finish...

              variables: {{ variables|to_json(pretty_print=True,sort_keys=True) }}
            notification_id: "widgetrelay-{{ context.id }}"
        - alias: run script_to_run
          service: script.turn_on
          target:
            entity_id: "{{ script_to_run }}"
          data: "{'variables': {{ variables }} }"
        - delay: 0.5
        - alias: wait for script to finish
          wait_template: "{{ is_state(script_to_wait_for, 'off') }}"
          timeout: "00:05:00"
          continue_on_timeout: false
        - alias: dismiss temp notif
          service: persistent_notification.dismiss
          data:
            notification_id: "widgetrelay-{{ context.id }}"
NodeJSmith commented 9 months ago

I believe I am also experiencing this issue, I added a delay to a script that I call from a widget and since then it's been running twice. It's not at 15 seconds exactly, it's been 18 and 20 seconds, but still repeating a second time.

If I can provide any logs let me know.

Core 2024.2.1 Supervisor 2024.01.1 Operating System 11.5 Frontend 20240207.1

App 2024.1.5-full

Edit: My script is set to restart, not single. But it seems to still be affected, as the trace today shows it was restarted at the 18 second mark, which I didn't (couldn't?) do, since it was triggered by the widget.

Screenshot_20240218_225031_Home Assistant

2024-02-18 22:29:49.754 INFO (MainThread) [homeassistant.components.script.bedtime] Bedtime Automation: Restarting
2024-02-18 22:29:49.756 INFO (MainThread) [homeassistant.components.script.bedtime] Bedtime Automation: Running script sequence