fixed hue updating too often, and change logic for fetchbyreference to support multiple tags, ids or bridges.
This commit is contained in:
@@ -35,8 +35,8 @@ func StartEventHandler() {
|
||||
for range time.NewTicker(time.Minute).C {
|
||||
config.EventChannel <- models.Event{Name: "TimeChanged", Payload: map[string]string{
|
||||
"weekdayName": time.Now().In(loc).Format("Monday"),
|
||||
"month": time.Now().In(loc).Format("01"),
|
||||
"year": time.Now().In(loc).Format("2006"),
|
||||
"month": time.Now().In(loc).Format("01"),
|
||||
"year": time.Now().In(loc).Format("2006"),
|
||||
}}
|
||||
}
|
||||
}()
|
||||
@@ -49,7 +49,7 @@ func handleEvent(event models.Event) (responses []models.Event) {
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
duration := time.Since(startTime)
|
||||
if duration > time.Millisecond * 250 {
|
||||
if duration > time.Millisecond*250 {
|
||||
log.Println(event.Name, "took long to handle:", duration)
|
||||
}
|
||||
}()
|
||||
@@ -134,7 +134,7 @@ func handleEvent(event models.Event) (responses []models.Event) {
|
||||
if action.SetIntensity != nil {
|
||||
newState.Intensity = action.SetIntensity
|
||||
} else if action.AddIntensity != nil {
|
||||
newIntensity := math.Max(0, math.Min(1, device.State.Intensity + *action.AddIntensity))
|
||||
newIntensity := math.Max(0, math.Min(1, device.State.Intensity+*action.AddIntensity))
|
||||
newState.Intensity = &newIntensity
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user