Added light sensor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-23 01:16:46 +01:00
parent 780f633c90
commit f13ee65ead
10 changed files with 193 additions and 21 deletions

View File

@@ -53,16 +53,15 @@ func (p *Presence) devicePresenceHandler(client paho.Client, msg paho.Message) {
if p.presence != present {
p.presence = present
msg, err := json.Marshal(Message{
payload, err := json.Marshal(Message{
State: present,
Updated: time.Now().UnixMilli(),
})
if err != nil {
log.Println(err)
}
token := client.Publish("automation/presence", 1, true, msg)
token := client.Publish("automation/presence", 1, true, payload)
if token.Wait() && token.Error() != nil {
log.Println(token.Error())
}