diff --git a/frontend/dash-home/src/light/Light.tsx b/frontend/dash-home/src/light/Light.tsx index 257b201..04cbf1f 100644 --- a/frontend/dash-home/src/light/Light.tsx +++ b/frontend/dash-home/src/light/Light.tsx @@ -62,34 +62,37 @@ export const LightPanel: React.FC = props => {
{/* Bightness */} - - - } - description={t("controller.light.brightness.name")} - i18nKey="controller.light.brightness" - value={""} - setter={(e: any) => light!.action = e} - sender={(after: any) => update({ ...light! }, after)} - action={props.template?.light?.brightness!} - /> - - + {props.template?.light?.brightness && + + + } + description={t("controller.light.brightness.name")} + i18nKey="controller.light.brightness" + value={""} + setter={(e: any) => light!.action = e} + sender={(after: any) => update({ ...light! }, after)} + action={props.template?.light?.brightness!} + /> + + } {/* Color */} - - - } - description={t("controller.light.color.name")} - i18nKey="controller.light.color" - value={""} - setter={(e: any) => light!.action = e} - sender={(after: any) => update({ ...light! }, after)} - action={props.template?.light?.color!} - /> - + {props.template?.light?.color && + + + } + description={t("controller.light.color.name")} + i18nKey="controller.light.color" + value={""} + setter={(e: any) => light!.action = e} + sender={(after: any) => update({ ...light! }, after)} + action={props.template?.light?.color!} + /> + + } ) diff --git a/go.mod b/go.mod index 153c58b..040b58e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/dash-app/remote-go v0.0.0-20210222083255-1b0a70213e08 + github.com/dash-app/remote-go v0.0.3 github.com/gin-contrib/cors v1.3.1 github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e github.com/gin-gonic/gin v1.6.3 diff --git a/go.sum b/go.sum index eba2915..4dc45b4 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,8 @@ github.com/dash-app/remote-go v0.0.0-20210218130152-0194225df821 h1:K/Lb87ByH1t2 github.com/dash-app/remote-go v0.0.0-20210218130152-0194225df821/go.mod h1:NDeDX5ytimaP0cjt4kj7m/3stnbWokHKSgN7cZY5ZdA= github.com/dash-app/remote-go v0.0.0-20210222083255-1b0a70213e08 h1:0LSnyAqOGcew48dTdpMpehDSopdh37i2Uit90Pc3B6c= github.com/dash-app/remote-go v0.0.0-20210222083255-1b0a70213e08/go.mod h1:NDeDX5ytimaP0cjt4kj7m/3stnbWokHKSgN7cZY5ZdA= +github.com/dash-app/remote-go v0.0.3 h1:0qQSpzkqn1Y+4oAJLey0ZbF373iJ8uEsOIU1eELXZtM= +github.com/dash-app/remote-go v0.0.3/go.mod h1:NDeDX5ytimaP0cjt4kj7m/3stnbWokHKSgN7cZY5ZdA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/pkg/agent/remote.go b/pkg/agent/remote.go index 4a8b702..ef1ec98 100644 --- a/pkg/agent/remote.go +++ b/pkg/agent/remote.go @@ -23,7 +23,7 @@ type Payload struct { Interval int `json:"interval,omitempty"` } -func (as *AgentService) SendIR(ctx context.Context, hex []*hex.HexCode) error { +func (as *AgentService) SendIR(ctx context.Context, h []*hex.HexCode) error { ctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() @@ -42,11 +42,21 @@ func (as *AgentService) SendIR(ctx context.Context, hex []*hex.HexCode) error { // return errors.New("agent is not online") //} var payload []Payload - for _, code := range hex { - payload = append(payload, Payload{ - Signal: aeha.SignalToCode(430, code.Code, 13300), - Interval: code.Interval, - }) + for _, code := range h { + switch code.Format { + default: + fallthrough + case hex.AEHA: + payload = append(payload, Payload{ + Signal: aeha.SignalToCode(430, code.Code, 13300), + Interval: code.Interval, + }) + case hex.RAW: + payload = append(payload, Payload{ + Signal: code.Raw, + Interval: code.Interval, + }) + } } // Marshal codes