Actions10
Overview
This n8n node allows you to control the power state of a device managed via the eWeLink API. Specifically, with the "Device" resource and "Set Power State" operation, you can programmatically turn a device on or off by specifying its Device ID and desired power state. This is useful for automating smart home devices, scheduling device operations, or integrating device control into larger automation workflows.
Example scenarios:
- Turning on a smart plug at a scheduled time.
- Remotely switching off a device when certain conditions are met in your workflow.
- Integrating device power control with other sensors or triggers in your automation.
Properties
| Name | Type | Meaning |
|---|---|---|
| Device ID | String | The unique identifier of the device whose power state you want to set. |
| Device Power State | Boolean | The desired power state: true for ON, false for OFF. |
Output
The output will be a JSON object containing the response from the eWeLink API after attempting to set the device's power state. The structure typically includes:
{
"status": "ok",
"state": "on" // or "off"
}
status: Indicates if the operation was successful (e.g., "ok").state: The resulting power state of the device ("on" or "off").
If an error occurs and "Continue On Fail" is enabled, the output may include:
{
"error": "Error message here"
}
Dependencies
- External Service: Requires access to the eWeLink API.
- Credentials: You must provide valid eWeLink account credentials (email and password) via n8n's credential system (
ewelinkApi). - n8n Configuration: No special environment variables required beyond standard credential setup.
Troubleshooting
Common Issues:
- Invalid Credentials: If the email or password is incorrect, authentication will fail.
- Device Not Found: Providing an invalid Device ID will result in an error from the API.
- API Rate Limits: Excessive requests may be throttled by eWeLink.
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 missing parameter."Request failed with status code ...": Network or API-side issue; check connectivity and API status.
How to resolve:
- Double-check your credentials in n8n.
- Ensure the Device ID is correct and the device is online.
- Retry after some time if rate-limited.