Skip to content
Snippets Groups Projects
Commit de8f8178 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Added Access info (more work TDB)

parent 202d76c2
Branches
Tags
No related merge requests found
......@@ -25,3 +25,7 @@ func GetGW() *gateway {
})
return instance
}
func NewGW() *gateway {
return GetGW()
}
......@@ -22,7 +22,8 @@ func main() {
// client.Publish("zigbee2mqtt/0x70b3d52b600f89d3/set", 0, false, `{"state": "toggle"}`)
eng := xaal.NewEngine()
GetGW().engine = eng
gw := GetGW()
gw.engine = eng
eng.Run()
client.Disconnect(250)
slog.Debug("MQTT disconnected")
......
......@@ -44,6 +44,7 @@ type Expose struct {
Unit string `json:"unit,omitempty"`
Features []Feature `json:"features,omitempty"`
Values []string `json:"values,omitempty"`
Access int `json:"access,omitempty"`
}
type Feature struct {
......@@ -51,6 +52,7 @@ type Feature struct {
Type string `json:"type"`
Property string `json:"property,omitempty"`
Unit string `json:"unit,omitempty"`
Access int `json:"access,omitempty"`
}
func (bDevice *BridgeDevice) GetTopic() string {
......@@ -75,7 +77,7 @@ func (bDevices *BridgeDevice) dump() {
expTab := table.NewWriter()
expTab.SetTitle("Exp:" + bDevices.FriendlyName)
expTab.SetStyle(table.StyleRounded)
expTab.AppendHeader(table.Row{"Name", "Type", "Unit", "Values", "Features: Name[Type](Unit){Property}"})
expTab.AppendHeader(table.Row{"Name", "Type", "Acc", "Unit", "Values", "Features: Name[Type]-Acc-(Unit){Property}"})
for _, expose := range bDevices.Definition.Exposes {
values := ""
if len(expose.Values) > 0 {
......@@ -84,11 +86,11 @@ func (bDevices *BridgeDevice) dump() {
features := ""
if len(expose.Features) > 0 {
for _, feature := range expose.Features {
features += fmt.Sprintf("- %s[%s](%s){%s}\n", feature.Name, feature.Type, feature.Unit, feature.Property)
features += fmt.Sprintf("- %s[%s]-%d-(%s){%s}\n", feature.Name, feature.Type, feature.Access, feature.Unit, feature.Property)
}
features = strings.TrimSuffix(features, "\n")
}
expTab.AppendRow(table.Row{expose.Name, expose.Type, expose.Unit, values, features})
expTab.AppendRow(table.Row{expose.Name, expose.Type, expose.Access, expose.Unit, values, features})
}
fmt.Println(expTab.Render())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment