From b3985f8b9b8579db6cd9da6fea2f05b0f9828c83 Mon Sep 17 00:00:00 2001 From: Florian Eitel Date: Sun, 11 Aug 2019 21:55:21 +0200 Subject: [PATCH] Drop BridgeId from state and support multiple bridges --- config.go | 2 +- fetchdata.go | 1 - move.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 29a621e..6273859 100644 --- a/config.go +++ b/config.go @@ -1,4 +1,4 @@ package main -var BridgeId = "" + var clientSecret = "" var clientId = "" diff --git a/fetchdata.go b/fetchdata.go index c9ae608..88b714d 100644 --- a/fetchdata.go +++ b/fetchdata.go @@ -33,7 +33,6 @@ func fetchData(tokenFile string) *State { var state = &State{ Api: client, - BridgeId: BridgeId, Auth: httptransport.BearerToken(token.AccessToken), NameForRoom: make(map[string]string), RoomForName: make(map[string]string), diff --git a/move.go b/move.go index 14d47a8..3e8a55e 100644 --- a/move.go +++ b/move.go @@ -15,7 +15,7 @@ func Move(state *State, shutters []string, position int64) { var updates []*models.ModulePercentage for _, x := range shutters { m := &models.ModulePercentage{ - Bridge: state.BridgeId, + Bridge: state.ModuleStatus[state.ModuleForName[x]].Bridge, ID: state.ModuleForName[x], TargetPosition: position, }