mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-06 01:15:10 -06:00
fix refactor error
This commit is contained in:
3
app.go
3
app.go
@@ -2,6 +2,7 @@ package gomeassistant
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@@ -139,7 +140,7 @@ func getSunriseSunset(a *app, sunrise bool, offset []DurationString) carbon.Carb
|
|||||||
// get next sunrise/sunset time from HA
|
// get next sunrise/sunset time from HA
|
||||||
state, err := a.state.Get("sun.sun")
|
state, err := a.state.Get("sun.sun")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("Couldn't get sun.sun state from HA to calculate", printString)
|
panic(fmt.Sprintf("Couldn't get sun.sun state from HA to calculate %s", printString))
|
||||||
}
|
}
|
||||||
|
|
||||||
nextSetOrRise := carbon.Parse(state.Attributes[attrKey].(string))
|
nextSetOrRise := carbon.Parse(state.Attributes[attrKey].(string))
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ func SubscribeToEventType(eventType string, conn *websocket.Conn, ctx context.Co
|
|||||||
}
|
}
|
||||||
err := WriteMessage(e, conn, ctx)
|
err := WriteMessage(e, conn, ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("Error writing to websocket: ", err)
|
panic(fmt.Sprintf("Error writing to websocket: %s", err))
|
||||||
}
|
}
|
||||||
// m, _ := ReadMessage(conn, ctx)
|
// m, _ := ReadMessage(conn, ctx)
|
||||||
// log.Default().Println(string(m))
|
// log.Default().Println(string(m))
|
||||||
|
|||||||
Reference in New Issue
Block a user