change scenes to use name as primary identifier.

This commit is contained in:
2022-08-19 23:17:39 +02:00
parent 382111583d
commit ca5dc75a1c
4 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ import (
func NewSceneMap(resolver device.Resolver) *SceneMap {
return &SceneMap{
resolver: resolver,
sceneMap: make(map[string]int64, 64),
sceneMap: make(map[string]string, 64),
}
}
@@ -19,10 +19,10 @@ type SceneMap struct {
resolver device.Resolver
mu sync.Mutex
sceneMap map[string]int64
sceneMap map[string]string
}
func (s *SceneMap) SceneID(id string) *int64 {
func (s *SceneMap) SceneID(id string) *string {
s.mu.Lock()
defer s.mu.Unlock()
@@ -48,7 +48,7 @@ func (s *SceneMap) HandleCommand(_ *lucifer3.EventBus, command lucifer3.Command)
if len(matched) > 0 {
s.mu.Lock()
for _, ptr := range matched {
s.sceneMap[ptr.ID] = command.SceneID
s.sceneMap[ptr.ID] = command.SceneName
}
s.mu.Unlock()
}