When I became a dad, I wanted to track my daughter’s sleep quality without any intrusive way and without buying any additional trackers. We were already using a Snoo smart sleeper that is a responsive bassinet that adds sleep by responding to a baby’s cries with white noise and motion to soothe fussing. The important part is they make all this data available through its app and we can monitor the current status and all the past session details through the app.
Being a Home Assistant enthusiast, I wanted to track everything from one place and maybe write some automation based on the current state, so I set out to integrate this with Home Assistant. An example – When the baby is awake, alert everyone in the house (announce through echo dots, live stream the nursery camera on TV, push notifications, Turn the lights on at 20% brightness).
Development
I followed this 4 step process when I created the Snoo Smart Sleeper custom component for Home Assistant.
- Reverse engineer the API if either the API is not public and it’s not documented by anyone else
- I usually use network proxy (e.g. Charles, Fiddler, Proxyman) to intercept and record network traffic
- Create a Postman collection with documentation
- For example, here is the Postman collection with documentation I created after reverse engineering the API for Snoo smart sleeper – Postman Collection
- Create a Python module as a wrapper for the API
- For example, here is the Python module I published on pypi – pysnooapi
- This helps other developers use this as a client for their own projects and leaves room for extending the client with additional use cases and separates the client development from integration component with Home Assistant
- Create a Home Assistant custom component which uses the python wrapper as a dependency
Screenshots
Here is the result of the above 4 step process – ha-snoo and some screenshots below.
2 thoughts on “Tracking baby’s sleep without wearable”