This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues or pull requests.
automation/integration/google/device.go
Dreaded_X dd03ae56ee
Some checks failed
continuous-integration/drone/push Build is failing
Reorganized code, added google home intergrations and added zigbee2mqtt kettle
2022-11-15 01:03:30 +01:00

52 lines
1.3 KiB
Go

package google
type DeviceName struct {
DefaultNames []string `json:"defaultNames,omitempty"`
Name string `json:"name"`
Nicknames []string `json:"nicknames,omitempty"`
}
type DeviceInfo struct {
Manufacturer string `json:"manufacturer,omitempty"`
Model string `json:"model,omitempty"`
HwVersion string `json:"hwVersion,omitempty"`
SwVersion string `json:"swVersion,omitempty"`
}
type OtherDeviceID struct {
AgentID string `json:"agentId,omitempty"`
DeviceID string `json:"deviceId,omitempty"`
}
type Device struct {
ID string `json:"id"`
Type Type `json:"type"`
Traits []Trait `json:"traits"`
Name DeviceName `json:"name"`
WillReportState bool `json:"willReportState"`
NotificationSupportedByAgent bool `json:"notificationSupportedByAgent,omitempty"`
RoomHint string `json:"roomHint,omitempty"`
DeviceInfo DeviceInfo `json:"deviceInfo,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
CustomData map[string]interface{} `json:"customDate,omitempty"`
OtherDeviceIDs []OtherDeviceID `json:"otherDeviceIds,omitempty"`
}
func NewDevice(id string, typ Type) *Device {
return &Device{
ID: id,
Type: typ,
Attributes: make(map[string]interface{}),
CustomData: make(map[string]interface{}),
}
}