fix: sleep duration again & send sleep duration to mqtt#53
fix: sleep duration again & send sleep duration to mqtt#53lanrat merged 3 commits intolanrat:mainfrom
Conversation
feat: send current sleep duration to mqtt
|
Also made mqtt expire_after configurable, I have set my |
|
Is there a test case that can be added to ensure future updates don't break this functionality? Since I don't use this functionality myself, it would help guarantee it keeps working into the future. |
|
Unfortuntely not, at least not easily. The main issue with this not working was that I added the The only way you could test for that is by actually building homeplate with a valid config and then run a test using https://github.com/espressif/qemu, but that seems quite a bit of work which I don't think is worth it. By publishing the sleep status to home assistant we at least have the next best thing, i.e. that we can easily monitor if it still works correctly ;) |

Ok, third time is the charm 😞
This is starting to get embarrassing, but in my defense I didn't realize before I had configured my
TIME_TO_SLEEP_MINto 5 minutes and also configured the variable sleep duration's during the day to be 5 minutes. So while I was working on this during the day, it seemed it was using the correct sleep duration even though it was just using the default sleep :(As a similar issue could exists for other people when your configured time slots are f.e. not continuous, I realized it would be helpful to store the actual sleep duration as diagnostic in mqtt/hass so you can check it's correct even when you are normally sleeping.
I'll make this a draft pr for now and check tomorrow that it's actually fixed now...
fyi @felixh10r