RomanKotov
Exshome - DIY Elixir Smart Home
Hi everyone!
Exshome is a DIY smart home solution.
General idea behind it is to have multiple applications, like clock and music player.
Each application consists of dependencies. You can get a value of a dependency, subscribe to it, etc. The other parts of application also use the idea of broadcasting changes. It also allows to cover the application with tests.
For example, a clock page has ‘current_time’ dependency. User subscribes to it when visits a page, and unsubscribes from it on leave. The page updates every time the ‘current_time’ changes.
‘Current_time’ depends on a ‘timezone’. When the user updates a ‘timezone’, everyone else sees the changes immediately.
Tech stack:
- Phoenix LiveView.
- Ecto.
- Sqlite3.
- Tailwind.
Project goals:
- It should be mobile-friendly and support a dark theme.
- Be easy to extend.
- Have a nice test coverage. I have set CI coverage threshold of 90%.
- Should be easy to set up on different Single Board Computers.
I have tested it on MacOS and Linux computers. There are no plans for Windows support. It is not a Neves application now, but there are plans of adding support for it in future.
You can try setting it up with this snippet:
wget https://raw.githubusercontent.com/exshome/exshome/main/bin/exshome
chmod +x exshome
./exshome
It downloads the launcher, and makes it executable. Launcher uses Mix.install/2 to start an application. You can download launcher to some other place, like /bin to make launcher accessible across the system.
NOTE: This snippet uses launcher from main branch and it can use unreleased version. Feel free to edit a version inside it. You can find the latest released version here: exshome | Hex
I stream the development process from time to time on Twitch. Recordings are also available at YouTube.
Here are the docs for an application. Plan to fill them as the architecture matures.
The UI is quite simple and I plan to focus on the features first, and then make it usable ![]()
Will be glad to get any feedback about Exshome.
Most Liked
Sebb
Its completely unclear to me what this does.
Smart home for me means connecting actuators (lights, blinds, …) to sensors (button, motion detector, …).
What do you mean by smart home? How does exshome compare to eg https://www.home-assistant.io/ or openhab?
RomanKotov
Thanks for your questions.
I see Exshome as an application that allows to automate some home actions. Its architecture focuses on the automation.
Let me tell you a history behind this project:
TLDR, project history
We wanted to listen to a music in our office back in 2018. I have removed the dust from Orange PI Prime and connected it to an audio system. There were some music player solutions, but they required user interaction to start playback. Another ones had other limitations or felt too complicated for my purpose.I have spend my weekend to create a simple CLI player on top of mpg123. It picks a random file from folder and plays it. It exits on the file end. This script also generates simple “status” file, and accepts user input via some dark bash magic ![]()
I have used systemd as a supervisor, so it started the script on system startup and restarted it when the file ended.
This solution was extended with cloud commander, so people were able to upload their tracks.
Repeating tracks were not the best thing to listen to, so we have decided to listen to a neutral radio on workdays and launch our tracks on holidays, to make them feel special.
This led to another systemd template together with a stripped bash player script.
The team asked for YouTube tracks and playlists, because it is more fun to see the playlist contributors. It became more easy to find who to blame for ugly track in the playlist ![]()
This led to a local_assistant thing. I have made it public today too ![]()
It is a Phoenix Live View application using Mopidy (together with Mopidy-YouTube) as a backend. It was fun to create it, and it was a prototype for Exshome. It is far from perfect, but it works well for a couple of years already.
I liked the results and wanted to make it something more than just a player. The architecture of local_assistant does not allow extend and test it easily. We have also had some stability issues with Mopidy Youtube integration over this time. My Mopidy client was synchronous and polled the server too hard every second, instead of subscribing to the changes.
That’s why I have decided to create another version of application, together with another player backend. Exshome uses MPV, and its client is much more tolerant to the server ![]()
We have had some routine player tasks at the office: someone needed to start it at the start of a working day, shut it down in the evening, so neighbours can sleep nicely and turn on our special Friday or Christmas Playlist and have a party ![]()
Sometimes previous players lacked observability. If they refused to play a track, I needed to dig into their logs to find out outdated youtube_dl version, or deal with some network issue, etc. Exshome already has many features to deal with this issue. It is easy to attach to get output of running MPV application, its state, every message, etc. There is no UI for it right now.
Now project has building blocks for applications and two of apps: Clock and Player. Both are very simple, but they are enough for me. I plan to start implementation of Automation app. It will be responsible for bringing more “smart-homeness” into the project ![]()
I also have an Arduino kit full of sensors, and actuators in front of me. It gathers the dust and demands for a real work. All I can do now is just tell it to wait for a brighter future ![]()
I can not compare exshome to home-assistant, or openhab. They are way more mature. Thanks for the link and your suggestion. I can use these solutions as inspiration.
I plan to attach low-level things (like Arduino) to Exshome and automate everyday’s life with it. So it will be more DIY thing, than buying a ready-made hub from smart home provider and attaching ready-made locks, sensors and equipment via Z-Wave to it. Possibly the project will have these integrations someday. I will be happy if it help someone to release own creativity.
The project is full of Elixir code and tests. I like hacking it and hope that someone can find it useful too ![]()
Conclusion: the project is in early stage now and it looks more like a feature-less player (which can fail if there is no MPV installed) and a clock. It dreams to become Smart Home solution one day, but now it has only Smart Home as a part of its title.
Plan to post updates about its state in this thread ![]()
Sebb
Thanks for the background.
I’m also thinking about building a smarthome solution in Elixir.
It would be focused on bringing together different protocols, at a minimum:
- KNX: Smart home and building solutions | KNX
- EnOcean - EnOcean
- Smart lights and home security | Philips Hue (using the bridge, which is very easy, in contrast to supporting zigbee ZHA which would be a huge task, but very nice)
also some services like
- IFTTT
- some weather API
- some geofencing solution
- some calendar solution
and some logic
- scenes controller
- timers
- rules (luerl maybe)
I already had a deeper look at the architecture of home assistant (which is a very powerful tool).
It is extremely complex and seems to rebuild lots of stuff we get for free with BEAM/OTP.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









