Fix: temperature parameter error output
This commit is contained in:
parent
229ade63fc
commit
d60c95b2c6
|
@ -177,7 +177,11 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||||
argHead++
|
argHead++
|
||||||
newTemp, numErr := strconv.Atoi(args[argHead])
|
newTemp, numErr := strconv.Atoi(args[argHead])
|
||||||
if numErr != nil || newTemp > 500 || newTemp < 153 {
|
if numErr != nil || newTemp > 500 || newTemp < 153 {
|
||||||
return fmt.Errorf("given temperature is not a valid number: %w", numErr)
|
terr := fmt.Errorf("given temperature is not a valid number: %w", numErr)
|
||||||
|
if numErr == nil {
|
||||||
|
terr = fmt.Errorf("temperature must be greater than 153 and less than 500")
|
||||||
|
}
|
||||||
|
return terr
|
||||||
}
|
}
|
||||||
actions = append(actions, func() error {
|
actions = append(actions, func() error {
|
||||||
err := target.Ct(uint16(newTemp))
|
err := target.Ct(uint16(newTemp))
|
||||||
|
|
Loading…
Reference in New Issue