Mill. Take 1.
continuous-integration/drone/push Build is failing

This commit is contained in:
Stian Fredrik Aune
2021-11-07 18:38:32 +01:00
parent 6443e0ecd3
commit 88bd4dc073
17 changed files with 471 additions and 22 deletions
+1
View File
@@ -23,6 +23,7 @@ var (
DTHue DriverKind = "Hue"
DTNanoLeaf DriverKind = "Nanoleaf"
DTLIFX DriverKind = "LIFX"
DTMill DriverKind = "Mill"
)
var ValidDriverKinds = []DriverKind{
+1 -1
View File
@@ -37,7 +37,7 @@ type DeviceState struct {
Power bool `json:"power"`
Color ColorValue `json:"color,omitempty"`
Intensity float64 `json:"intensity,omitempty"`
Temperature float64 `json:"temperature"`
Temperature int `json:"temperature"`
}
type DeviceScene struct {
+1 -1
View File
@@ -10,7 +10,7 @@ type DriverProvider interface {
}
type Driver interface {
SearchBridge(ctx context.Context, address string, dryRun bool) ([]Bridge, error)
SearchBridge(ctx context.Context, address, token string, dryRun bool) ([]Bridge, error)
SearchDevices(ctx context.Context, bridge Bridge, timeout time.Duration) ([]Device, error)
ListDevices(ctx context.Context, bridge Bridge) ([]Device, error)
Publish(ctx context.Context, bridge Bridge, devices []Device) error
+1
View File
@@ -15,6 +15,7 @@ var ErrIncorrectToken = errors.New("driver is not accepting authentication infor
var ErrUnexpectedResponse = errors.New("driver api returned unexpected response (wrong driver selected?)")
var ErrBridgeSearchFailed = errors.New("bridge search failed")
var ErrAddressOnlyDryRunnable = errors.New("this address may only be used for a dry run")
var ErrCannotForwardRequest = errors.New("driver is not able to forward requests")
var ErrInvalidAddress = errors.New("invalid mac address")
var ErrPayloadTooShort = errors.New("payload too short")
+1 -1
View File
@@ -168,7 +168,7 @@ func (c *EventCondition) checkDevice(key string, device Device) (matches bool, s
return false, true
}
return c.matches(strconv.FormatFloat(device.State.Temperature, 'f', -1, 64)), false
return c.matches(strconv.Itoa(device.State.Temperature)), false
case "scene":
sceneId := -1
for _, assignment := range device.SceneAssignments {