Info Method

@bp.method('device.info')

Note

This method is already implemented by the device skeleton - there is nothing you need to do unless you want to customize it.

This method returns the content of device.json to the webapp. It is called when the send page of a device is opened, to render its options, and when registering a device, to validate it.

Parameters

An optional key may be passed to only return a specific part of device.json:

def info(key: str = '') -> str:

Response

If key is empty, the whole content of device.json is returned as-is. Otherwise, an object containing only the requested top-level key is returned, for example device.info(key="options"):

{
    "options": "<OPTIONS_ARRAY_FROM_DEVICE.JSON>"
}

Note

If key is not a valid top-level key of device.json, the whole file is returned instead.