mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-10 14:07:26 -06:00
refactor: websockets into 'connect' module, rename & adjust generally
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type AdaptiveLighting struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type AlarmControlPanel struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/types"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Climate struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Cover struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -2,11 +2,11 @@ package services
|
||||
|
||||
import (
|
||||
"github.com/Xevion/go-ha/internal"
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
// Fire an event
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
type HomeAssistant struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
// TurnOn a Home Assistant entity. Takes an entityId and an optional
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputBoolean struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputButton struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputDatetime struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputNumber struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputText struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Light struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Lock struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type MediaPlayer struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/types"
|
||||
)
|
||||
|
||||
type Notify struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
// Notify sends a notification. Takes a types.NotifyRequest.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
type Number struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
func (ib Number) SetValue(entityId string, value float32) error {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Scene struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Script struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -2,7 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"github.com/Xevion/go-ha/internal"
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
func BuildService[
|
||||
@@ -29,7 +29,7 @@ func BuildService[
|
||||
Timer |
|
||||
Vacuum |
|
||||
ZWaveJS,
|
||||
](conn *ws.WebsocketWriter) *T {
|
||||
](conn *ws.HAConnection) *T {
|
||||
return &T{conn: conn}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Switch struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Timer struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
connect "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type TTS struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Vacuum struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/websocket"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type ZWaveJS struct {
|
||||
conn *ws.WebsocketWriter
|
||||
conn *ws.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
Reference in New Issue
Block a user