display-epaper/run_darwin_arm64.go

36 lines
690 B
Go
Raw Normal View History

2024-09-15 09:01:13 +02:00
package main
import (
2024-09-15 10:46:07 +02:00
"context"
"fmt"
"github.com/Crocmagnon/display-epaper/home_assistant"
2024-09-15 23:25:17 +02:00
"github.com/Crocmagnon/display-epaper/weather"
2024-09-15 09:01:13 +02:00
"github.com/llgcode/draw2d/draw2dimg"
2024-09-15 12:00:36 +02:00
"time"
2024-09-15 09:01:13 +02:00
)
2024-09-15 23:25:17 +02:00
func run(
ctx context.Context,
_ time.Duration,
2024-09-16 18:15:42 +02:00
_ time.Duration,
2024-09-15 23:25:17 +02:00
weatherClient *weather.Client,
2024-09-18 22:26:40 +02:00
hassClient *home_assistant.Client,
2024-09-15 23:25:17 +02:00
) error {
img, err := getImg(ctx, func() time.Time {
t, err := time.Parse(time.DateOnly, "2024-08-01zzz")
if err != nil {
return time.Now()
}
return t
}, weatherClient, hassClient)
2024-09-15 09:01:13 +02:00
if err != nil {
return err
2024-09-15 09:01:13 +02:00
}
2024-09-15 21:18:06 +02:00
if err := draw2dimg.SaveToPngFile("out/black.png", img); err != nil {
return fmt.Errorf("saving img: %w", err)
2024-09-15 21:18:06 +02:00
}
2024-09-15 09:01:13 +02:00
return nil
}