Video: Improving a GenServer, My IoT Lightswitch
2021-12-21Underjord is a tiny, wholesome team doing Elixir consulting and contract work. If you like the writing you should really try the code. See our services for more information.
GenServer is the typical Actor abstraction in Erlang and Elixir. I’ve used one for talking to my Elgato Keylights in the lightswitch project. I made it sort of dumb.
It was a quick job so I want to improve it in a few ways.
- Make it not need to pull the new state from lights before sending commands.
- Pull state in the background occasionally to keep relatively up-to-date.
- Always fetch status after sending commands.
- If there is time, improve the lighting on the keybow to represent the state of the lights.
Spoiler, most of it got done during the stream :)
Underjord is a 4 people team doing Elixir consulting and contract work. If you like the writing you should really try the code. See our services for more information.
Note: Or try the videos on the YouTube channel.