Hello, I’m very new to Elixir and looking to get started on a little project I’m interested in. Inspired by this blog post I’d like to build a “simple” client library giving users a simpler way to use Home Assistant’s WebSocket API.
I think a library like this give users the most flexibility in how they write automations and keeps the project scope limited for my own sanity
But since Elixir and writing libraries in general are very new to me, I’d love to get some pointers on how to go about that. Things I’ve been wondering:
- I thought about building the library around callbacks, e.g. a callback for Home Assistant’s state changes, allowing the user to pattern match what they need. How do I build a WebSocket client around this concept
- Is using a GenServer the way to go? I’d need to keep a state
- Besides the URL there’s also a token I’d need to connect to Home Assistant. Is there a “best practice” on how to configure stuff like this?
Some good libraries I can use as guidance for code quality and stuff would probably help if you’ve got some suggestions.
For reference, this is Home Assistant’s WebSocket API
Thank you very much for helping!