SmartDeviceModel.getDevInfo

Requires:
@ray-js/panel-sdk≥1.0.0

Method signature
SmartDeviceModel.getDevInfo()

Description

Get smart device information, implemented based on ty.device.getDeviceInfo

Parameters

None

Return Value

Type: DevInfo
Device info object that includes devId, name, schema, dps, isOnline, codeIds (Code→ID), idCodes (ID→Code), etc.
Note that compared with the return type of ty.device.getDeviceInfo, it adds the codeIds and idCodes fields.
In a group context, it returns GroupInfo, whose field structure differs from DeviceInfo.

Referenced Types

typeDevInfoDevice information
PropertyTypeDescription
idCodesRecord<string, string>Mapping of dp id to dp code
codeIdsRecord<string, string>Mapping of dp code to dp id
capabilityCapabilityProduct communication capability bit flags, determined via bitwise operations, such as Wi‑Fi, Bluetooth, ZigBee, SigMesh, etc.

- Wi‑Fi (bit 0, decimal value: 1): Wi‑Fi
- Cable (bit 1, decimal value: 2): Wired
- GPRS (bit 2, decimal value: 4): similar to 2G networks
- NB‑IoT (bit 3, decimal value: 6): IoT SIM network
- Bluetooth (bit 10, decimal value: 1024): Bluetooth point‑to‑point
- BLEMesh (bit 11, decimal value: 2048): proprietary Bluetooth mesh
- ZigBee (bit 12, decimal value: 4096): 2.4 GHz band
- Infrared (bit 13, decimal value: 8192): Infrared
- 433 (subpieces) (bit 14, decimal value: 16384): 433 MHz
- SigMesh (bit 15, decimal value: 32768): Bluetooth standard mesh
- MCU (bit 16, decimal value: 65536): MCU
- SMesh (bit 17, decimal value: 131072): similar to ZigBee
- Cat1 (bit 20, decimal value: 1048576): usually uses 3G networks
- Beacon (bit 21, decimal value: 2097152): Bluetooth Beacon
- Thread (bit 25, decimal value: 33554432): Thread capability
devAttributeDevAttributeDevice capability bit flags, reported by firmware
Bit meanings:
- Bit 0: Whether the device supports zero‑config networking
- Bit 1: Device supports dp query protocol 31
- Bit 2: Whether the device has local automation capability
- Bit 3: Whether the device supports Wi‑Fi scanning
- Bit 4: Whether the device supports Google Local Home
- Bit 5: Whether the device supports fast provisioning
- Bit 6: Whether the device supports Bluetooth control
- Bit 7: Whether the device supports security capability
- Bit 8: Whether the device is a shared device
- Bit 9: Whether the device supports sunrise/sunset scheduling
- Bit 10: Whether the device supports fault replacement capability
- Bit 11: Whether the device supports OTA
- Bit 12: Whether the device supports Wi‑Fi backup switchover
- Bit 14: Device supports the Tuya standard protocol
- Bit 15: Device supports custom passthrough
- Bit 16: Whether the device supports industry capabilities
[]Product information, including schema and function definitions
Panel cloud configuration
typeCapability
export type Capability = number;
typeDevAttribute
export type DevAttribute = number;

Valid Values

DevInfo.schema.mode
ValueDescriptionSince
rw--
ro--
wr--
DevInfo.schema.property.type
ValueDescriptionSince
string--
bool--
value--
enum--
bitmap--
raw--
DevInfo.schema.type
ValueDescriptionSince
raw--
obj--
FunConfig.tyabirysr4_app
ValueDescriptionSince
follow--
--app-B1--
FunConfig.tyabis5d9w_app
ValueDescriptionSince
follow--
--app-M1--

Examples

Example

const devInfo = device.getDevInfo();
console.log(devInfo.name);                    // Device name
console.log(devInfo.isOnline);                // Online status
console.log(devInfo.codeIds.switch_led);      // 20 (Code→ID)
console.log(devInfo.idCodes[20]);             // 'switch_led' (ID→Code)