Ewelink icon

Ewelink

Consume Ewelink API

Overview

This node interacts with the eWeLink API to retrieve the number of channels available on a specific device. The "Get Channel Count" operation is useful for scenarios where you need to programmatically determine how many controllable channels (such as relays or switches) a smart device supports. This can be beneficial when automating device management, dynamically configuring workflows based on device capabilities, or validating device configurations.

Example use cases:

  • Automatically mapping out multi-channel smart switches in a home automation setup.
  • Validating that a device has the expected number of channels before sending control commands.
  • Building dashboards that display device capabilities.

Properties

Name Type Meaning
Device ID String Unique identifier of the device whose channel count you want to retrieve.

Output

The output will be a JSON object containing the result from the eWeLink API's getDeviceChannelCount method. While the exact structure depends on the API response, it typically includes information such as:

{
  "channelCount": 2,
  "deviceid": "1000abcdef",
  // ...other possible fields depending on the API response
}
  • channelCount: Number of channels supported by the specified device.
  • deviceid: The unique identifier of the device.

No binary data is returned by this operation.

Dependencies

  • External Service: Requires access to the eWeLink API.
  • Credentials: You must configure valid eWeLink account credentials (email and password) in n8n under the credential type ewelinkApi.
  • 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.
  • Device Not Found: Providing an invalid or non-existent Device ID will result in errors.
  • API Rate Limits: Excessive requests may be throttled by the eWeLink API.

Error Messages:

  • "Authentication failed" or "Auth settings are not valid: Authentication failed - status 406": Check your eWeLink credentials.
  • "Cannot read property '...' of undefined": Likely due to an incorrect Device ID or network/API issues.
  • General API Errors: Any error thrown by the underlying eWeLink API will be surfaced in the node’s output if "Continue On Fail" is enabled; otherwise, the workflow will stop.

How to resolve:

  • Double-check your credentials in n8n.
  • Verify the Device ID via the eWeLink app or API.
  • Ensure your account has access to the target device.

Links and References

Discussion