mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-06 01:15:10 -06:00
Return Service errors
Additionally, removed the context that gets passed into the Services but isn't used in one of them. The websockets APIs also don't have any use for context.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
ws "saml.dev/gome-assistant/internal/websocket"
|
||||
)
|
||||
|
||||
@@ -10,12 +8,11 @@ import (
|
||||
|
||||
type InputText struct {
|
||||
conn *ws.WebsocketWriter
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
func (ib InputText) Set(entityId string, value string) {
|
||||
func (ib InputText) Set(entityId string, value string) error {
|
||||
req := NewBaseServiceRequest(entityId)
|
||||
req.Domain = "input_text"
|
||||
req.Service = "set_value"
|
||||
@@ -23,12 +20,12 @@ func (ib InputText) Set(entityId string, value string) {
|
||||
"value": value,
|
||||
}
|
||||
|
||||
ib.conn.WriteMessage(req, ib.ctx)
|
||||
return ib.conn.WriteMessage(req)
|
||||
}
|
||||
|
||||
func (ib InputText) Reload() {
|
||||
func (ib InputText) Reload() error {
|
||||
req := NewBaseServiceRequest("")
|
||||
req.Domain = "input_text"
|
||||
req.Service = "reload"
|
||||
ib.conn.WriteMessage(req, ib.ctx)
|
||||
return ib.conn.WriteMessage(req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user