This commit is contained in:
@@ -36,6 +36,10 @@ EVENT HANDLER FACTORY COMMANDS
|
||||
|
||||
factory run <file.yaml>
|
||||
|
||||
MISC COMMANDS
|
||||
|
||||
color <color>
|
||||
|
||||
File example (use '---' to delimit multiple configs in one file):
|
||||
mode: SceneDimmer
|
||||
target: tag:Soverom
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.aiterp.net/lucifer/new-server/app/client"
|
||||
"git.aiterp.net/lucifer/new-server/internal/color"
|
||||
"git.aiterp.net/lucifer/new-server/models"
|
||||
"log"
|
||||
"os"
|
||||
@@ -92,6 +93,29 @@ func main() {
|
||||
|
||||
WriteDeviceInfoTable(os.Stdout, devices)
|
||||
}
|
||||
case "color":
|
||||
{
|
||||
col, err := color.Parse(cmd.Params.Get(0).StringOr("hs:0,0"))
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
if col.IsKelvin() {
|
||||
fmt.Println(col.String())
|
||||
}
|
||||
if hs, ok := col.ToHS(); ok {
|
||||
fmt.Println(hs.String())
|
||||
}
|
||||
if hsk, ok := col.ToHSK(); ok {
|
||||
fmt.Println(hsk.String())
|
||||
}
|
||||
if xy, ok := col.ToXY(); ok {
|
||||
fmt.Println(xy.String())
|
||||
}
|
||||
if rgb, ok := col.ToRGB(); ok {
|
||||
fmt.Println(rgb.String())
|
||||
}
|
||||
}
|
||||
|
||||
case "factory":
|
||||
factoryCmd(ctx, c)
|
||||
|
||||
Reference in New Issue
Block a user