Added automation for door that temporarily sets presence (15 min) if no one is present yet
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-12-03 00:04:57 +01:00
parent 2b4e66b978
commit 51958a0542
6 changed files with 66 additions and 6 deletions

View File

@@ -23,6 +23,10 @@ type Message struct {
Updated int64 `json:"updated"`
}
func (p *Presence) Current() bool {
return p.presence
}
func (p *Presence) devicePresenceHandler(client paho.Client, msg paho.Message) {
name := strings.Split(msg.Topic(), "/")[2]
@@ -48,8 +52,6 @@ func (p *Presence) devicePresenceHandler(client paho.Client, msg paho.Message) {
}
}
log.Printf("Setting overall presence: %t\n", present)
if p.presence != present {
p.presence = present