Ewelink icon

Ewelink

Consume Ewelink API

Overview

The Ewelink node for n8n allows you to interact with eWeLink-compatible smart devices via the eWeLink API. Specifically, for the Device resource and the Toggle State operation (corresponding to toggleDevice), this node enables you to toggle the power state (on/off) of a specified device by its Device ID.

Common scenarios:

  • Automating the switching on or off of smart plugs, lights, or other IoT devices.
  • Integrating device toggling into larger automation workflows (e.g., turning off all devices at night).
  • Remotely controlling devices based on triggers from other systems.

Practical example:
You could use this node in a workflow that turns on a heater when the temperature drops below a certain threshold, or toggles a lamp when a motion sensor is triggered.


Properties

Name Type Meaning
Device ID String The unique identifier of the device to toggle. Required to specify which device's state should be changed.

Output

The output will be a JSON object containing the result of the toggle operation as returned by the eWeLink API. Typical fields may include:

  • status: Indicates success or failure of the operation.
  • deviceid: The ID of the device affected.
  • params: Details about the new state of the device.
  • error (optional): If an error occurred, this field will contain the error message.

Example output:

{
  "status": "ok",
  "deviceid": "1000abcdef",
  "params": {
    "switch": "on"
  }
}

If an error occurs and "Continue On Fail" is enabled:

{
  "error": "Device not found"
}

Dependencies

  • External Service: Requires access to the eWeLink API.
  • Credentials: You must configure eWeLink account credentials (email and password) in n8n under the "ewelinkApi" credential type.
  • n8n Configuration: No special environment variables are required beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid Credentials: If your email or password is incorrect, authentication will fail.

    • Error message: Auth settings are not valid: Authentication failed - status 406
    • Resolution: Double-check your eWeLink account credentials in n8n.
  • Device Not Found: If the provided Device ID does not exist or is not accessible.

    • Error message: "Device not found" (or similar, depending on API response)
    • Resolution: Ensure the Device ID is correct and that your account has access to it.
  • API Rate Limits or Connectivity Issues: May cause intermittent failures.

    • Resolution: Retry after some time or check network connectivity.

Links and References

Discussion