docs: add initial requirements doc (wip)

This commit is contained in:
Anton Shubin 2024-07-29 21:04:40 +08:00
parent c165c6b470
commit cc0378a910

86
docs/requirements.md Normal file
View File

@ -0,0 +1,86 @@
# Gardens by the Bay - Light-control system
## Dictionary
- [**Gardens by the Bay**](https://maps.app.goo.gl/tGZcwxjbVSdzrRBi7): A nature park in Singapore that is home to a variety of plants and flowers. It is a popular tourist attraction and is known for its beautiful gardens and unique architecture.
- **Light-control system**: A system that controls the lighting of a specific area. Mostly it's about turning on and off the lights, like lamp posts.
- **Lamp**: A device that produces light. It is usually made of a bulb and a lampshade.
- **Motion sensor**: A device that detects movement and triggers an action, such as turning on a light.
- **Lamp post**: A tall post that has a light at the top. It is used to light up streets, parks, and other outdoor areas. A lamp post can have multiple lamps, motion sensors, and other devices attached to it.
- **Relay box**: A device that controls multiple lamps. It can turn the lamps on and off, dim them, and monitor their status. It can also collect data from sensors attached to the lamps.
- **Relay box status**: The current state of a lamps, such as on, off or malfunctioning.
- **Zone**: A specific area that is contains multiple relay boxes. For example, a park can be divided into multiple zones, each with its own set of relay boxes.
- **Schedule**: A plan that shows when events or tasks will happen. It can be used to schedule the turning on and off of groups of lamps at specific times.
- **Manual override**: A feature that allows a user to manually control a system, even if it is automated. For example, a user can manually turn on or off a lamp, even if it is scheduled to turn on or off at a specific time. Used for special events.
- **Role**: A set of permissions that define what a user can do in the system. For example, an admin role can create users and change system settings, while a user role can only view and control lamps.
- **Viewer Role**: A role that allows a user to view the system but not make any changes. For example, a viewer can see the status of lamps and view schedules, but cannot change the schedule or turn on or off lamps.
- **User Role**: A role that allows a user to maintain the system. For example, a user can receive notifications about failures, acknowledge them, and fix them. User can download exports of the data and configure manual bypasses.
- **Operator Role**: A role that allows a user to control the system. For example, an operator can turn on and off lamps, create schedules, add or remove devices.
- **Admin Role**: A role that allows a user to manage the system. For example, an admin can create users, assign roles, and change system settings.
- **2FA**: Two-factor authentication. A security feature that requires two forms of identification to sign in to a system. For example, a user may need to enter a password and a code from their OTP authenticator app to sign in.
- **Dashboard**: A visual representation of data. It can show the status of lamps, schedules, and other system information. It can also show graphs and charts of data collected from the system.
- **PWA**: Progressive Web App. A type of web application that is designed to work on mobile devices. It can be installed on a device and used offline.
## Requirements
### Authentication
- User is created by the Admin
- User can sign in and sign out using username and password.
- User have to use 2FA to sign in.
- User can change password in their profile settings page.
### User management
- Admin can create, update, delete users.
- TODO
### Realtime Dashboard
### Lamp management
- Lamps are grouped into packs of max 5 lamps. They are controlled together by a Relay box. The relay box electrically connects the lamps to the power source and can turn them on and off.
- Lamps can be of different lamp profiles - depends on their rated voltage, current, and power.
- Relay box can contain lamps of multiple lamp profiles.
- All relay boxes should be depicted on a map (like Google Maps), with lamp identifiers, status and realtime updates. In addition to map, there should be a list of all relay boxes.
- Relay boxes can have three statuses: Green for online, Yellow for offline according to schedule but operational, Red for malfunctioning, not operating as per schedule due to network issues or other reasons.
- Interval of relay boxes status update is 5 minutes.
- Metrics collected from relay boxes and nearby sensors are:
- Voltage
- Current
- Power
- Running hours (to be calculated from the timestamp of the last status update)
- Lux level
- Motion detection: 0 or 1 and timestamp of last trigger
- Brightness level: 0-100% for dimmable lamps
- Operator can add relay boxes, lamps, and sensors to the system. They can also update and delete them. Accurate GPS coordinates are required for each relay box and sensor.
- System should collect and store metrics for historical analysis.
### Data visualization and correlation
- Dashboard should show the status of all relay boxes and lamps in real-time. It should also show the metrics collected from the relay boxes and sensors as simple 2d graphs.
- Data should be downloadable in CSV or Excel format.
- Charts and data exports should be available per relay box, zone or globally.
- Charts should be able to show comparison of metrics between similar time periods.
### PWA mobile app
- Mobile friendly
- Push notifications