### LaMetric Goal Frame Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications An example of a 'goal' frame within the notification model, featuring an icon and specific goal data including start, current, end values, and unit. ```json { "icon": 120, "goalData":{ "start": 0, "current": 50, "end": 100, "unit": "%" } } ``` -------------------------------- ### Start Radio Playback on LaMetric (REST) Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps This REST example demonstrates how to start radio playback on a LaMetric device. It sends a POST request to the app's actions endpoint with the 'radio.play' action ID. The request includes necessary headers and the device IP address. ```http POST https://:4343/api/v2/device/apps/com.lametric.radio/widgets/589ed1b3fcdaa5180bf4848e55ba8061/actions Content-Type: application/json { "id": "radio.play" } ``` -------------------------------- ### Get Display State - GET Request Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-display Demonstrates how to retrieve the current state of the LaMetric device display using a GET request. This includes display properties like brightness, mode, size, and screensaver settings. The request requires basic authentication and is directed to the /api/v2/device/display endpoint. ```curl $ curl -X GET -u "dev" -k \ -H "Accept: application/json" \ https://:4343/api/v2/device/display $ Enter host password for user 'dev': ``` -------------------------------- ### LaMetric Custom URL Sound Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications An example of configuring a custom sound using a URL for an MP3 file, along with a fallback option. ```json { "url": "", "type": "mp3", "fallback": { "category": "notifications", "id": "cat" } } ``` -------------------------------- ### LaMetric Built-in Sound Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications An example of specifying a built-in sound for a notification, including category, sound ID, and repeat count. ```json { "category": "notifications", "id": "cat", "repeat": 1 } ``` -------------------------------- ### Get Display State - JSON Response Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-display Provides an example of the JSON response when querying the display state of a LaMetric device. The response includes detailed information about the display's brightness, its mode (auto/manual), pixel dimensions (width and height), type, and screensaver configuration. It also shows optional brightness range and limit details. ```json { "brightness": 100, "brightness_limit": { "max": 100, "min": 2 }, "brightness_range": { "max": 100, "min": 0 }, "brightness_mode": "auto", "height": 8, "width": 37, "type": "mixed", "screensaver": { "enabled": true, "modes": { "time_based": { "enabled": true, "end_time": "18:42:56", "start_time": "18:41:53", "start_local_time": "20:41:53", "end_local_time": "20:42:56" }, "when_dark": { "enabled": false } }, "widget": "08b8eac21074f8f7e5a29f2855ba8060" } } ``` -------------------------------- ### LaMetric Spike Chart Frame Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications An example of a 'spike chart' frame within the notification model, represented by an array of integer values to be displayed as a graph. ```json { "chartData": [ 1, 2, 3, 4, 5, 6, 7 ] } ``` -------------------------------- ### LaMetric Simple Frame Example Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications An example of a 'simple' frame within the notification model, consisting of an icon (ID or base64 data) and text content. ```json { "icon": "", "text": "Message" } ``` -------------------------------- ### Start Stream API Response (JSON) Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Example JSON response from the PUT /api/v2/device/stream/start endpoint, indicating successful stream initiation and providing session details. ```json { "success": { "data": { "canvas": { "fill_type": "scale", "render_mode": "pixel" }, "session_id": "a2891aa891ab4f8e8a1a16eb319b00f3", "status": "receiving", "port": 9999 }, "path": "/api/v2/device/stream/start" } } ``` -------------------------------- ### Get List of Installed Apps - REST API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps Retrieves a list of all applications currently installed on the LaMetric Time device. Each app is identified by its package name, and the response includes details about its vendor, version, and associated widgets. ```http GET https://:4343/api/v2/device/apps Accept: application/json ``` ```bash $ curl -X GET -u "dev" -k -H "Accept: application/json" \ https://:4343/api/v2/device/apps $ Enter host password for user 'dev': ``` -------------------------------- ### Start Stream API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Starts streaming content to the LaMetric device. Allows configuration of canvas rendering and post-processing effects. ```APIDOC ## PUT /api/v2/device/stream/start ### Description Starts streaming content to the LaMetric device. Allows configuration of canvas rendering and post-processing effects. ### Method PUT ### Endpoint /api/v2/device/stream/start ### Parameters #### Request Body - **canvas** (Object) - Required - Canvas configuration object. - **fill_type** (String) - Required - Valid values are `scale` and `tile`. `scale` scales content to fill the screen, `tile` tiles content to fill the screen. - **render_mode** (String) - Required - Valid values are `pixel` and `triangle`. `pixel` maps content pixels to device pixels, `triangle` maps content pixels to triangular pixel areas. - **post_process** (Object) - Optional - Controls post processing effects. - **type** (String) - Optional - Default: `none`. Valid values are `none` or `effect`. `none` applies no post processing, `effect` applies an effect. - **params** (Object) - Optional - Effect parameters. - **effect_type** (String) - Required - Only `fading_pixels` is currently supported. - **effect_params** (Object) - Required - Parameters of the specific effect. - **smooth** (Boolean) - Required - `true` for smooth pixel appearance, `false` for instant appearance. - **pixel_fill** (Integer) - Required - Fill area percentage, [0..1]. `1` means 100% area fill. - **fade_speed** (Float) - Required - Pixel brightness added per rendering cycle, [0..1]. - **pixel_base** (Float) - Required - Base pixel brightness, [0..1], where `0` is off and `1` is full brightness. ### Request Example ```json { "canvas": { "fill_type": "scale", "render_mode": "pixel", "post_process": { "type": "none" } } } ``` ### Response #### Success Response (200) - **success** (Object) - Success indicator. - **data** (Object) - Response data. - **canvas** (Object) - Canvas configuration. - **fill_type** (String) - Fill type used. - **render_mode** (String) - Render mode used. - **port** (Number) - UDP port for LMSP packets. - **session_id** (String) - Session ID for LaMetric Streaming Protocol. - **status** (String) - Current status (`receiving` or `stopped`). - **path** (String) - Endpoint path. #### Response Example ```json { "success": { "data": { "canvas": { "fill_type": "scale", "render_mode": "pixel" }, "session_id": "a2891aa891ab4f8e8a1a16eb319b00f3", "status": "receiving", "port": 9999 }, "path": "/api/v2/device/stream/start" } } ``` ``` -------------------------------- ### Start Stream API Request (JSON) Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Example JSON payload for the PUT /api/v2/device/stream/start endpoint, configuring canvas settings for streaming. ```json { "canvas": { "fill_type": "scale", "render_mode": "pixel", "post_process": { "type": "none" } } } ``` -------------------------------- ### Get List of Apps Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps Retrieves a list of all applications currently installed on the LaMetric Time device. Each app is uniquely identified by its package name, and devices can run multiple instances (widgets) of an app. ```APIDOC ## GET /api/v2/device/apps ### Description Returns a list of apps currently installed on LaMetric Time. Each app is identified by its package name. The device can run multiple instances of an app, referred to as widgets. There is at least one widget running for each app. ### Method GET ### Endpoint /api/v2/device/apps ### Response #### Success Response (200) - **package** (object) - An object where keys are package names of installed apps. - **package** (string) - The package name of the app. - **vendor** (string) - The vendor of the app. - **version** (string) - The version of the app. - **version_code** (string) - The version code of the app. - **widgets** (object) - An object containing app widgets. - **index** (integer) - The position of the widget. - **package** (string) - The package name of the app. - **visible** (boolean) - Indicates if the widget is visible (since API 2.3.0). - **actions** (object) - An object defining available actions for the app. - **[action_name]** (object) - An object representing a specific action. - **[parameter_name]** (object) - Details about an action parameter. - **data_type** (string) - The data type of the parameter (e.g., "bool", "int", "string"). - **name** (string) - The name of the parameter. - **format** (string) - A regular expression defining the parameter's format (optional). - **required** (boolean) - Indicates if the parameter is required. #### Response Example ```json { "com.lametric.clock": { "package": "com.lametric.clock", "vendor": "LaMetric", "version": "1.0.19", "version_code": "31", "actions": { "clock.alarm": { "enabled": { "data_type": "bool", "name": "enabled", "required": false }, "time": { "data_type": "string", "format": "[0-9]{2}:[0-9]{2}(?::[0-9]{2})?", "name": "time", "required": false }, "wake_with_radio": { "data_type": "bool", "name": "wake_with_radio", "required": false } } }, "widgets": { "08b8eac21074f8f7e5a29f2855ba8060": { "index": 0, "package": "com.lametric.clock", "visible": true } } }, "com.lametric.countdown": { ... }, "com.lametric.radio": { ... }, "com.lametric.stopwatch": { ... }, "com.lametric.weather": { ... } } ``` ``` -------------------------------- ### GET /api/v2/device/apps/:package Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps Retrieves detailed information about a specific installed application on the LaMetric device, identified by its package name. ```APIDOC ## GET /api/v2/device/apps/:package ### Description Returns information about a currently installed app identified by its package name. ### Method GET ### Endpoint `/api/v2/device/apps/:package` ### Parameters #### Path Parameters - **package** (string) - Required - The unique package name of the application. ### Request Example ```json { "example": "GET https://:4343/api/v2/device/apps/com.lametric.clock" } ``` ### Response #### Success Response (200) - **package** (string) - Unique identifier of the LaMetric Time native app. - **vendor** (string) - Name of the app creator. - **version** (string) - Version in format "..". For example 2.0.0 or 2.0.1. - **version_code** (string) - Version as number, like 1, 2, 3. Useful for easy comparison. - **actions** (map) - A map of actions this app supports. For example, clock support action that allows to configure alarm. - **[action_id]** (object) - Represents a specific action the app can perform. - **[parameter_id]** (object) - Details about a parameter for the action. - **data_type** (string) - One of [bool, int, string]. - **name** (string) - Name of the parameter. - **required** (boolean) - `true` if parameter is required or `false` otherwise. - **format** (string) - Optional. A regular expression that defines the format of a string parameter. - **widgets** (map) - A map of Widgets. A Widget is an instance of an app. For example, if you clone the Clock app, you’ll get two widgets representing each clock instance. - **[uuid]** (object) - Represents a specific widget instance. - **index** (integer) - Position of the widget when switching between them with buttons or API. Can be -1. - **package** (string) - ID of the LaMetric Time app this widget is an instance of. - **visible** (boolean) - Since API 2.3.0. True if widget is currently displayed on the screen, false otherwise. #### Response Example ```json { "package": "com.lametric.clock", "vendor": "LaMetric", "version": "1.0.19", "version_code": "31", "actions": { "clock.alarm": { "enabled": { "data_type": "bool", "name": "enabled", "required": false }, "time": { "data_type": "string", "format": "[0-9]{2}:[0-9]{2}(?::[0-9]{2})?", "name": "time", "required": false }, "wake_with_radio": { "data_type": "bool", "name": "wake_with_radio", "required": false } } }, "widgets": { "08b8eac21074f8f7e5a29f2855ba8060": { "index": 0, "package": "com.lametric.clock", "visible": true } } } ``` ``` -------------------------------- ### Configure LaMetric Countdown Timer Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps Example for configuring the countdown timer app on LaMetric Time. This action allows setting the duration in seconds and optionally starting the countdown immediately. It requires the countdown app package. ```json { "id":"countdown.configure", "params": { "duration":1800, "start_now":false } } ``` -------------------------------- ### Start Stream Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Initiates a streaming session to the LaMetric device, configuring canvas settings. ```APIDOC ## PUT /api/v2/device/stream/start ### Description Starts a streaming session to the LaMetric device. This endpoint configures how content will be rendered on the canvas. ### Method PUT ### Endpoint /api/v2/device/stream/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **canvas** (object) - Configuration for the canvas rendering. - **fill_type** (string) - How content should fit the canvas (e.g., 'scale'). - **render_mode** (string) - The rendering mode (e.g., 'pixel'). - **post_process** (object) - Post-processing effects for the stream. - **type** (string) - Type of post-processing (e.g., 'none'). ### Request Example ``` PUT /api/v2/device/stream/start HTTP/1.1 Host: 192.168.170.83:4343 Authorization: Basic ")> Accept: application/json Content-Type: application/json Content-Length: 481 { "canvas": { "fill_type": "scale", "render_mode": "pixel", "post_process": { "type": "none" } } } ``` ### Response #### Success Response (200) - **success** (object) - Indicates a successful operation. - **data** (object) - Contains details of the started stream. - **canvas** (object) - Current canvas configuration. - **fill_type** (string) - Fill type used. - **render_mode** (string) - Render mode used. - **port** (integer) - The port number to send UDP packets to. - **session_id** (string) - The unique identifier for this streaming session. - **status** (string) - The current status of the stream ('receiving'). - **path** (string) - The endpoint path that was called. #### Response Example ```json { "success": { "data": { "canvas": { "fill_type": "scale", "render_mode": "pixel" }, "port": 9999, "session_id": "a2891aa891ab4f8e8a1a16eb319b00f3", "status": "receiving" }, "path": "/api/v2/device/stream/start" } } ``` ``` -------------------------------- ### LaMetric Device Description XML Structure Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery This is an example of the XML structure returned when requesting the device description. It includes details like device type, friendly name, manufacturer, and model information. ```xml 1 0 https://192.168.88.153:443 urn:schemas-upnp-org:device:LaMetric:1 LaMetric (LM1419) Smart Atoms Inc. http://www.smartatoms.com LaMetric - internet connected ticker witn UPnP SSDP support LaMetric Battery Edition SA01 http://www.lametric.com SA150800000100W00BP9 1 uuid:b2d83c5d-6012-4857-916e-6238ca6cab4e ``` -------------------------------- ### GET Request for Icons with Parameters Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/cloud-icons Illustrates a GET request to the /api/v2/icons endpoint with query parameters for pagination (page, page_size), field filtering, and sorting (order). This allows for more specific data retrieval. ```http GET https://developer.lametric.com/api/v2/icons?page=1&page_size=2&fields=id,title,url&order=newest ``` -------------------------------- ### PUT /api/v2/device/stream/start Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Starts streaming to the LaMetric device. This endpoint allows configuration of render mode, fill type, and post-processing effects before streaming begins. ```APIDOC ## PUT /api/v2/device/stream/start ### Description Starts streaming to the LaMetric device. This method also allows to configure some aspects of the streaming, like: Render mode, Fill Type, Post processing. ### Method PUT ### Endpoint /api/v2/device/stream/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **render_mode** (string) - Optional - Specifies the render mode. Supported values: `pixel`, `triangle`. * **fill_type** (string) - Optional - Specifies the fill type for upscaling or tiling content. Possible values depend on implementation (e.g., `tile`, `scale`). * **post_processing** (object) - Optional - Specifies post-processing effects. * **effect** (string) - Optional - Name of the effect to apply. Currently supported: `fading_pixels`. ### Request Example ```json { "render_mode": "pixel", "fill_type": "tile", "post_processing": { "effect": "fading_pixels" } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the stream has started. #### Response Example ```json { "message": "Streaming started successfully." } ``` ``` -------------------------------- ### HTTP Request: Start Stream Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream This snippet demonstrates an HTTP PUT request to start a data stream on the LaMetric device. It specifies the canvas fill type, render mode, and post-processing effects. The request body is JSON, and it requires the device's API key for authentication. The response includes the port and session ID needed for UDP communication. ```http PUT /api/v2/device/stream/start HTTP/1.1 Host: 192.168.170.83:4343 Authorization: Basic ")> Accept: application/json Content-Type: application/json Content-Length: 481 { "canvas": { "fill_type": "scale", "render_mode": "pixel", "post_process": { "type": "none" } } } ``` -------------------------------- ### GET /api/v2/users/me/devices Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/cloud-users Fetches a list of all devices associated with the user's account, providing details for each device. ```APIDOC ## GET /api/v2/users/me/devices ### Description Gets the list of all devices connected to the user’s account. ### Method GET ### Endpoint /api/v2/users/me/devices ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) - **id** (Integer) - Device id - **name** (String) - Device name - **state** (String) - Device state. Valid values are “new”, “configured” or “banned”. - **serial_number** (String) - Device serial number - **api_key** (String) - Key that is used as access token to access device’s API in local network - **ipv4_internal** (String) - IP address of the device in local network - **mac** (String) - Mac address of the device - **wifi_ssid** (String) - Name of the wi-fi access point the device is connected to #### Response Example ```json [ { "id": 18, "name": "My LaMetric", "state": "configured", "serial_number": "SA140100002200W00BS9", "api_key": "8adaa0c98278dbb1ecb218d1c3e11f9312317ba474ab3361f80c0bd4f13a6749", "ipv4_internal": "192.168.0.128", "mac": "58:63:56:10:D6:30", "wifi_ssid": "homewifi", "created_at": "2015-03-06T15:15:55+02:00", "updated_at": "2016-06-14T18:27:13+03:00" } ] ``` ``` -------------------------------- ### LaMetric Public API Access Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery Information on how to access the LaMetric device's public API, including available ports, authentication requirements, and examples for both HTTP and HTTPS connections. ```APIDOC ## LaMetric Public API Access ### Description LaMetric device public API is accessible via ports 8080 (HTTP) and 4343 (HTTPS). An `api_key` is required for authentication. ### Accessing API via HTTP (Port 8080) **Endpoint:** `http://[DEVICE_IP]:8080/api/v2` **Authentication:** Basic Authentication with `dev:` **Example Request:** ```bash curl -i http://192.168.88.153:8080/api/v2 --user dev: ``` **Example Success Response (200 OK):** ```json { "api_version": "2.3.0", "endpoints": { "apps_action_url": "http://192.168.88.153:8080/api/v2/device/apps/{:id}/widgets/{:widget_id}/actions", "apps_get_url": "http://192.168.88.153:8080/api/v2/device/apps/{:id}", "apps_list_url": "http://192.168.88.153:8080/api/v2/device/apps", "apps_switch_next_url": "http://192.168.88.153:8080/api/v2/device/apps/next", "apps_switch_prev_url": "http://192.168.88.153:8080/api/v2/device/apps/prev", "apps_switch_url": "http://192.168.88.153:80803/api/v2/device/apps/{:id}/widgets/{:widget_id}/activate", "audio_url": "http://192.168.88.153:8080/api/v2/device/audio", "bluetooth_url": "http://192.168.88.153:8080/api/v2/device/bluetooth", "concrete_notification_url": "http://192.168.88.153:8080/api/v2/device/notifications/{:id}", "current_notification_url": "http://192.168.88.153:8080/api/v2/device/notifications/current", "device_url": "http://192.168.88.153:8080/api/v2/device", "display_url": "http://192.168.88.153:8080/api/v2/device/display", "notifications_url": "http://192.168.88.153:8080/api/v2/device/notifications", "stream_start_url": "http://192.168.88.153:8080/api/v2/device/stream/start", "stream_stop_url": "http://192.168.88.153:8080/api/v2/device/stream/stop", "stream_url": "http://192.168.88.153:8080/api/v2/device/stream", "widget_update_url": "http://192.168.88.153:8080/api/v2/widget/update/{:id}", "wifi_url": "http://192.168.88.153:8080/api/v2/device/wifi" } } ``` ### Accessing API via HTTPS (Port 4343 - Recommended) **Endpoint:** `https://[DEVICE_IP]:4343/api/v2` **Authentication:** Use the `Authorization` header with a Base64 encoded `user:api_key` string. **Example Request:** ```bash curl -i -H "Authorization: Basic [BASE64_ENCODED_API_KEY]" https://192.168.88.153:4343/api/v2 -k ``` **Example Success Response (200 OK):** ```json { "api_version": "2.3.0", "endpoints": { "apps_action_url": "https://192.168.88.153:4343/api/v2/device/apps/{:id}/widgets/{:widget_id}/actions", "apps_get_url": "https://192.168.88.153:4343/api/v2/device/apps/{:id}", "apps_list_url": "https://192.168.88.153:4343/api/v2/device/apps", "apps_switch_next_url": "https://192.168.88.153:4343/api/v2/device/apps/next", "apps_switch_prev_url": "https://192.168.88.153:4343/api/v2/device/apps/prev", "apps_switch_url": "https://192.168.88.153:4343/api/v2/device/apps/{:id}/widgets/{:widget_id}/activate", "audio_url": "https://192.168.88.153:4343/api/v2/device/audio", "bluetooth_url": "https://192.168.88.153:4343/api/v2/device/bluetooth", "concrete_notification_url": "https://192.168.88.153:4343/api/v2/device/notifications/{:id}", "current_notification_url": "https://192.168.88.153:4343/api/v2/device/notifications/current" } } ``` ``` -------------------------------- ### Device Discovery - Cloud API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery This section explains how to discover LaMetric devices on a local network by using the LaMetric Cloud API. It involves logging into the cloud, retrieving a list of user devices, and then obtaining the IP address and API key for a specific device. ```APIDOC ## Device Discovery - Cloud API ### Description This endpoint allows you to discover LaMetric devices within your local network by interacting with the LaMetric Cloud API. The process involves authenticating with the cloud service, fetching a list of your registered devices, and then retrieving the local IP address and API key for a specific device. ### Method GET ### Endpoint `/api/v2/user/devices` (Illustrative endpoint, actual endpoint may vary based on LaMetric API specifics) ### Parameters #### Query Parameters None #### Request Body None ### Request Example None (This is a conceptual example based on the description, actual request would involve authentication headers and potentially specific API calls for device details after getting the list). ### Response #### Success Response (200) - **devices** (array) - A list of user's LaMetric devices. - **ip_address** (string) - The local IP address of the device. - **api_key** (string) - The API key for the device. #### Response Example ```json { "devices": [ { "name": "My LaMetric", "uuid": "some-uuid", "ip_address": "192.168.1.100", "api_key": "your_device_api_key" } ] } ``` ``` -------------------------------- ### Get Specific App Details - REST API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps Retrieves detailed information about a specific installed app on a LaMetric device using its package name. This uses a GET request to the /api/v2/device/apps/:package endpoint. ```REST GET https://:4343/api/v2/device/apps/com.lametric.clock Accept: application/json ``` -------------------------------- ### Retrieve LaMetric Device Description XML using cURL Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery This command uses cURL to fetch the device description XML file from the URL obtained from the `LOCATION` parameter in the SSDP response. The XML contains detailed information about the LaMetric device. ```bash curl -i http://192.168.88.153:60669/b2d83c5d-6012-4857-916e-6238ca6cab4e/device_description.xml ``` -------------------------------- ### Response for GET Icons Request Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/cloud-icons Example JSON response for a successful GET request to the /api/v2/icons endpoint. It includes pagination meta-information and a 'data' array containing icon objects with details like ID, title, and URL. ```json { "meta": { "total_icon_count": 2676, "page": 0, "page_size": 2676, "page_count": 1 }, "data": [ { "id": 1, "title": "Button Error", "code": "a1", "type": "movie", "category": null, "url": "https://developer.lametric.com/content/apps/icon_thumbs/1.gif", "thumb": { "original": "https://developer.lametric.com/content/apps/icon_thumbs/1_icon_thumb.gif", "small": "https://developer.lametric.com/content/apps/icon_thumbs/1_icon_thumb_sm.png", "large": "https://developer.lametric.com/content/apps/icon_thumbs/1_icon_thumb_lg.png", "xlarge": "https://developer.lametric.com/content/apps/icon_thumbs/1_icon_thumb_big.png" } }, { "id": 2, "title": "Button Success", "code": "i2", "type": "picture", "category": null, "url": "https://developer.lametric.com/content/apps/icon_thumbs/2.png", "thumb": { "original": "https://developer.lametric.com/content/apps/icon_thumbs/2_icon_thumb.png", "small": "https://developer.lametric.com/content/apps/icon_thumbs/2_icon_thumb_sm.png", "large": "https://developer.lametric.com/content/apps/icon_thumbs/2_icon_thumb_lg.png", "xlarge": "https://developer.lametric.com/content/apps/icon_thumbs/2_icon_thumb_big.png" } } ] } ``` -------------------------------- ### Stop Stream API Response (JSON) Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Example JSON response from the GET /api/v2/device/stream/stop endpoint, confirming that the stream has been stopped. ```json { "success": { "data": { "status": "stopped" }, "path": "api/v2/device/stream/stop" } } ``` -------------------------------- ### Device API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery Provides access to general device information and settings. ```APIDOC ## GET /api/v2/device ### Description Retrieves general information about the LaMetric device. ### Method GET ### Endpoint /api/v2/device ### Parameters None ### Request Example None ### Response #### Success Response (200) - **device_url** (string) - The URL for device-related operations. - **display_url** (string) - The URL for display-related operations. - **notifications_url** (string) - The URL for notification-related operations. - **stream_start_url** (string) - The URL to start the streaming API. - **stream_stop_url** (string) - The URL to stop the streaming API. - **stream_url** (string) - The URL for streaming API operations. - **widget_update_url** (string) - The URL to update widgets. - **wifi_url** (string) - The URL for Wi-Fi configuration. #### Response Example { "device_url": "https://192.168.88.153:4343/api/v2/device", "display_url": "https://192.168.88.153:4343/api/v2/device/display", "notifications_url": "https://192.168.88.153:4343/api/v2/device/notifications", "stream_start_url": "https://192.168.88.153:4343/api/v2/device/stream/start", "stream_stop_url": "https://192.168.88.153:4343/api/v2/device/stream/stop", "stream_url": "https://192.168.88.153:4343/api/v2/device/stream", "widget_update_url": "https://192.168.88.153:4343/api/v2/widget/update/{:id}", "wifi_url": "https://192.168.88.153:4343/api/v2/device/wifi" } ``` -------------------------------- ### Stop Stream API Request (HTTP) Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-stream Example HTTP request for the GET /api/v2/device/stream/stop endpoint to halt content streaming to the LaMetric device. ```http GET /api/v2/device/stream/stop Host: 192.168.170.83:4343 Authorization: Basic ")> Content-Type: application/json Accept: applciation/json ``` -------------------------------- ### Response for Paginated Icons Request Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/cloud-icons Example JSON response for a paginated GET request to the /api/v2/icons endpoint, which returns a subset of icons based on the specified page size and filters. Includes updated meta-information. ```json { "meta": { "total_icon_count": 2676, "page": 1, "page_size": 2, "page_count": 1338 }, "data": [ { "id": 2959, "title": "JulienBreux - CPU", "url": "https://developer.lametric.com/content/apps/icon_thumbs/2959.png" }, { "id": 2957, "title": "JulienBreux - Memory", "url": "https://developer.lametric.com/content/apps/icon_thumbs/2957.png" } ] } ``` -------------------------------- ### Wi-Fi Configuration API Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery Enables configuration and management of the device's Wi-Fi settings. ```APIDOC ## GET /api/v2/device/wifi ### Description Retrieves the current Wi-Fi configuration of the LaMetric device. ### Method GET ### Endpoint /api/v2/device/wifi ### Parameters None ### Request Example None ### Response #### Success Response (200) - **ssid** (string) - The name of the connected Wi-Fi network. - **status** (string) - The current status of the Wi-Fi connection. #### Response Example { "example": "{\"ssid\": \"MyWiFiNetwork\", \"status\": \"connected\"}" } ``` -------------------------------- ### UPnP Device Discovery Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-discovery This section details the steps for discovering LaMetric devices on the network using UPnP. It includes sending an SSDP discovery request and parsing the response to obtain the device description URL. ```APIDOC ## UPnP Device Discovery ### Description This section details the steps for discovering LaMetric devices on the network using UPnP. It involves sending an SSDP discovery request and then fetching the device description XML. ### Step 1: Send SSDP Discovery Request Listen for incoming broadcast messages after sending an SSDP discovery request. **Example Response (SSDP Broadcast):** ``` HTTP/1.1 200 OK CACHE-CONTROL: max-age=1800 EXT: LOCATION: http://192.168.88.153:60669/b2d83c5d-6012-4857-916e-6238ca6cab4e/device_description.xml SERVER: Linux/3.4.103 UPnP/1.1 HUPnP/1.0 ST: upnp:rootdevice USN: uuid:b2d83c5d-6012-4857-916e-6238ca6cab4e::upnp:rootdevice BOOTID.UPNP.ORG: 0 CONFIGID.UPNP.ORG: 0 ``` ### Step 2: Fetch Device Description XML Use the `LOCATION` URL obtained from the SSDP response to retrieve the `device_description.xml` file. **Method:** ``` curl -i [LOCATION_URL] ``` **Example Request:** ``` curl -i http://192.168.88.153:60669/b2d83c5d-6012-4857-916e-6238ca6cab4e/device_description.xml ``` **Example Response (Device Description XML):** ```xml HTTP/1.1 200 OK DATE: Tue, 28 Jun 2016 19:59:36 Connection: close HOST: 192.168.88.153:60669 content-length: 771 1 0 https://192.168.88.153:443 urn:schemas-upnp-org:device:LaMetric:1 LaMetric (LM1419) Smart Atoms Inc. http://www.smartatoms.com LaMetric - internet connected ticker witn UPnP SSDP support LaMetric Battery Edition SA01 http://www.lametric.com SA150800000100W00BP9 1 uuid:b2d83c5d-6012-4857-916e-6238ca6cab4e ``` ``` -------------------------------- ### LaMetric Cloud API Documentation Source: https://lametric-documentation.readthedocs.io/en/latest/index Documentation for the LaMetric Cloud API, including OAuth2 Authorization, Users, and Icons. ```APIDOC ## LaMetric Cloud API ### Description This section details the LaMetric Cloud API, which allows developers to interact with LaMetric services for managing users, authentication, and custom icons. ### Endpoints * **OAuth2 Authorization** * Description: Details on how to authorize applications using OAuth2. * **Users** * Description: Information on managing user accounts and profiles via the API. * **Icons** * Description: Documentation for uploading and managing custom icons for notifications and apps. ``` -------------------------------- ### Python Example: Authenticate LaMetric Device API Request Source: https://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-authorization This Python script demonstrates how to construct the necessary Authorization header for making API requests to a LaMetric device. It uses the `requests` and `base64` libraries to encode the 'dev:' string. ```python import requests import base64 DEVICE_IP = '192.168.0.128' DEVICE_PORT = 4343 DEVICE_API_KEY = '8adaa0c98278dbb1ecb218d1c3e11f9312317ba474ab3361f80c0bd4f13a6749' # Encode API key for authorization auth_str = f'dev:{DEVICE_API_KEY}' auth_bytes = auth_str.encode('ascii') auth_base64 = base64.b64encode(auth_bytes).decode('ascii') # Headers for API requests HEADERS = { 'Authorization': f'Basic {auth_base64}', 'Content-Type': 'application/json', 'Accept': 'application/json' } url = f'https://{DEVICE_IP}:{DEVICE_PORT}/api/v2' response = requests.get(url, headers=HEADERS, verify=False) if response.status_code == 200: # Success else: # Failure ```