User-Defined vs Template Workflows
Understand the difference between user-defined workflows and template workflows, and when to use each.
In CORE, workflows can be created at two different levels: user-defined workflows and template workflows. Understanding the difference between these two types is essential for building efficient, maintainable automations.
Overview
| Aspect | User-Defined Workflows | Template Workflows |
|---|---|---|
| Scope | Specific to one device instance | Applied to all devices using the template |
| Location | Created on individual devices | Created on the device template |
| Inheritance | Not inherited | Automatically available on all devices |
| Customization | Unique per device | Shared across all devices |
| Use Case | Device-specific logic | Standard logic for all devices |
User-Defined Workflows
User-defined workflows are created on individual device instances. They are specific to that device and do not affect any other device.
When to Use User-Defined Workflows
Use user-defined workflows when the automation logic is unique to a specific device:
- Device-specific integrations — A device that connects to a unique external API
- Custom alerts — Alerts that only apply to certain devices
- One-off automations — Workflows that shouldn't run on all devices
- Testing — Experiment with new workflow logic on a single device before applying to the template
Example
You have 100 temperature sensors, but one of them is connected to a special external reporting system that the others aren't. You would create a user-defined workflow on that specific device to handle the external reporting.
Characteristics
- Created and managed in the device view
- Only runs on the device it's created for
- Can be modified without affecting other devices
- Must be created individually on each device that needs it
Template Workflows
Template workflows are created on the device template. They are automatically available on all devices that are created from that template.
When to Use Template Workflows
Use template workflows when the automation logic should apply to all devices of a certain type:
- Standard data processing — All devices need the same data transformation
- Common alerts — All devices should alert on the same conditions
- Default integrations — All devices send data to the same external system
- Baseline automations — Standard workflows that all devices should have
Example
All your temperature sensors should send an alert when the temperature exceeds 30°C. This is a template workflow because it applies to every device of that type.
Characteristics
- Created and managed in the device template view
- Automatically available on all devices created from the template
- Changes to the template workflow affect all existing devices
- Provides a consistent baseline for all devices
Key Differences
Scope and Reach
Template Workflow:
Device Template → "Temperature Alert"
↓ (applied to all devices)
Device A → Has "Temperature Alert"
Device B → Has "Temperature Alert"
Device C → Has "Temperature Alert"
User-Defined Workflow:
Device A → "Temperature Alert" (template)
Device B → "Temperature Alert" (template)
Device C → "Temperature Alert" (template)
↓ (additional workflow)
Device B → "Special Integration" (user-defined only)Modification Impact
| Action | Template Workflow | User-Defined Workflow |
|---|---|---|
| Edit | Affects all devices | Affects only one device |
| Delete | Removes from all devices | Removes from one device |
| Create | New devices get it automatically | Must be created per device |
Customization
- Template workflows provide consistency across all devices
- User-defined workflows allow device-specific customization
- Both can coexist on the same device
Combining Both Types
A single device can have both template workflows and user-defined workflows:
- Template workflows provide the baseline automation that all devices share
- User-defined workflows add device-specific logic on top of the template
This combination gives you the best of both worlds:
- Consistency — All devices have the same core automations
- Flexibility — Individual devices can have unique behavior when needed
Best Practices
1. Start with Template Workflows
Create standard automations as template workflows first. This ensures all devices have the baseline functionality.
2. Add User-Defined Workflows Only When Needed
Don't create user-defined workflows unless there's a specific reason. Overuse leads to:
- Increased maintenance overhead
- Inconsistent behavior across devices
- Difficulty tracking which workflows run where
3. Document Your Workflows
Clearly document which workflows are template-based and which are user-defined:
Template: "Standard Temperature Alert" — applies to all devices
User-Defined: "Custom API Sync" — only on Device X4. Plan for Scalability
Consider how your workflow strategy scales:
- Template workflows scale automatically with new devices
- User-defined workflows require manual setup on each device
- For large deployments, prefer template workflows when possible
5. Test Template Changes Carefully
Since template workflow changes affect all devices:
- Test changes on a single device first
- Review the impact on existing devices
- Consider rolling out changes gradually
Migration Guide
Converting User-Defined to Template
If you find yourself creating the same user-defined workflow on multiple devices:
- Copy the workflow from one device
- Create it as a template workflow
- Remove the user-defined workflows from individual devices
- Verify all devices are working correctly
Converting Template to User-Defined
If a template workflow needs to be device-specific:
- Copy the workflow from the template
- Create it as a user-defined workflow on the target device
- Remove or modify the template workflow
- Update any other devices that still need the original template workflow
Summary
| Choose Template Workflows When | Choose User-Defined Workflows When |
|---|---|
| Logic applies to all devices | Logic is device-specific |
| You want consistency across devices | You need customization |
| You want automatic provisioning | You're testing new logic |
| You have many devices | You have few devices |
| The logic is standardized | The logic is unique |