Closed sejgit closed 11 months ago
cc #36
I think that's reflected as a todo in the readme:
- [ ] Flip light status on when motion detected packet is sent
got it. thanks for all you are doing!
I think that's reflected as a todo in the readme:
- [ ] Flip light status on when motion detected packet is sent
That TODO appears to be for updating light status on motion detected. This issue is related to the fact that the motion status is never reset to "clear." Going through the code, while the internal motion flag itself is set to clear (0) each time through the status loop (and several other places), there are not times when setting the motion flag to 0 results in a "clear" MQTT message being published. A message is only published when the motion flag is set to 1 ("detected"). What's more, it is published as a retained message, so the status in the MQTT broker will always return "detected" if it is queried or on new subscriptions, whether there is motion or not.
IMO, it should be either 1) managed like the other statuses with a previousMotionState and clear and detected messages posted each time it changes, or 2) should not be retained message with "detected" messages published only when motion is detected (and thus we would never expect a "clear" status).
you likely know this one and are working on it but I just figured out (v2.56) that motion is detecting and updating mqtt it just never clears. related, when you walk into garage and motion turns the light on, it ends up making mqtt the opposite of reality. ie. off=on