refactor: websockets into 'connect' module, rename & adjust generally

This commit is contained in:
2025-08-01 20:34:45 -05:00
parent 102a4e7438
commit 9b8ef545a6
32 changed files with 202 additions and 149 deletions

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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

View File

@@ -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

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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.

View File

@@ -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 {

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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}
}

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */