Merge pull request #31 from saml-dev/adaptive-lighting

add adaptive lighting service
This commit is contained in:
saml-dev
2025-01-20 20:30:29 -05:00
committed by GitHub
3 changed files with 30 additions and 1 deletions

View File

@@ -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)
}

View File

@@ -6,7 +6,8 @@ import (
)
func BuildService[
T AlarmControlPanel |
T AdaptiveLighting |
AlarmControlPanel |
Climate |
Cover |
Light |

View File

@@ -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),