mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-09 18:07:15 -06:00
chore: reformat, normalize imports
This commit is contained in:
@@ -4,14 +4,10 @@ import (
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type AdaptiveLighting struct {
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Set manual control for an adaptive lighting entity.
|
||||
func (al AdaptiveLighting) SetManualControl(entityId string, enabled bool) error {
|
||||
req := NewBaseServiceRequest("")
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type AlarmControlPanel struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Send the alarm the command for arm away.
|
||||
// Takes an entityId and an optional
|
||||
// map that is translated into service_data.
|
||||
|
||||
@@ -5,14 +5,10 @@ import (
|
||||
"github.com/Xevion/go-ha/types"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Climate struct {
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (c Climate) SetFanMode(entityId string, fanMode string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "climate"
|
||||
|
||||
@@ -4,14 +4,10 @@ import (
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Cover struct {
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Close all or specified cover. Takes an entityId.
|
||||
func (c Cover) Close(entityId string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
|
||||
@@ -17,8 +17,6 @@ type FireEventRequest struct {
|
||||
EventData map[string]any `json:"event_data,omitempty"`
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Fire an event. Takes an event type and an optional map that is sent
|
||||
// as `event_data`.
|
||||
func (e Event) Fire(eventType string, eventData ...map[string]any) error {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputBoolean struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputBoolean) TurnOn(entityId string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_boolean"
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputButton struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputButton) Press(entityId string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_button"
|
||||
|
||||
@@ -4,17 +4,13 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputDatetime struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputDatetime) Set(entityId string, value time.Time) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_datetime"
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputNumber struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputNumber) Set(entityId string, value float32) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_number"
|
||||
|
||||
@@ -4,14 +4,10 @@ import (
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type InputText struct {
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputText) Set(entityId string, value string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_text"
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Light struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// TurnOn a light entity. Takes an entityId and an optional
|
||||
// map that is translated into service_data.
|
||||
func (l Light) TurnOn(entityId string, serviceData ...map[string]any) error {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Lock struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Lock a lock entity. Takes an entityId and an optional
|
||||
// map that is translated into service_data.
|
||||
func (l Lock) Lock(entityId string, serviceData ...map[string]any) error {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type MediaPlayer struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Send the media player the command to clear players playlist.
|
||||
// Takes an entityId.
|
||||
func (mp MediaPlayer) ClearPlaylist(entityId string) error {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/types"
|
||||
)
|
||||
|
||||
type Notify struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
// Notify sends a notification. Takes a types.NotifyRequest.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
type Number struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
func (ib Number) SetValue(entityId string, value float32) error {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Scene struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Apply a scene. Takes map that is translated into service_data.
|
||||
func (s Scene) Apply(serviceData ...map[string]any) error {
|
||||
req := NewBaseServiceRequest("")
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Script struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Reload a script that was created in the HA UI.
|
||||
func (s Script) Reload(entityId string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
|
||||
@@ -2,7 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"github.com/Xevion/go-ha/internal"
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
func BuildService[
|
||||
@@ -29,7 +29,7 @@ func BuildService[
|
||||
Timer |
|
||||
Vacuum |
|
||||
ZWaveJS,
|
||||
](conn *ws.HAConnection) *T {
|
||||
](conn *connect.HAConnection) *T {
|
||||
return &T{conn: conn}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Switch struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (s Switch) TurnOn(entityId string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "switch"
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Timer struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// See https://www.home-assistant.io/integrations/timer/#action-timerstart
|
||||
func (t Timer) Start(entityId string, duration string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
connect "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type TTS struct {
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Remove all text-to-speech cache files and RAM cache.
|
||||
func (tts TTS) ClearCache() error {
|
||||
req := NewBaseServiceRequest("")
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type Vacuum struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// Tell the vacuum cleaner to do a spot clean-up.
|
||||
// Takes an entityId.
|
||||
func (v Vacuum) CleanSpot(entityId string) error {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
ws "github.com/Xevion/go-ha/internal/connect"
|
||||
"github.com/Xevion/go-ha/internal/connect"
|
||||
)
|
||||
|
||||
/* Structs */
|
||||
|
||||
type ZWaveJS struct {
|
||||
conn *ws.HAConnection
|
||||
conn *connect.HAConnection
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
// ZWaveJS bulk_set_partial_config_parameters service.
|
||||
func (zw ZWaveJS) BulkSetPartialConfigParam(entityId string, parameter int, value any) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
|
||||
Reference in New Issue
Block a user