Implementing IoT Device Scheduling and Automation via Mobile App
Imagine a smart home that turns on the lights at 07:00 Moscow time, but the owner flies to Vladivostok and the lights turn on at 05:00 local time. A common problem — incorrect timezone handling. We have been designing mobile interfaces for IoT for over 5 years, delivering 20+ projects — from household plugs to industrial controllers. One frequent request is flexible scheduling and automation that works without human intervention.
A schedule for an IoT device: "turn on light at 07:00, turn off at 23:00 on weekdays". Automation is more complex: "if temperature drops below +18°C and time between 22:00 and 08:00 — turn on heater". Both tasks are handled on the backend, but the mobile app must provide a UI for creating and editing them without instructions.
How to Implement Scheduling for an IoT Device?
Typical Schedule:
{ "device_id": "abc123", "action": "turn_on", "days_of_week": [1, 2, 3, 4, 5], "time": "07:00", "timezone": "Europe/Moscow", "enabled": true } Timezone is a mandatory field. Without it, the schedule will trigger incorrectly after a flight or with users from different regions. Store on the server in UTC, convert to the device/user timezone on display. According to Firebase documentation, this is standard practice.
UI for time selection on Android Compose — Material3 TimePicker or TimePickerDialog. Day selection — a horizontal row of chips with multi-select:
val days = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") var selectedDays by remember { mutableStateOf(setOf<Int>()) } Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { days.forEachIndexed { index, label -> FilterChip( selected = index + 1 in selectedDays, onClick = { selectedDays = if (index + 1 in selectedDays) selectedDays - (index + 1) else selectedDays + (index + 1) }, label = { Text(label) } ) } } Display the schedule list with LazyColumn and allow toggling each schedule via Switch without opening the editor. Send a PATCH request with only enabled = false — not the whole object.
What is the Difference Between Schedule and Automation?
| Feature | Schedule | Automation (ECA) |
|---|---|---|
| Trigger | Fixed time | Event (sensor, time, status) |
| Conditions | None | Additional checks (time, other devices) |
| Action | Single command | One or multiple commands |
| Control | Enable/disable | Create, edit, delete |
Why is Automation More Complex Than Simple Scheduling?
Automations follow the ECA model (Event-Condition-Action):
- Event (trigger): sensor value crosses threshold, time arrives, device changes status
- Condition: current time is within range, another device is online
- Action: send command to device, send notification, call webhook
Stored as JSON on the server:
{ "trigger": { "type": "sensor_value", "device_id": "temp_sensor_1", "parameter": "temperature", "operator": "lt", "value": 18 }, "conditions": [ { "type": "time_range", "from": "22:00", "to": "08:00" } ], "actions": [ { "type": "device_command", "device_id": "heater_1", "command": "turn_on" } ] } Logic execution is on the server. The mobile app only creates and edits automations, not execute them.
UI for Automation Builder
A drag-and-drop builder is complex and overkill for most scenarios. A step-by-step wizard is simpler. Compare:
| Feature | Drag-and-drop builder | Step-by-step wizard |
|---|---|---|
| Learning time | 15–20 minutes | 3–5 minutes (3–4x faster) |
| User errors | Frequent (missing required fields) | Rare (sequential validation) |
| Best for | Advanced users | All users |
Step 1 — Trigger. Select device → select parameter → condition (greater/less/equal) → value. Or select "By schedule".
Step 2 — Conditions (optional). "Add condition" → choose type (time, day of week, status of another device).
Step 3 — Action. Select device → select command. Option to add multiple actions. Step 4 — Name and save.
Each step validates separately. Cannot proceed to next without filling required fields — show inline error, do not block the whole app.
How to Debug Automations?
Users create automations and don't understand why they didn't trigger. An execution log is mandatory. Each trigger → record in history: triggered/not, why, which action was performed.
Example log
14:32 · Temperature dropped to 16.8°C ✓ Condition: time 22:00–08:00 — not met (current time 14:32) ✗ Automation did not trigger Such a log reduces support queries — up to 40% savings on support resources.
Schedule Conflicts
Two schedules on the same device may conflict: first turns on at 07:00, second turns off at 07:30, third turns on at 07:15. The server needs conflict resolution logic — the last command by time wins. In the UI — warn the user when creating overlapping schedules.
What is Included in the Work
Implementation of scheduling with a step-by-step wizard: 3–4 weeks. Full automation builder with conditions and execution log: 6–8 weeks. Pricing is individual. Contact us to get a consultation and project plan.
Process
- Analysis — clarify use cases, number of devices, and types of automations.
- Design — develop data model, API, and UI architecture.
- Implementation — write backend logic and mobile interface.
- Testing — test on real devices, emulate conflicts and edge cases.
- Deployment — publish to App Store and Google Play, configure push notifications.
We guarantee post-launch support and documentation of all components. Get an engineer consultation to make your IoT product convenient and reliable.







