8 const testMAC = "fc610e7f98aa"
10 type fakeGateway struct {
18 func (g *fakeGateway) Status(ctx context.Context) ([]State, error) {
24 return append([]State(nil), g.states...), nil
27 func (g *fakeGateway) Action(ctx context.Context, mac string, action Action) (State, error) {
33 g.actions = append(g.actions, action)
35 for index := range g.states {
36 state := &g.states[index]
41 if action.Power != nil {
42 state.Power = *action.Power
45 if action.TargetTemperature != nil {
46 state.TargetTemperature = *action.TargetTemperature
55 func (g *fakeGateway) request(ctx context.Context) error {
56 g.starts = append(g.starts, time.Now())
58 timer := time.NewTimer(g.delay)
71 func testState() State {
74 TargetTemperature: 20,
75 CurrentTemperature: 19.5,