Turtles, a Shelly/Zigbee home automation tool in Elixir
92 points by joisig 1 year ago | 53 comments- smt88 1 year ago> * Rationally, I might have been better off going with Home Assistant, which has ready-made integrations with Shelly, Zigbee dimmers, and probably thousands of other device types, but I wanted complete control and hackability, and I preferred to spend time building my own system rather than learning and customizing Home Assistant and maybe never getting it to work like I want it to.*
This thought was correct. Home Assistant is absolutely incredible, easy to use, polished, and flexible. You can get it to do all of this easily.
I got it installed and configured within ~3 hours.
- pmontra 1 year agoI've got some Shelly Plugs. I decided to operate them with a self made web app running on my home server. That app makes HTTP calls to the API of the plug. It's very simple, just a curl from bash would work. One call to turn on the plug, one to turn it off and one to read the power meter. I put buttons on the web page and it does what I need.
There are no dependecies from other services and especially no dependency from Amazon or Google (the plugs work with them too.) Given the size of the web app maybe it also spared me some time because I suspect that installing, configuring Home Assistant and learning how to use it and what works and what doesn't are not zero time activities.
- Towaway69 1 year agoI don't myself but I know that many use Node-RED[0] for home assistant applications. It comes with thousands of plugins, easy to construct web frontends and it's completely open source.
I believe one can also combine it with Home Assistant, I think there are interfaces.
Learning curve is initial exponential (think of visual Unix pipes) but once understood, there are limitless things that you can do with Node-RED. It's basically a visual programming frontend to NodeJS.
- ErneX 1 year agoThis is what use for my home automations, including some Shelly 1s. It's pretty neat.
- boringuser2 1 year agoThat's just some silly scripting GUI, isn't it?
No real reason to write code in blocks when you know how to not do that.
I have an express server that runs my automations using the REST API.
- ErneX 1 year ago
- eichin 1 year agoYeah, one of these days I expect to set up homeassistant, and even recommend it to others, but I'm happy driving my shelly plugs with bash+curl from a streamdeckui entry for now :-)
- Towaway69 1 year ago
- pmlnr 1 year agoI have different opinion on Home Assistant. It's surprisingly heavy compared to alternatives, the YAML configs are insanely overcomplicated, they move too fast with Python versions (phasing out 3.9 when it was still the default on the then stable Debian, etc).
My 2 cents go for Zigbee2MQTT, Mosquitton, and Domoticz. Domoticz has it's problems, but it's been a faithful workhorse for me for the past 6 or more years.
- dementik 1 year agoAlmost all my issues with Python versions went away when starting to use HA in docker container. Everything is very smooth.
One way is also to use HAOS but it is kinda limited.
Current stack for me is HA+traefik+Z2M+Frigate+Mosquitto. All running in containers, on top of Debian. Works perfectly.
- boringuser2 1 year agoHow is it limited?
I have been thinking of migrating my setup from a docks container to HAOS on metal.
I have like 1 dozen Intel j5105 boxes, might as well use them.
- boringuser2 1 year ago
- gempir 1 year agoIf you want yaml based configs and running on a non HomeAssistant provided OS you are already making it hard for yourself.
This is not the most popular route and therefore also less supported my advice:
- use a raspberry-pi with Home Assistant OS or buy one of their self made raspberry-pi alternatives Home Assistant Yellow etc.
You can run docker but it's still not straightforward because then you need to passthrough like USB Devices etc, I would recommend against it.
And from there use the yamls to define a very basic config like language, location etc (I'm not sure that you even need to do that). But only use the GUI from there on.
Everything can be done with the GUI, I haven't touched my yaml files in years.
And I regularly upgrade versions too, haven't had any upgrade issues either.
- Toutouxc 1 year ago> Everything can be done with the GUI, I haven't touched my yaml files in years.
Command line sensors, REST sensors, some types of virtual sensors, groups (I think), there's a lot of stuff you still can't do in the GUI, and even if you don't mind writing their stupid YAML-based config, the documentation isn't very friendly and in places outdated and contradicting itself.
- Toutouxc 1 year ago
- zegl 1 year ago+1 for Zigbee2MQTT. I've been using it at the core of my home automation for a few years, and it's incredibly reliable.
- alangibson 1 year agoHA is phasing out yaml integration config. They'll only accept core integrations with UI based setup now.
AFAIK you still need to do everything else in yaml tho.
- dementik 1 year ago
- jakupovic 1 year agoAnother vote for home assistant, also from another thread further down use a dockerized version, no issues. I have all kinds of things connected, lights, switches, shellys, custom sensors/collectors and it all works flawlessly. Just amazed how good HA performs after using various other things over the years.
You're also not tied to HA, but can develop using anything then once it all works put the result on HA.
- alangibson 1 year agoI love HA for it's stability. However, I've written several HA integrations and I've got to say that their component API is insane. Inheritance based, vaguely documented, shifting terminology, etc. I'm working on my own use-case based API just to rationalize it a bit.
- jakupovic 1 year agoIn order to get some sensors working I used Arduino examples from the web, understood the example and how it interfaces with my platform. Once it all worked I was able to transfer everything to HA, successfully. Going with "I'll just use HA from beginning", got me stuck thoroughly.
I feel like one of the people waving at the cloud saying: "Use Home Assistant", same as back in the days of use linux for all your troubles.
- jakupovic 1 year ago
- alangibson 1 year ago
- grepfru_it 1 year agoOnce you use OpenHAB you will never go back to HA
- smt88 1 year agoWhy? I already have zero issues with HA and it does everything I want it to do.
- grepfru_it 1 year agoWindows has zero issues and so does MacOS yet there’s a market for both and lifelong users who switch from Win to Mac report a better experience.
OpenHAB allows for way more customization and integration.
- grepfru_it 1 year ago
- smt88 1 year ago
- pmontra 1 year ago
- jacquesm 1 year agoThe Shelly stuff is very nice, extremely reliable. I've used a whole pile of different products to test in single units and finally settled on using Shelly wherever I can and some special stuff for the few things that require different interfaces than Shelly provides. I use their 3 phase power sensors, thermostatic controls for on the radiators, temperature and humidity sensors and relays. Everything is on a separate WiFi network to make it independent of the rest of the house internet setup and it all runs off a Raspi 400 running HA. It's been up and running for well over a year now without a hitch and does all of the energy management, heating, cooling and monitoring.
The only gripe I have about the Shelly stuff is that it uses more power than what you would expect for stuff that is pretty much very intermittent use and as a result I've wired up everything with 5V wall warts, very low power to save on parasitic drain. We've done what we could to knock down our daily average and typically do about 8-10KWh/day so every little bit counts.
- bo0tzz 1 year agoWhat a great coincidence to see this. I've been doing something pretty similar over the past few weeks, slapping together an Elixir app [0] that controls lights in my house via zigbee2mqtt. For now it only handles a motion sensor nightlight, but I have grand plans of course.
- ttyyzz 1 year agoI have a couple of Shelly relay switches for various purposes in a separate IoT vlan which is not connected to the cloud. The new Shelly android app not only is worse and barely functional but also pushes you to use the cloud. On top of that, they try to sell some functionality as a subscription Model. On the other hand you don't need the cloud and their http API is super well documented and does everything you would expect. I really prefer Tools like this for products like Shelly, good job!
- jacquesm 1 year agoFortunately their cloud stuff is still optional and easy to disable on all of their current products (usually it is disabled when it is sold).
The easiest way is to ignore their apps and other cloud based components and just to run HA on a small computer that you stash away near your distribution panel.
- jacquesm 1 year ago
- mwlp 1 year agoNice! I also control my lights using Elixir and a Hue bridge (through Home Assistant). https://github.com/Manwholikespie/mojodojo
- jspash 1 year agoInteresting that you also used Elixir. It's also quite interesting contrasting your approach to OP's. Was there a specific reason that you chose Elixir?
- mwlp 1 year agoEh, Elixir has just become my go-to for personal projects. GenServers, pattern matching, releases, being able to pop a shell into my program, the beautiful colors of the IEx shell... I miss all these things when choosing other languages. I also planned on eventually integrating it with a chatbot of mine which is also written in Elixir.
- mwlp 1 year ago
- joisig 1 year agoNeat! Driving HA through API is a clever alternative so you can build exactly the UX you want.
- jspash 1 year ago
- aidenn0 1 year agoI looked into some basic automation for Christmas lights this year; some thoughts:
1. Zigbee devices are crazy inexpensive. I can get two zigbee power switches for less than half the cost of a single USB controlled one.
2. Zigbee2Mqtt is really nice; setting it and mosquitto up was easy, and I can control everything over mqtt now.
3. The creator of HA really doesn't want me using his software, so I'm not.
- 1 year ago
- kriiuuu 1 year agoWhat is your reasoning behind nr.3? I don’t disagree as they seem hostile towards the nix HA project. At least that is what I gathered when I set up my zigbee devices on a NixOS server.
- 1 year ago
- birdman3131 1 year agoThe big thing I really like about the shelly devices is that you can flash tasmota onto them. I don't have the need or desire to do so but it means I can't find myself with a dead home automation setup because some company went belly up as has happened several times before.
- BluSyn 1 year agoWhat light switches did you use, if any?
I also want to use Shelly dimmers, but I haven’t found simple stateless light switches. I want automation and app control in many cases, but also want simple tactile button for on/off or hold for brightness control. Amazingly hard to find.
- PreInternet01 1 year agoNot OP, but the Shelly 1 works very well as a simple switch, and it supports both physical and remote operations. Not sure what you mean by "stateless", though (I mean, the thing is either on or off?), so that might prevent you from using it, but otherwise it's highly recommended!
- KMag 1 year agoI'm pretty sure what they mean by "stateless" is that the manual switch resets any state set wirelessly.
- KMag 1 year ago
- philjohn 1 year agoShelly 1 and Plus 1 (the gen 2 device) allows you to separate the relay from the switch and expose both via API or MQTT.
That's how I have my lights setup - normal light switches (switched live) will toggle the switch sensor which is picked up by HomeAssistant which then either toggles the relay (for non smart lights) or sends a command to a light group (Zigbee IKEA Tradfri bulbs, using a Sonoff Zigbee dongle for comms) to turn on or off.
The only issue you might have is that they require a neutral, so unless you have a neutral behind each switch you'll need to put the Shelly elsewhere, either in the light fitting or ceiling (in my case).
- BigJ1211 1 year agoI just use the Ikea trådfri dimmers[1] and have them bound to the lights I want them to control. That way they can do on/off and dim.
They no longer seem to offer them. But the replacement might work as well. Support for the device was merged into Z2M last month so not sure if it's already included in the latest release.
1. Predecesor of this: https://www.ikea.com/nl/en/p/somrig-shortcut-button-white-sm...
- jacquesm 1 year agoFor that I use Klikaan/Klikuit, I have a whole bunch of these set up throughout the house and they're pretty easy to use and configure. Outside of NL these are sold under the 'Intertechno' brand. Batteries seem to last forever, I've had these in the house for five years now and never had to change a single battery.
- joisig 1 year agoOP here, the switches we used are push-button Berker switches. I can't say I'm 100% happy with them, they look nice and are tactile but they are the "toggle" type - push and hold to either dim or brighten (never really know which) then again for the other direction, or quick push for on/off. My other annoyance is that sometimes a quick push does not register, but I don't know if this is because of the switch or because of the Shelly dimmer... I think more likely it's the dimmer.
- wlesieutre 1 year agoNot cheap but Leviton 5657-2W might be the one you want
- PreInternet01 1 year ago
- asylteltine 1 year agoHome assistant!