How to use ScheDuler IoT (Quick Start)
(Do not Enter Real Info as it's a demo project.)
Step-by-step demo instructions to add devices and control switches from the web.
1. Create account & Login
- Sign up via
signup. You’ll be shown a recovery code — copy it and keep it safe. - Login from the main page or the drawer. After login you land on
profile. - On successfull signup your data are stored safely using
secret session tokensfor better security.
2. Add & Connect a Device
- Open Profile → go to Devices section.
- Type a friendly device name or the device IP into the box and click Connect. This stores a demo connection in the site DB.
- Connected device is saved in
localStorageonly for demo convenience — the worker/API also records a connection entry. - If you want to disconnect, click the ❌ button next to Connect.
3. Add Switches (max 5 for demo)
- In Profile → Switches enter a label (e.g. Room Light) and click Add Switch.
- Each label is unique per user. The API enforces up to 5 switches per user.
- New switch default state:
off. You can toggle it after creation.
4. Turn On / Off — How it works
- Click the Turn On / Turn Off button next to a switch. The UI updates the state and calls your API:
- That API updates the database. For demo mode there is no direct hardware control until an actual ESP device polls the server or implement Websocket(see Polling section).
- If disconneting device fails, then go to broswers settings>site settings>data stored> delete "https://schedulers.pages.dev" or clear broswer's data :).
- After Cloudflare wokers conversion, websocket will be implemented.
5. Rename & Remove
- Click Rename — edit inline then blur to save the new label. This calls the API with
renameTo. - Click Remove to delete the switch from your account (DELETE /api/esp).
- Removed switches are deleted from the DB. They will no longer appear for your account.
6. Polling (Demo → How the ESP reads commands)
- Polling means the ESP device periodically asks your server, “Any commands for me?” (example interval: 30s for demo).
- Polling works when the ESP is on the Internet (has Wi-Fi / SIM / NAT/port open depending on your setup). If the ESP is only on local network and not reachable, it cannot poll remotely.
- When the ESP polls, your server can return the desired pin state for each labeled switch and the ESP applies it to the GPIO pins.
- Important (demo): Polling consumes simple HTTP requests; if you set very short intervals and many devices, you can hit Cloudflare Pages/Workers request/build limits. For a demo, 30s is reasonable.
7. Quick Troubleshooting
- If switches aren't changing on the device, make sure the ESP is connected to the Internet and polling the API URL.
- If device shows “Not connected”, reconnect from the Profile → Devices box.
- Check browser console for API errors; your endpoints return helpful JSON messages.
About this Demo
This project is a lightweight demo to show how a web app can manage labeled switches,set timers, and control remote devices. It is intended for demonstrations and learning — As real polling ,websocket etc will induce charges.