add zwavejs service

This commit is contained in:
Sam Lewis
2023-12-29 21:30:41 -05:00
parent 16fb52b8ee
commit 47a9910fda
3 changed files with 33 additions and 1 deletions

View File

@@ -25,7 +25,8 @@ func BuildService[
Number |
Scene |
TTS |
Vacuum,
Vacuum |
ZWaveJS,
](conn *ws.WebsocketWriter, ctx context.Context) *T {
return &T{conn: conn, ctx: ctx}
}

View File

@@ -0,0 +1,29 @@
package services
import (
"context"
ws "saml.dev/gome-assistant/internal/websocket"
)
/* Structs */
type ZWaveJS struct {
conn *ws.WebsocketWriter
ctx context.Context
}
/* Public API */
// ZWaveJS bulk_set_partial_config_parameters service.
func (zw ZWaveJS) BulkSetPartialConfigParam(entityId string, parameter int, value any) {
req := NewBaseServiceRequest(entityId)
req.Domain = "zwave_js"
req.Service = "bulk_set_partial_config_parameters"
req.ServiceData = map[string]any{
"parameter": parameter,
"value": value,
}
zw.conn.WriteMessage(req, zw.ctx)
}