diff --git a/notifications/main.go b/notifications/main.go index 875cb9ed91e1ae45d5517b6054747879ae549e34..3b977322cef4879b1454f014035760e31c7d88da 100644 --- a/notifications/main.go +++ b/notifications/main.go @@ -15,10 +15,8 @@ var oldLaundry []model.LaundryRoom func main() { url := "https://mosogep.sch.bme.hu/api/v1/laundry-room/" - state := 0 for { sendMsg(url) - state = testMsg(state) time.Sleep(time.Second * 30) } @@ -47,6 +45,7 @@ func sendMsg(url string) { old := findOldMachine(machine.Id) if old.Status != machine.Status { machine.LastQueryTime = room.LastQueryTime + machine.FloorId = fmt.Sprintf("%d", room.Id) marshal, err := json.Marshal(machine) if err != nil { log.Fatal(err) @@ -66,35 +65,3 @@ func sendMsg(url string) { } oldLaundry = laundryRooms } - -func testMsg(oldState int) int { - //fmt.Println("test sending...") - var state int - if oldState == 0 { - state = 1 - } else { - state = 0 - } - machine := model.Machine{ - Id: 420, - KindOf: "DR", - Status: state, - Message: "", - LastQueryTime: time.Now(), - } - marshal, err := json.Marshal(machine) - if err != nil { - log.Fatal(err) - } - data := map[string]string{ - "floor": "69", - "old_state": fmt.Sprintf("%d", oldState), - "machine": string(marshal), - } - err = firebase.Send("test", data) - if err != nil { - fmt.Println(err) - } - //fmt.Println("test sent...") - return state -}