package zigbee2mqtt import ( "encoding/json" "fmt" ) type hex int /* { "ieee_address":"0x00158d00018255df", "type":"Router", "network_address":29159, "supported":true, "disabled": false, "friendly_name":"my_plug", "description":"this plug is in the kitchen", "endpoints":{"1":{"bindings":[],"configured_reportings":[],"clusters":{"input":["genOnOff","genBasic"],"output":[]}}}, "definition":{ "model":"ZNCZ02LM", "vendor":"Xiaomi", "description":"Mi power plug ZigBee", "options": [...], // see exposes/options below "exposes": [...] // see exposes/options below }, "power_source":"Mains (single phase)", "date_code":"02-28-2017", "model_id":"lumi.plug", "scenes": [{"id": 3, "name": "Chill scene"}], "interviewing":false, "interview_completed":true }, */ /* "exposes": [{ "access": 1, "description": "Remaining battery in %", "name": "battery", "property": "battery", "type": "numeric", "unit": "%", "value_max": 100, "value_min": 0 } */ type expose struct { Access int Description string Name string Property string Type string Unit string Value_max int Value_min int } /* "target": { "endpoint": 1, "ieee_address": "0x00124b00229884d8", "type": "endpoint" } */ type target struct { Endpoint int Ieee_address string Type string } /* "bindings": [{ "cluster": "genPowerCfg", "target": { "endpoint": 1, "ieee_address": "0x00124b00229884d8", "type": "endpoint" } }, */ type binding struct { Cluster string Target target } /* "clusters": { "input": ["genBasic", "genPowerCfg", "genPollCtrl", "touchlink", "64768"], "output": ["genIdentify", "genGroups", "genScenes", "genOnOff", "genLevelCtrl", "genOta", "lightingColorCtrl", "touchlink"] }, */ type clusters struct { Input []string Output []string } /* "configured_reportings": [{ "attribute": "batteryVoltage", "cluster": "genPowerCfg", "maximum_report_interval": 62000, "minimum_report_interval": 3600, "reportable_change": 0 }], */ type reportings struct { Attribute string Cluster string Maximum_report_interval int Minimum_report_interval json.Number Reportable_change int } /* "scenes": [] */ type endpoint struct { Bindings []binding Configured_reportings []reportings // Scenes: [] Scenes []string } type definition struct { Description string Exposes []expose } type device struct { Date_code string Disabled bool Friendly_name string Ieee_address string Interview_completed bool Interviewing bool Manufacturer string Model_id string Network_address int Power_source string Software_build_id string Supported bool Type string Endpoints map[string]endpoint Clusters clusters Definition definition } func Build(data []byte, Z2m *Zigbee2mqtt) { //var arr []device err := json.Unmarshal(data, &Z2m.Devices) fmt.Println("connectors/zigbee2mqtt/device/builder") if err != nil { panic(err) } }