2018-11-28 17:07:20 +00:00
|
|
|
package sensor
|
|
|
|
|
|
|
|
import (
|
2019-02-22 12:08:58 +00:00
|
|
|
"fmt"
|
|
|
|
|
2018-11-28 17:07:20 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var enabled bool
|
|
|
|
var sensorLocation, wireID, wirePath string
|
|
|
|
|
|
|
|
var addSensorCmd = &cobra.Command{
|
2019-02-22 12:08:58 +00:00
|
|
|
Use: "add",
|
|
|
|
Short: "Add Sensor",
|
|
|
|
Args: cobra.ExactArgs(3),
|
|
|
|
Example: fmt.Sprintf("flucky sensor add indoor dht11 14\nflucky sensor add --wire-id 28-011432f0bb3d outdoor ds18b20 14"),
|
2018-11-28 17:07:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
sensorCmd.AddCommand(addSensorCmd)
|
|
|
|
addSensorCmd.Flags().BoolVarP(&enabled, "enabled", "e", true, "Enable Sensor")
|
|
|
|
addSensorCmd.Flags().StringVarP(&sensorLocation, "sensor-location", "l", "", "Sensor location")
|
|
|
|
addSensorCmd.Flags().StringVarP(&wireID, "wire-id", "i", "", "Wire-ID")
|
|
|
|
addSensorCmd.Flags().StringVarP(&wirePath, "wire-path", "w", "/sys/bus/w1/devices", "Wire device path")
|
|
|
|
}
|