mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-06 13:15:14 -06:00
33 lines
583 B
Go
33 lines
583 B
Go
package services
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gorilla/websocket"
|
|
ws "github.com/saml-dev/gome-assistant/internal/websocket"
|
|
)
|
|
|
|
/* Structs */
|
|
|
|
type InputButton struct {
|
|
conn *websocket.Conn
|
|
ctx context.Context
|
|
}
|
|
|
|
/* Public API */
|
|
|
|
func (ib InputButton) Press(entityId string) {
|
|
req := NewBaseServiceRequest(entityId)
|
|
req.Domain = "input_button"
|
|
req.Service = "press"
|
|
|
|
ws.WriteMessage(req, ib.conn, ib.ctx)
|
|
}
|
|
|
|
func (ib InputButton) Reload() {
|
|
req := NewBaseServiceRequest("")
|
|
req.Domain = "input_button"
|
|
req.Service = "reload"
|
|
ws.WriteMessage(req, ib.conn, ib.ctx)
|
|
}
|