1
0
Fork 0

CallServiceManual

main v0.7.0
Jordan Hotmann 2023-11-07 15:55:04 -07:00
parent 06d87ea689
commit db1ac7ffd6
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
2 changed files with 16 additions and 8 deletions

View File

@ -33,6 +33,10 @@ func (c *RestClient) GetState(entityId string) (StateData, error) {
func (c *RestClient) CallService(entityId string, service string, extras ...map[string]any) error { func (c *RestClient) CallService(entityId string, service string, extras ...map[string]any) error {
domain := strings.Split(entityId, ".")[0] domain := strings.Split(entityId, ".")[0]
return c.CallServiceManual(domain, entityId, service, extras...)
}
func (c *RestClient) CallServiceManual(domain string, entityId string, service string, extras ...map[string]any) error {
data := map[string]any{ data := map[string]any{
"entity_id": entityId, "entity_id": entityId,
} }

View File

@ -29,15 +29,19 @@ var MessageType = struct {
// Home Assistant device domains // Home Assistant device domains
var Domains = struct { var Domains = struct {
Light string Light string
Switch string Switch string
Lock string Lock string
Cover string Cover string
Homeassistant string
Group string
}{ }{
Light: "light", Light: "light",
Switch: "switch", Switch: "switch",
Lock: "lock", Lock: "lock",
Cover: "cover", Cover: "cover",
Homeassistant: "homeassistant",
Group: "group",
} }
// Home Assistant services // Home Assistant services