Skip to content

Conversation

@mirkoCrobu
Copy link
Contributor

Motivation

closes #89

When a brick is assigned to an app, the FE must show the list of other compatible models for the installed brick.
For example when a new model is selected for a given brick installed into an app.

Change Description

 curl 127.0.0.1:8800/v1/apps/ZXhhbXBsZXM6dmlkZW8tZmFjZS1kZXRlY3Rpb24/bricks/arduino:video_object_detection 
{
  "id": "arduino:video_object_detection",
  "name": "Video Object Detection",
  "author": "Arduino",
  "category": "",
  "status": "installed",
  "variables": {
    "CUSTOM_MODEL_PATH": "/home/arduino/.arduino-bricks/ei-models/",
    "EI_OBJ_DETECTION_MODEL": "/models/ootb/ei/yolo-x-nano.eim",
    "VIDEO_DEVICE": "/dev/video1"
  },
  "config_variables": [
    {
      "name": "CUSTOM_MODEL_PATH",
      "value": "/home/arduino/.arduino-bricks/ei-models/",
      "description": "path to the custom model directory",
      "required": false
    },
    {
      "name": "EI_OBJ_DETECTION_MODEL",
      "value": "/models/ootb/ei/yolo-x-nano.eim",
      "description": "path to the model file",
      "required": false
    },
    {
      "name": "VIDEO_DEVICE",
      "value": "/dev/video1",
      "description": "",
      "required": false
    }
  ],
  "model": "face-detection"

   // the list of compatible models for the brick with minimal info.
   "models":[
       {
        "id": "yolox-object-detection",
        "name": "General purpose object detection - YoloX",
        "description": "",
  
         // TODO: what to show in the  "more info" button? Maybe only the "url"? 
      },
      {
        "id": "face-detection",
        "name": "Lightweight-Face-Detection",
        "description": "Face bounding box detection. This model is trained on the WIDER FACE dataset and can detect faces in images.",
      },
    },
    {
      "id": "arduino:web_ui",
      "name": "WebUI - HTML",
      "author": "Arduino",
      "category": "ui",
      "status": "installed"
    }
  ]
}

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

@mirkoCrobu
Copy link
Contributor Author

Response:

GET http://localhost:8080/v1/apps/ZXhhbXBsZXM6aW1hZ2UtY2xhc3NpZmljYXRpb24/bricks/arduino:image_classification

{
    "id": "arduino:image_classification",
    "name": "Image Classification",
    "author": "Arduino",
    "category": "video",
    "status": "installed",
    "variables": {
        "CUSTOM_MODEL_PATH": "/home/arduino/.arduino-bricks/ei-models",
        "EI_CLASSIFICATION_MODEL": "/models/ootb/ei/mobilenet-v2-224px.eim"
    },
    "config_variables": [
        {
            "name": "CUSTOM_MODEL_PATH",
            "value": "/home/arduino/.arduino-bricks/ei-models",
            "description": "path to the custom model directory",
            "required": false
        },
        {
            "name": "EI_CLASSIFICATION_MODEL",
            "value": "/models/ootb/ei/mobilenet-v2-224px.eim",
            "description": "path to the model file",
            "required": false
        }
    ],
    "model": "mobilenet-image-classification",
    "compatible_models": [
        {
            "id": "mobilenet-image-classification",
            "name": "General purpose image classification",
            "description": "General purpose image classification model based on MobileNetV2. This model is trained on the ImageNet dataset and can classify images into 1000 categories."
        },
        {
            "id": "person-classification",
            "name": "Person classification",
            "description": "Person classification model based on WakeVision dataset. This model is trained to classify images into two categories: person and not-person."
        }
    ]
}

@mirkoCrobu
Copy link
Contributor Author

In the compatible_models section, should we also include the current model used, specified in the model field?
What do you think, @dido18? Should we check with the Design team?

@mirkoCrobu mirkoCrobu self-assigned this Nov 24, 2025
@lucarin91 lucarin91 marked this pull request as ready for review November 24, 2025 13:58
@Xayton
Copy link
Contributor

Xayton commented Nov 24, 2025

In the compatible_models section, should we also include the current model used, specified in the model field? What do you think, @dido18? Should we check with the Design team?

We discussed it and the answer is yes.

@mirkoCrobu mirkoCrobu requested a review from dido18 November 25, 2025 14:13
@mirkoCrobu mirkoCrobu changed the title add compatible models in brickinstance details [API] Add compatible models in brickinstance details Nov 26, 2025
@mirkoCrobu mirkoCrobu force-pushed the issue_89_add_models_brick_instaces branch from d30ff4d to 6ce75f0 Compare November 26, 2025 08:59
@mirkoCrobu
Copy link
Contributor Author

mirkoCrobu commented Nov 26, 2025

Update field from "models" to "compatible_models" in GET /v1/brick/{brick_id} to keep it consistent with the "compatible_models" field in brick instances:

{
    "id": "arduino:arduino_cloud",
    "name": "Arduino Cloud",
    "author": "Arduino",
    "description": "Connects to Arduino Cloud",
    "category": "",
    "status": "installed",
    "variables": {
        "ARDUINO_DEVICE_ID": {
            "description": "Arduino Cloud Device ID",
            "required": true
        },
        "ARDUINO_SECRET": {
            "description": "Arduino Cloud Secret",
            "required": true
        }
    },
    "readme": "# Arduino Cloud Brick\n\nThis Brick provides integration with the Arduino Cloud platform, enabling IoT devices to communicate and synchronize data seamlessly.\n\n## Overview\n\nThe Arduino Cloud Brick simplifies the process of connecting your Arduino device to the Arduino Cloud. It abstracts the complexities of device management, authentication, and data synchronization, allowing developers to focus on building applications and features. With this module, you can easily register devices, exchange data, and leverage cloud-based automation for your projects.\n\n## Features\n\n- Connects Arduino devices to the Arduino Cloud\n- Supports device registration and authentication\n- Enables data exchange between devices and the cloud\n- Provides APIs for sending and receiving data\n\n## Prerequisites\n\nTo use this Brick, we need to have an active Arduino Cloud account, and a **device** and **thing** setup. To obtain the credentials, please follow the instructions at this [link](https://docs.arduino.cc/arduino-cloud/features/manual-device/). This is also covered in the [Blinking LED with Arduino Cloud](/examples/cloud-blink).\n\nDuring the device configuration, we will obtain a `device_id` and `secret_key`, which is needed to use this Brick. Note that a Thing with the device associated is required, and that you will need to create variables / dashboard to send and receive data from the board.\n\n### Adding Credentials\n\nThe `device_id` and `secret_key` can be added inside the Arduino Cloud brick, by clicking on the **Brick Configuration** button inside the Brick.\n\nClicking the button will provide two fields where the `device_id` and `secret_key` can be added to the Brick.\n\n## Code Example and Usage\n\n```python\nfrom arduino.app_bricks.arduino_cloud import ArduinoCloud\nfrom arduino.app_utils import App, Bridge\n\niot_cloud = ArduinoCloud()\n\ndef led_callback(client: object, value: bool):\n    \"\"\"Callback function to handle LED blink updates from cloud.\"\"\"\n    print(f\"LED blink value updated from cloud: {value}\")\n    Bridge.call(\"set_led_state\", value)\n\niot_cloud.register(\"led\", value=False, on_write=led_callback)\n\nApp.run()\n```",
    "api_docs_path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.5.0/api-docs/arduino/app_bricks/arduino_cloud/API.md",
    "code_examples": [
        {
            "path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.5.0/examples/arduino/arduino_cloud/1_led_blink.py"
        },
        {
            "path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.5.0/examples/arduino/arduino_cloud/2_light_with_colors_monitor.py"
        },
        {
            "path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.5.0/examples/arduino/arduino_cloud/3_light_with_colors_command.py"
        },
        {
            "path": "/home/mirkocrobu/.config/arduino-app-cli/assets/0.5.0/examples/arduino/arduino_cloud/__pycache__"
        }
    ],
    "used_by_apps": [
        {
            "id": "ZXhhbXBsZXM6Y2xvdWQtYmxpbms",
            "name": "Blinking LED from Arduino Cloud",
            "icon": "☁️"
        },
        {
            "id": "dXNlcjpleGFtcGxlcy9jbG91ZC1ibGluaw",
            "name": "Blinking LED from Arduino Cloud",
            "icon": "☁️"
        }
    ],
    "compatible_models": []
}

Copy link
Contributor

@dido18 dido18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mirkoCrobu mirkoCrobu merged commit 3d8b8ea into main Nov 26, 2025
6 checks passed
@mirkoCrobu mirkoCrobu deleted the issue_89_add_models_brick_instaces branch November 26, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api: add compatible models in the app brick details

3 participants