diff --git a/internal/services/adaptive_lighting.go b/internal/services/adaptive_lighting.go new file mode 100644 index 0000000..5b09890 --- /dev/null +++ b/internal/services/adaptive_lighting.go @@ -0,0 +1,26 @@ +package services + +import ( + ws "saml.dev/gome-assistant/internal/websocket" +) + +/* Structs */ + +type AdaptiveLighting struct { + conn *ws.WebsocketWriter +} + +/* Public API */ + +// Set manual control for an adaptive lighting entity. +func (al AdaptiveLighting) SetManualControl(entityId string, enabled bool) error { + req := NewBaseServiceRequest("") + req.Domain = "adaptive_lighting" + req.Service = "set_manual_control" + req.ServiceData = map[string]any{ + "entity_id": entityId, + "manual_control": enabled, + } + + return al.conn.WriteMessage(req) +} diff --git a/internal/services/services.go b/internal/services/services.go index dab7c57..23f123c 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -6,7 +6,8 @@ import ( ) func BuildService[ - T AlarmControlPanel | + T AdaptiveLighting | + AlarmControlPanel | Climate | Cover | Light | diff --git a/service.go b/service.go index 7d243a3..8224743 100644 --- a/service.go +++ b/service.go @@ -6,6 +6,7 @@ import ( ) type Service struct { + AdaptiveLighting *services.AdaptiveLighting AlarmControlPanel *services.AlarmControlPanel Climate *services.Climate Cover *services.Cover @@ -31,6 +32,7 @@ type Service struct { func newService(conn *ws.WebsocketWriter) *Service { return &Service{ + AdaptiveLighting: services.BuildService[services.AdaptiveLighting](conn), AlarmControlPanel: services.BuildService[services.AlarmControlPanel](conn), Climate: services.BuildService[services.Climate](conn), Cover: services.BuildService[services.Cover](conn),