velux-cli/print.go

24 lines
741 B
Go
Raw Normal View History

package main
import "fmt"
func PrintStatus(state *State) {
for _, r := range state.RoomStatus {
if r.Temperature != 0 {
fmt.Printf(
"%s (air quality: %d / CO2: %d / Temperature: %d / Humidity: %d / Lux: %d)\n",
2019-08-11 20:47:16 +02:00
state.NameForRoom[r.ID], r.AirQuality, r.Co2, r.Temperature/10.0, r.Humidity, r.Lux)
} else {
2019-08-11 20:47:16 +02:00
fmt.Printf("%s\n", state.NameForRoom[r.ID])
}
2019-08-11 20:47:16 +02:00
for _, m := range state.ModulesForRoom[r.ID] {
if state.ModuleStatus[m].Type == "NXO" {
fmt.Printf(" - %d %s\n", state.ModuleStatus[m].CurrentPosition, state.NameForModule[m])
} else {
fmt.Printf(" - %s: battery: %d%% rf strength: %d\n", state.NameForModule[m], state.ModuleStatus[m].BatteryPercent, state.ModuleStatus[m].RfStrength)
}
}
}
}