update timer auto cut off mcb
This commit is contained in:
+8
-1
@@ -14,6 +14,9 @@ func main() {
|
||||
// 1. Konek Database
|
||||
config.ConnectDatabase()
|
||||
|
||||
// 🌟 TAMBAHAN UNTUK TIMER: Nyalakan mesin Cron Timer di background
|
||||
controllers.StartPowerCronWorker()
|
||||
|
||||
// 2. AutoMigrate
|
||||
config.DB.AutoMigrate(&models.User{}, &models.Room{}, &models.Booking{}, &models.ClassSchedule{})
|
||||
|
||||
@@ -65,7 +68,7 @@ func main() {
|
||||
protected.DELETE("/schedules/:id", controllers.DeleteSchedule)
|
||||
}
|
||||
|
||||
// 5. Jalur IoT ESP32
|
||||
// 5. Jalur IoT ESP32 & Kontrol Daya
|
||||
r.POST("/api/sensor/energy", controllers.UpdateRoomPower)
|
||||
r.POST("/api/hardware/verify", controllers.VerifyHardwareCode)
|
||||
r.POST("/api/hardware/control", controllers.ControlHardware)
|
||||
@@ -73,6 +76,10 @@ func main() {
|
||||
r.GET("/api/hardware/power-status", controllers.GetPowerStatus)
|
||||
r.POST("/api/power/global", controllers.GlobalPowerControl)
|
||||
|
||||
// 🌟 RUTE BARU UNTUK TIMER AUTO-CUTOFF
|
||||
r.GET("/api/power/timer", controllers.GetTimerConfig)
|
||||
r.POST("/api/power/timer", controllers.SetTimerConfig)
|
||||
|
||||
r.Run(":8080")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user