Skip to content

Commit

Permalink
Prepare bedroom loop
Browse files Browse the repository at this point in the history
  • Loading branch information
claes committed Nov 27, 2024
1 parent c69cea5 commit da4f879
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/loop-bedroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ func (l *BedroomLoop) Init(m *mqttMessageHandler, config Config) {
sm.Configure(bedroomBlindsStateOpen).
OnEntry(l.stateMachineMQTTBridge.openBedroomBlinds).
Permit("mqttEvent", bedroomBlindsStateClosed, l.stateMachineMQTTBridge.guardStateBedroomBlindsClosed).
PermitReentry("timer").
OnEntryFrom("timer", l.stateMachineMQTTBridge.refreshBedroomBlinds)

sm.Configure(bedroomBlindsStateClosed).
OnEntry(l.stateMachineMQTTBridge.closeBedroomBlinds).
Permit("mqttEvent", bedroomBlindsStateOpen, l.stateMachineMQTTBridge.guardStateBedroomBlindsOpen).
Permit("timer", bedroomBlindsStateClosed).
PermitReentry("timer").
OnEntryFrom("timer", l.stateMachineMQTTBridge.refreshBedroomBlinds)

go func() {
Expand Down Expand Up @@ -76,7 +77,7 @@ func (l *BedroomLoop) Init(m *mqttMessageHandler, config Config) {

func (l *BedroomLoop) ProcessEvent(ev MQTTEvent) []MQTTPublish {
if l.isInitialized {
slog.Info("Process event", "name", l.stateMachineMQTTBridge.name)
slog.Debug("Process event", "name", l.stateMachineMQTTBridge.name)
l.stateMachineMQTTBridge.detectBedroomBlindsOpen(ev)

l.stateMachineMQTTBridge.stateValueMap.LogState()
Expand Down

0 comments on commit da4f879

Please sign in to comment.