!QhvgabMQzwEQeWehhZ:lossy.network

NixOS Home Automation

506 Members
Declarative Home Automation and other Sidequests | https://wiki.nixos.org/wiki/Home_Assistant132 Servers

Load older messages


SenderMessageTime
19 Jun 2021
@schnecfk:ruhr-uni-bochum.deCRTifiedBut it's getting slightly off track here - we're far from doing anything frontend, I think. And the frontend is something that'll be probably relatively easy to swap out14:16:26
@instantepiphany:matrix.orginstantepiphanyThanks for the link, I'll read that :) Agreed, we are a long way off frontend, and I actually want a goal to be that the frontend is optional, and new frontends are easy to build. As long as we follow a sensible architecture for our API (whether REST or something else) then we might just get this for free :)14:19:39
@schnecfk:ruhr-uni-bochum.deCRTifiedYes, "API first" sounds good to me 😀 14:20:56
@balsoft:balsoft.rubalsoft
In reply to @instantepiphany:matrix.org

Just to clear something up - what I listed as "MVP non-features" means I won't be doing those as part of the MVP - I definitely think they add value.

My end goal is for this project to be installable by an end user (though of course a NixOS end user is certainly more likely to be technically minded) and provide all that the user needs to automate IoT devices in their home, though different devices will need specific plugins.

So the first thing to build, because everything else depends on it is what I called the "service" - this is the backend that actually communicates with the devices (targets) on one end, and a HTTP request on the other end.

Then, once this service is working, a web interface, or app interface could be built to present things in a more friendly manner.

So in the end the scope is quite large, much like HA, however for the "MVP" I just want to work on the service.

By the nature of IoT, different plugins that support different targets will require different protocols - HTTP, RTSP, MQTT, etc, so we can't really choose just one. Given MQTT supports many devices, and I have used it a little in the past, it seems like a logical place to start.

So the "core" would be the service, but more is definitely required for a complete solution. Though, it would be nice if someone could just install the core, and build their own frontend if desired.

Regarding architecture, specifically how people have mentioned event buses, pub/sub, I suspect that pub/sub would be an ideal candidate, though am very open to all suggestions! I think pub/sub is the simplest way to describe what happens - events happen, a camera seeing motion, a light turning on, or losing connection, an IRC message mentioning the user, etc.

So various pub/sub messages would be published, and some kind of logic engine in the service would subscribe to some of them, possibly generating "actions" in response, depending on the users configuration. So we could avoid the situation where an "automation" would have to process irrelevant events. This is one thing that I think redux-observable presents a really nice development experience for, which is why I have been describing "actions", which is the term they use.

Finally, regarding functional programming, I agree there are potential performance gains to be had via memoization, though I suspect that would only surface for large scale systems (say, more than 30 messages per second). I'm a big fan of measuring before optimizing, so while I think we should keep memoization in mind and build a system that would be easy to memoize, we shouldn't memoize things until we actually have performance issues.

With an event system such as pub/sub, it is not difficult to create crude approximations of that kind of heavy load, that will be a fun exercise :)

I was tempted to write this in Haskell, but I've never worked with high performance Haskell before, and suspect Rust will be more approachable for more people to contribute. Does anyone have any comments on language choice?

I would kind of love this to be Haskell, but core in Rust sounds reasonable. And if you use something like wasm+wasmer for "plugins", they could be built in almost any language!
14:58:52
@hexa:lossy.network@hexa:lossy.network invited @piegames:matrix.orgpiegames.17:25:52
@piegames:matrix.orgpiegames joined the room.17:25:59
@schnecfk:ruhr-uni-bochum.deCRTified instantepiphany: If you want to move the discussion to a new matrix room, feel free to invite me 🙂 (Although it's likely that it will fit into this channel for some time, given that it does not seem that high traffic) 18:13:32
@hexa:lossy.network@hexa:lossy.networkyes, the traffic sounds ok, we are probably all interested parties18:52:25
20 Jun 2021
@etu:semi.social@etu:semi.socialHmm, I like the ideas here, just want to pitch in another name idea: homeix :) I'm also very interested in zwave (both lights and temperature sensor), a bit less in zigbee (I have a Hue strip but don't use the gateway), then xiaomi (robot vacuum), kodi and chromecast things02:51:59
@instantepiphany:matrix.orginstantepiphany

I'll create a github repository soon where we can add issues as requests for support for various targets.

Just to set expectations, I expect the MVP to take 2-4 weeks, and the soonest we will have a plug and play solution for just one target is likely to be 2 months. This is my only side project but I'm working full time and starting a new job in a couple weeks.

02:55:29
@etu:semi.social@etu:semi.socialMy rust knowledge is limited to going through the learning rust book one and a half year ago and not touching it since. But I liked what I did back then and wouldn't mind learning more by actually doing some rust. Currently I'm a bit consumed by family though. I have a 3 weeks old human next to me :)02:59:57
@instantepiphany:matrix.orginstantepiphany

Well, if I do a good job architecting the service and plugin architecture, you would have some examples in rust and maybe other languages to work from - in a couple months.

I can't speak to the time requirements of the young human though - an essential and time consuming task on their own ❤️

03:03:06
@joerg:bethselamin.deMic92 (Old)
In reply to @instantepiphany:matrix.org
Great, I'll look at mqtt as a first protocol to support.
palo also build a smarter mqtt light control with rust: https://git.ingolf-wagner.de/palo/light-control as he was not happy with home-assistant state machine
06:09:15
@piegames:matrix.orgpiegamesRE language choices09:17:29
@piegames:matrix.orgpiegamesBoth Rust and Haskell are great languages and have a powerful type system. Haskell is rather performant as well, though I don't think an application like this will be really performance critical. I don't know the Haskell ecosystem w.r.t. bindings and integrations libraries, but I suppose the Rust community is larger at the moment.09:19:35
@piegames:matrix.orgpiegamesEither way, we also need to talk about scripting. The project will need a scripting language, whatever it may be. There are a few custom languages for this purpose, but there is also Python that works great together with Rust. I have no idea how scripting looks like in the Haskell ecosystem (I think Haskell can be interpreted too?)09:23:18
@piegames:matrix.orgpiegamesIf you go for Rust, please don't let it be your first serious project. The odds of things getting painful are rather high on that path.09:26:01
@instantepiphany:matrix.orginstantepiphany
In reply to @piegames:matrix.org
Either way, we also need to talk about scripting. The project will need a scripting language, whatever it may be. There are a few custom languages for this purpose, but there is also Python that works great together with Rust. I have no idea how scripting looks like in the Haskell ecosystem (I think Haskell can be interpreted too?)
I'm not disagreeing, just curious - what use case is there for an interpreted language?
09:28:22
@schnecfk:ruhr-uni-bochum.deCRTifiedProbably for high flexibility of the automations. While I prefer a DSL or something structural, the system that HA uses is rather weak and often requires workarounds like template sensors09:29:51
@instantepiphany:matrix.orginstantepiphany
In reply to @piegames:matrix.org
If you go for Rust, please don't let it be your first serious project. The odds of things getting painful are rather high on that path.
Not my first project in Rust. I've written a couple small games and used it professionally, however I'm wanting to push my knowledge and get some more experience with (potentially) more complicated architectures. I'm definitely not an expert, though I have already encountered the common borrow checker errors and have an understanding of passing clones, or references, etc.
09:30:07
@instantepiphany:matrix.orginstantepiphany
In reply to @schnecfk:ruhr-uni-bochum.de
Probably for high flexibility of the automations. While I prefer a DSL or something structural, the system that HA uses is rather weak and often requires workarounds like template sensors
I'm not sure why this is something that needs to be decided in this project though - should we be opinionated on that? Or choose a protocol so that any language/executable can be used as long as it follows the interface?
09:32:13
@piegames:matrix.orgpiegames
In reply to @instantepiphany:matrix.org
I'm not disagreeing, just curious - what use case is there for an interpreted language?

So a few use cases that you may want to consider that would make good use of a scripting language:

  • User can write a few lines of code to create automation behavior
  • Plugin system
  • Dynamically loading modules. Let's be frank, if you want to load Rust code at run time you won't have fun.
09:40:14
@instantepiphany:matrix.orginstantepiphany
In reply to @piegames:matrix.org

So a few use cases that you may want to consider that would make good use of a scripting language:

  • User can write a few lines of code to create automation behavior
  • Plugin system
  • Dynamically loading modules. Let's be frank, if you want to load Rust code at run time you won't have fun.

I think the first might be covered by allowing any executable to be called as long as it follows the API. This could be bash, or python, or whatever.

Definitely agree for third.

However for plugins, I was thinking we could do that through the config - e.g the config supplied by the user would specify what protocol should be used to communicate with the target, and set various rules for the automation. I would like to keep as much logic in the config as possible.

09:44:41
@instantepiphany:matrix.orginstantepiphanySo to create automation behaviour, the user would modify the config, via text at first, maybe a GUI much further down the road.09:45:49
@piegames:matrix.orgpiegamesWill the configuration format be a turing complete DSL? Or will it be a simple structured format with inline code blocks in different languages?10:11:33
@instantepiphany:matrix.orginstantepiphany I'm not really sure, but if we go with inline code blocks that might make it difficult to have GUI plugins later - they would have to be able to infer meaning from n supported languages... Though I suppose the code could just be to get or set a state, then we might be able to do that. 10:28:42
@joerg:bethselamin.deMic92 (Old)What other components do they plan to make stateful?11:17:08
@joerg:bethselamin.deMic92 (Old)In home-assistant?11:17:16
@schnecfk:ruhr-uni-bochum.deCRTified
In reply to @joerg:bethselamin.de
What other components do they plan to make stateful?
Afaik they want to migrate always from the YAMl configuration completely, making the while configuration of all integrations stateful
11:20:09
@joerg:bethselamin.deMic92 (Old)
In reply to @schnecfk:ruhr-uni-bochum.de
Afaik they want to migrate always from the YAMl configuration completely, making the while configuration of all integrations stateful
Do you have a source for that? This reads different: https://www.home-assistant.io/blog/2020/04/14/the-future-of-yaml/
11:21:37

There are no newer messages yet.


Back to Room ListRoom Version: 6