fix: breaking changes
changes: - remove remote operations - add function to write measured values into a channel - add get humidity sensors from config - add get temperature sensors from config - remove FileLogger - exclude some functions from pkf into internal
This commit is contained in:
@ -5,16 +5,13 @@ import (
|
||||
"io"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/volker-raschek/flucky/pkg/logger"
|
||||
|
||||
"github.com/volker-raschek/flucky/pkg/internal/temperature"
|
||||
|
||||
"github.com/volker-raschek/flucky/pkg/config"
|
||||
"github.com/volker-raschek/flucky/pkg/internal/temperature"
|
||||
"github.com/volker-raschek/flucky/pkg/types"
|
||||
)
|
||||
|
||||
// PrintHumidities displays a list of humidities
|
||||
func PrintHumidities(humidities []*types.Humidity, cnf *config.FluckyConfig, w io.Writer) {
|
||||
func PrintHumidities(humidities []*types.Humidity, cnf *config.Configuration, w io.Writer) {
|
||||
// determine all humidity sensors based on the humidiy values
|
||||
sensors := []*types.Sensor{}
|
||||
for _, humidity := range humidities {
|
||||
@ -71,37 +68,8 @@ func PrintHumidities(humidities []*types.Humidity, cnf *config.FluckyConfig, w i
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
func PrintLoggers(cnf *config.FluckyConfig, w io.Writer) {
|
||||
// declare tabwriter
|
||||
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||
|
||||
fmt.Fprintf(w, "type\tvalue\t\tlocation\n")
|
||||
|
||||
for _, logfile := range cnf.LogFiles[logger.LogTemperature] {
|
||||
fmt.Fprintf(w, "file\t%v\t%v\n", logger.LogTemperature, logfile)
|
||||
}
|
||||
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
// PrintRemotes displays a list with all configured remote addresses
|
||||
func PrintRemotes(cnf *config.FluckyConfig, w io.Writer) error {
|
||||
|
||||
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||
|
||||
fmt.Fprint(tw, "name\taddress\tenabled\tregistered\n")
|
||||
|
||||
for _, remote := range cnf.Remotes {
|
||||
fmt.Fprintf(tw, "%v\t%v\t%v\t%v\n", remote.Name, remote.Address, remote.Enabled, remote.Registered)
|
||||
}
|
||||
|
||||
tw.Flush()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PrintSensors displays a list with all configured sensors
|
||||
func PrintSensors(cnf *config.FluckyConfig, w io.Writer) error {
|
||||
func PrintSensors(cnf *config.Configuration, w io.Writer) error {
|
||||
|
||||
// declar tabwriter
|
||||
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
|
||||
@ -118,7 +86,7 @@ func PrintSensors(cnf *config.FluckyConfig, w io.Writer) error {
|
||||
}
|
||||
|
||||
// PrintTemperatures displays a list of temperatures
|
||||
func PrintTemperatures(temperatures []*types.Temperature, cnf *config.FluckyConfig, w io.Writer) {
|
||||
func PrintTemperatures(temperatures []*types.Temperature, cnf *config.Configuration, w io.Writer) {
|
||||
|
||||
sensors := temperature.GetSensorsByTemperatures(temperatures, cnf)
|
||||
|
||||
|
Reference in New Issue
Block a user