Skip to content

Commit

Permalink
优化tryReadNewValues逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
smthing committed Jun 5, 2024
1 parent cdd67cb commit fbbb4df
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions driverbox/helper/shadow/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ type DevicePoint struct {

// DevicePointAPI 对外开放设备点位
type DevicePointAPI struct {
Name string `json:"name"`
Value any `json:"value"`
UpdatedAt string `json:"updated_at"`
Name string `json:"name"`
Value any `json:"value"`
UpdatedAt string `json:"updated_at"`
LatestWriteTime string `json:"latestWriteTime"`
}

func NewDevice(device config.Device, modelName string, points map[string]DevicePoint) Device {
Expand Down Expand Up @@ -106,9 +107,10 @@ func (d *Device) ToDeviceAPI() DeviceAPI {

func (dp DevicePoint) ToDevicePointAPI() DevicePointAPI {
return DevicePointAPI{
Name: dp.Name,
Value: dp.Value,
UpdatedAt: dp.UpdatedAt.Format("2006-01-02 15:04:05"),
Name: dp.Name,
Value: dp.Value,
UpdatedAt: dp.UpdatedAt.Format("2006-01-02 15:04:05"),
LatestWriteTime: dp.LatestWriteTime.Format("2006-01-02 15:04:05"),
}
}

Expand Down

0 comments on commit fbbb4df

Please sign in to comment.