* Hide nanoleaf:IP devices in UI * Color clicking behavior is more clear * small icons for mega-groups * common tags/roles for groups * fix default names in UI state * hexagon corner * secondary lamp icon * fix selection bugs in device form * select all/none hotkey * quick assign modal
This commit is contained in:
@@ -46,7 +46,7 @@ func (b *bridge) HardwareEvents() []lucifer3.Event {
|
||||
|
||||
shapeType, shapeTypeOK := shapeTypeMap[panel.ShapeType]
|
||||
if !shapeTypeOK {
|
||||
shapeType = "Unknown"
|
||||
shapeType = fmt.Sprint("Unknown:", panel.ShapeType)
|
||||
}
|
||||
|
||||
shapeIcon, shapeIconOK := shapeIconMap[panel.ShapeType]
|
||||
@@ -65,7 +65,7 @@ func (b *bridge) HardwareEvents() []lucifer3.Event {
|
||||
|
||||
results = append(results, events.HardwareState{
|
||||
ID: panel.FullID,
|
||||
InternalName: fmt.Sprintf("%s %d (%s)", shapeType, i+1, strings.SplitN(panel.FullID, ":", 3)[2]),
|
||||
InternalName: fmt.Sprintf("%s %03d", shapeType, i+1),
|
||||
SupportFlags: device.SFlagPower | device.SFlagIntensity | device.SFlagColor,
|
||||
ColorFlags: device.CFlagRGB,
|
||||
Buttons: []string{"Touch"},
|
||||
|
||||
@@ -138,6 +138,7 @@ var shapeTypeMap = map[int]string{
|
||||
8: "Triangle",
|
||||
9: "Mini Triangle",
|
||||
12: "Shapes Controller",
|
||||
15: "Element Corner",
|
||||
}
|
||||
|
||||
var shapeIconMap = map[int]string{
|
||||
@@ -150,6 +151,7 @@ var shapeIconMap = map[int]string{
|
||||
8: "shape_triangle",
|
||||
9: "shape_triangle",
|
||||
12: "shape_hexagon",
|
||||
15: "shape_hexagon_corner",
|
||||
}
|
||||
|
||||
var shapeWidthMap = map[int]int{
|
||||
|
||||
@@ -24,7 +24,6 @@ func (d *Data) WithPatch(patches ...Patch) Data {
|
||||
if patch.Device != nil {
|
||||
pd := d.ensureDevice(patch.Device.ID)
|
||||
|
||||
gentools.ApplyUpdate(&pd.Name, patch.Device.Name)
|
||||
gentools.ApplyUpdatePtr(&pd.HWState, patch.Device.HWState)
|
||||
gentools.ApplyUpdatePtr(&pd.HWMetadata, patch.Device.HWMetadata)
|
||||
gentools.ApplyUpdatePtr(&pd.DesiredState, patch.Device.DesiredState)
|
||||
@@ -66,6 +65,22 @@ func (d *Data) WithPatch(patches ...Patch) Data {
|
||||
pd.Icon = patch.Device.HWMetadata.Icon
|
||||
}
|
||||
}
|
||||
if patch.Device.HWState != nil {
|
||||
hasName := false
|
||||
for _, alias := range pd.Aliases {
|
||||
if strings.HasPrefix(alias, "lucifer:name:") {
|
||||
hasName = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !hasName {
|
||||
pd.Aliases = append(pd.Aliases, "lucifer:name:"+patch.Device.HWState.InternalName)
|
||||
}
|
||||
if pd.Name == "" {
|
||||
pd.Name = patch.Device.HWState.InternalName
|
||||
}
|
||||
}
|
||||
if patch.Device.ClearAssignment {
|
||||
pd.Assignment = nil
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ func (e Patch) VerboseKey() string {
|
||||
func (e Patch) EventDescription() string {
|
||||
if e.Device != nil {
|
||||
switch {
|
||||
case e.Device.Name != nil:
|
||||
return fmt.Sprintf("uistate.Patch(device=%s, name=%s)", e.Device.ID, *e.Device.Name)
|
||||
case e.Device.DesiredState != nil:
|
||||
return fmt.Sprintf("uistate.Patch(device=%s, desiredState=%s)", e.Device.ID, e.Device.DesiredState.String())
|
||||
case e.Device.HWState != nil:
|
||||
@@ -56,7 +54,6 @@ func (e Patch) EventDescription() string {
|
||||
|
||||
type DevicePatch struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
HWMetadata *events.HardwareMetadata `json:"hwMetadata,omitempty"`
|
||||
HWState *events.HardwareState `json:"hwState,omitempty"`
|
||||
DesiredState *device.State `json:"desiredState,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user