# API Routes ## Root route ("/") - Navigate to the root route to check if FastAPI has been setup correctly - **Response:** ```json { "message": "Welcome to the Smart Home API!" } ``` ## Device info route ("/device_info") - Navigate to `/device_info` to retrieve the JSON of all simulated smart home devices. - The response includes details like device ID, name, status, connection status, IP address, and other relevant properties. ## Change device Status ("/device/{id}/status") - Sending a `POST` request to this API randomly changes the specified status of a device. - The function `changeDeviceStatus` in `devices_json.py` handles this behavior. - **Request:** ```shell POST /device/{id}/status ``` - **Response Example:** ```json { "success": "Changed Status to on." } ``` ## Change device name ("/device/{id}/name/{new_name}") - Sending a `POST` request to this API changes the name of a device. - The function `changeDeviceName` in `devices_json.py` handles this behavior. - **Request:** ```shell POST /device/{id}/name/{new_name} ``` - **Response Example:** ```json { "success": "Changed device name to new_name." } ``` ## Get updates ("/updates") - Navigate to `/updates` to retrieve the list of updates. - The function `getUpdates` in `devices_json.py` handles this behavior. - **Response Example:** ```json { "updates": ["Update 1", "Update 2"] } ``` ## Change connection status ("/device/{id}/connect") - Sending a `POST` request to this API toggles the connection status of a device. - The function `changeConnection` in `devices_json.py` handles this behavior. - **Request:** ```shell POST /device/{id}/connect ``` - **Response Example:** ```json { "success": "Connected device_name." } ```