This commit is contained in:
@@ -37,12 +37,22 @@ func (b *bridge) Devices() []models.Device {
|
|||||||
|
|
||||||
hue, sat, value := colorful.LinearRgb(red, green, blue).Hsv()
|
hue, sat, value := colorful.LinearRgb(red, green, blue).Hsv()
|
||||||
|
|
||||||
|
shapeType, shapeTypeOK := shapeTypeMap[panel.ShapeType]
|
||||||
|
if !shapeTypeOK {
|
||||||
|
shapeType = "NanoLeaf"
|
||||||
|
}
|
||||||
|
|
||||||
|
shapeIcon, shapeIconOK := shapeIconMap[panel.ShapeType]
|
||||||
|
if !shapeIconOK {
|
||||||
|
shapeIcon = "lightbulb"
|
||||||
|
}
|
||||||
|
|
||||||
results = append(results, models.Device{
|
results = append(results, models.Device{
|
||||||
ID: -1,
|
ID: -1,
|
||||||
BridgeID: b.externalID,
|
BridgeID: b.externalID,
|
||||||
InternalID: strconv.Itoa(int(panel.ID)),
|
InternalID: strconv.Itoa(int(panel.ID)),
|
||||||
Icon: "hexagon",
|
Icon: shapeIcon,
|
||||||
Name: fmt.Sprintf("Hexagon %d", i),
|
Name: fmt.Sprintf("%s %d", shapeType, i),
|
||||||
Capabilities: []models.DeviceCapability{
|
Capabilities: []models.DeviceCapability{
|
||||||
models.DCPower,
|
models.DCPower,
|
||||||
models.DCColorHS,
|
models.DCColorHS,
|
||||||
@@ -83,7 +93,7 @@ func (b *bridge) Refresh(ctx context.Context) error {
|
|||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
PanelLoop:
|
PanelLoop:
|
||||||
for _, panelInfo := range overview.PanelLayout.Data.PositionData {
|
for _, panelInfo := range overview.PanelLayout.Data.PositionData {
|
||||||
if panelInfo.PanelID == 0 {
|
if shapeTypeMap[panelInfo.ShapeType] == "Shapes Controller" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,18 @@ var shapeTypeMap = map[int]string{
|
|||||||
12: "Shapes Controller",
|
12: "Shapes Controller",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var shapeIconMap = map[int]string{
|
||||||
|
0: "triangle",
|
||||||
|
1: "rhythm",
|
||||||
|
2: "Square",
|
||||||
|
3: "square",
|
||||||
|
4: "square",
|
||||||
|
7: "hexagon",
|
||||||
|
8: "triangle",
|
||||||
|
9: "triangle-small",
|
||||||
|
12: "hexagon",
|
||||||
|
}
|
||||||
|
|
||||||
var shapeWidthMap = map[int]int{
|
var shapeWidthMap = map[int]int{
|
||||||
0: 150,
|
0: 150,
|
||||||
1: -1,
|
1: -1,
|
||||||
|
|||||||
Reference in New Issue
Block a user