number2Bright(bright: number, schemaObj: Record<string, DpSchema>)

Requires:
≥1.15.0

Description

Map the standard bright_value (10–1000) to Matter brightness_control (1–254) for sending.

Parameters

ParameterTypeRequiredDescription
brightnumberYesStandard brightness value (10–1000)
schemaObjRecord<string, DpSchema>YesdpSchema object

Return Value

Type: number
Matter brightness_control value

Referenced Types

interfaceDpSchema
PropertyTypeRequiredDescription
attrnumberNoDP attribute flag bit, used to mark additional capabilities of the DP
canTriggerbooleanNoWhether it can be used as an automation trigger condition
codestringYesDP code, e.g., switch
defaultRecommendbooleanNoWhether it is the default recommended DP
editPermissionbooleanNoWhether it has edit permission
executablebooleanNoWhether it can be issued (sent downstream)
extContentstringNoDP extension content, typically a JSON string
iconnamestringNoDP icon name
idstring | numberYesDP ID
mode"rw" | "ro" | "wr"YesDP mode type
rw: writable and reportable (read/write)
ro: report-only (read-only)
wr: write-only
namestringYesDP name, typically used in voice scenarios
NoDP attributes
type"raw" | "obj"YesDP data type categories: raw for raw byte stream, obj for structured object

Examples

Example

import { createMatterKit, useDpSchema } from '@ray-js/panel-sdk';

const matterKit = createMatterKit();
const dpSchema = useDpSchema();
const matterBright = matterKit.utils.number2Bright(750, dpSchema);