feat:【IoT 物联网】使用 STATE_UPDATE 重构
This commit is contained in:
@ -306,10 +306,10 @@ const handleDeviceState = async (state: number) => {
|
||||
try {
|
||||
await DeviceApi.sendDeviceMessage({
|
||||
deviceId: props.device.id,
|
||||
method:
|
||||
state === DeviceStateEnum.ONLINE
|
||||
? IotDeviceMessageMethodEnum.STATE_ONLINE.method
|
||||
: IotDeviceMessageMethodEnum.STATE_OFFLINE.method
|
||||
method: IotDeviceMessageMethodEnum.STATE_UPDATE.method,
|
||||
params: {
|
||||
state: state
|
||||
}
|
||||
})
|
||||
message.success(`设备${state === DeviceStateEnum.ONLINE ? '上线' : '下线'}成功`)
|
||||
deviceMessageRef.value.refresh(deviceMessageRefresnhDelay)
|
||||
|
||||
@ -8,14 +8,9 @@ export const IOT_PROVIDE_KEY = {
|
||||
*/
|
||||
export const IotDeviceMessageMethodEnum = {
|
||||
// ========== 设备状态 ==========
|
||||
STATE_ONLINE: {
|
||||
method: 'thing.state.online',
|
||||
name: '设备上线',
|
||||
upstream: true
|
||||
},
|
||||
STATE_OFFLINE: {
|
||||
method: 'thing.state.offline',
|
||||
name: '设备下线',
|
||||
STATE_UPDATE: {
|
||||
method: 'thing.state.update',
|
||||
name: '设备状态变更',
|
||||
upstream: true
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user