Block: Conditional ​
Type: io_controls_if
Create smart decision-making logic for your IoT Actions using if/then/else statements. Perfect for building automation like 'if temperature > 80°F then turn on fan, else if temperature < 60°F then turn on heater, else turn off both'. Essential for creating intelligent responses based on sensor data, time conditions, or any combination of factors.
Inputs ​
If
​
This condition will always be checked first. Connect comparison blocks, sensor checks, or any logic that results in true/false. If it evaluates to true
, the actions in the corresponding 'do' section will execute, and the rest of the conditional block will be skipped. If false
, execution moves to the next "else if" (if present), or the final "else" (if present).
Examples:
temperature > 80
- Check if it's hotmotion detected AND time after sunset
- Security logicbattery level < 15%
- Low power warning
Do
​
The actions to execute when the preceding "if" or "else if" condition is true
. Connect any action blocks like sending emails, controlling devices, publishing to feeds, or logging data. These actions only run if their corresponding condition evaluates to true.
Examples:
- Send alert email + turn on cooling fan
- Log warning message + publish backup data
- Turn on lights + send notification
Else if
​
Optional: Add additional conditions to test if the main "if" was false. Click the gear icon and select "+ else if" to add more branches. Each "else if" is only checked if all previous conditions were false. Perfect for handling multiple scenarios like different temperature ranges, various alert levels, or time-based alternatives.
Examples:
else if temperature < 60
→ turn on heaterelse if battery < 50%
→ reduce power consumptionelse if motion detected
→ different security response
Else
​
Optional: The fallback section that executes when ALL "if" and "else if" conditions are false. Click the gear icon and select "+ else" to add this section. Perfect for default actions, error handling, or "normal operation" behavior.
Examples:
- Turn off all climate control (temperature is in normal range)
- Send "all systems normal" status update
- Resume regular power consumption mode