Automation Executed, Device Did not Turn Off

I have a very simple automation that turns off a z-wave switch and sends a notification to my phone when my son's ebike has fully charged.

alias: Mototec Full Charge
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.mototec_charger_electric_consumption_a
    below: 0.3
    for:
      hours: 0
      minutes: 5
      seconds: 0
conditions:
  - condition: template
    value_template: |
      {{
        now() - as_datetime(states('sensor.uptime'))
        > timedelta(minutes=5)
      }}
actions:
  - action: notify.mobile_app_chris
    metadata: {}
    data:
      title: Mototec
      data:
        notification_icon: mdi:motorbike-electric
        channel: Mototec
        group: Mototec
      message: >-
        Fully Charged {{
        as_timestamp(states.automation.mototec_full_charge.attributes.last_triggered)
        | timestamp_custom("%-I:%M %p") }}
  - type: turn_off
    device_id: 1552b584aca87aadfdf42134a9f77ffa
    entity_id: 8029e6d02e88e5633c748bff64cc89aa
    domain: switch
mode: single

The automation triggered last night. A notification was sent to my phone, but the switch was not turned off, although the trace for the automation identifies that the switch was turned off.

When I manually run the automation (Run actions from within the automation editor), the notification is sent, but the switch does not turn off.

When I only run the Switch Turn Off action from within the automation, it does turn off the switch.

Why did the switch not turn off when the full automation runs?

I don't see anything off in the automation trace log:

{
  "trace": {
    "last_step": "action/1",
    "run_id": "9b263e6ff472926e7234b3276fba713f",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2026-05-24T06:16:20.968256+00:00",
      "finish": "2026-05-24T06:16:21.194588+00:00"
    },
    "domain": "automation",
    "item_id": "1779149717368",
    "trigger": "numeric state of sensor.mototec_charger_electric_consumption_a",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2026-05-24T06:16:20.968437+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.mototec_full_charge",
              "state": "on",
              "attributes": {
                "id": "1779149717368",
                "last_triggered": null,
                "mode": "single",
                "current": 0,
                "friendly_name": "Mototec Full Charge"
              },
              "last_changed": "2026-05-19T15:44:54.819401+00:00",
              "last_reported": "2026-05-19T15:44:54.819401+00:00",
              "last_updated": "2026-05-19T15:44:54.819401+00:00",
              "context": {
                "id": "01KS0EJP13XCM87CKSZT8A7YEF",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "numeric_state",
              "entity_id": "sensor.mototec_charger_electric_consumption_a",
              "below": 0.3,
              "above": null,
              "from_state": {
                "entity_id": "sensor.mototec_charger_electric_consumption_a",
                "state": "0.34",
                "attributes": {
                  "state_class": "measurement",
                  "meter_type": 1,
                  "meter_type_name": "ELECTRIC",
                  "unit_of_measurement": "A",
                  "device_class": "current",
                  "friendly_name": "Mototec Charger Electric Consumption [A]"
                },
                "last_changed": "2026-05-24T06:06:20.280924+00:00",
                "last_reported": "2026-05-24T06:06:20.280924+00:00",
                "last_updated": "2026-05-24T06:06:20.280924+00:00",
                "context": {
                  "id": "01KSC9EW3RXW8AD2XY5VZAEF22",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "sensor.mototec_charger_electric_consumption_a",
                "state": "0.28",
                "attributes": {
                  "state_class": "measurement",
                  "meter_type": 1,
                  "meter_type_name": "ELECTRIC",
                  "unit_of_measurement": "A",
                  "device_class": "current",
                  "friendly_name": "Mototec Charger Electric Consumption [A]"
                },
                "last_changed": "2026-05-24T06:11:20.966348+00:00",
                "last_reported": "2026-05-24T06:11:20.966348+00:00",
                "last_updated": "2026-05-24T06:11:20.966348+00:00",
                "context": {
                  "id": "01KSC9R1R6N7CH68SB3YETHR1F",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": {
                "__type": "<class 'datetime.timedelta'>",
                "total_seconds": 300
              },
              "description": "numeric state of sensor.mototec_charger_electric_consumption_a"
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2026-05-24T06:16:20.968561+00:00",
          "result": {
            "result": true,
            "entities": [
              "sensor.uptime"
            ]
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2026-05-24T06:16:20.970614+00:00",
          "changed_variables": {
            "context": {
              "id": "01KSCA16Q8J88EHM9AVAMV41WG",
              "parent_id": "01KSC9R1R6N7CH68SB3YETHR1F",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "notify",
              "service": "mobile_app_chris",
              "service_data": {
                "title": "Mototec",
                "data": {
                  "notification_icon": "mdi:motorbike-electric",
                  "channel": "Mototec",
                  "group": "Mototec"
                },
                "message": "Fully Charged 12:16 AM"
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2026-05-24T06:16:21.192223+00:00"
        }
      ]
    },
    "config": {
      "id": "1779149717368",
      "alias": "Mototec Full Charge",
      "description": "",
      "triggers": [
        {
          "trigger": "numeric_state",
          "entity_id": [
            "sensor.mototec_charger_electric_consumption_a"
          ],
          "below": 0.3,
          "for": {
            "hours": 0,
            "minutes": 5,
            "seconds": 0
          }
        }
      ],
      "conditions": [
        {
          "condition": "template",
          "value_template": "{{\n  now() - as_datetime(states('sensor.uptime'))\n  > timedelta(minutes=5)\n}}\n"
        }
      ],
      "actions": [
        {
          "action": "notify.mobile_app_chris",
          "metadata": {},
          "data": {
            "title": "Mototec",
            "data": {
              "notification_icon": "mdi:motorbike-electric",
              "channel": "Mototec",
              "group": "Mototec"
            },
            "message": "Fully Charged {{ as_timestamp(states.automation.mototec_full_charge.attributes.last_triggered) | timestamp_custom(\"%-I:%M %p\") }}"
          }
        },
        {
          "type": "turn_off",
          "device_id": "1552b584aca87aadfdf42134a9f77ffa",
          "entity_id": "8029e6d02e88e5633c748bff64cc89aa",
          "domain": "switch"
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01KSCA16Q8J88EHM9AVAMV41WG",
      "parent_id": "01KSC9R1R6N7CH68SB3YETHR1F",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Mototec Full Charge",
      "message": "triggered by numeric state of sensor.mototec_charger_electric_consumption_a",
      "source": "numeric state of sensor.mototec_charger_electric_consumption_a",
      "entity_id": "automation.mototec_full_charge",
      "context_id": "01KSCA16Q8J88EHM9AVAMV41WG",
      "domain": "automation",
      "when": 1779603380.969949
    }
  ]
}

The result of this:

Appears to be this:

I actually never use device actions because I have no idea how to troubleshoot them.
Maybe try a state action? Why and how to avoid device_ids in automations and scripts