Read the statement by Michael Teeuw here.
Writing my own OS
-
Heya, I’m a full stack developer and will give my 2cents, however I’m extremely new to MagicMirror so I can’t answer many questions regarding it.
Probably the most important information you should know is that web knowledge is very portable. Just learn web basics and you’re golden to work in your language preference. If you already know Python and Java, why not use them?
However, there are other languages you can write in, and it seems like you’re keen, so here are the ones I’ve found to work best for me (easy to learn, can do a lot with them):
Server-side
- NodeJS (easier, loosely typed, strong community)
- PHP (intermediate, but meh.. a little outdated, prefer the others)
- Go (intermediate, strongly typed, strong community)
Client-side
Just learn the basics of HTML/CSS/JavaScript, and use JavaScript to send HTTP requests to which your server will respond.Research
- HTML
- CSS
- JavaScript
- HTTP/HTTPS (GET, POST, PUT, PATCH, UPDATE, DELETE)
- AJAX
- Choose a server-side language, if it's a new one then practice it by writing some data structures or making something you've already made in Python/Java.
- REST services (maybe GraphQL if you want to be bleeding edge, but definitely not necessary)
- Optional (overkill), look into architectural patterns such as MVC. Very valuable for web app development
- Optional (overkill), look into front-end frameworks such as React, Vue, Django, etc...
If you learn the basics of HTTP protocols, it’ll take you very far with what you want to accomplish with smart-home devices. For example:
- Create an
index.html
page with button named trigger - Make it look pretty with CSS
- Use JavaScript to capture the button click. The click will initiate a
HTTP GET
request to your Go/NodeJS/Java/Python server, specifically to the urllocalhost:8080/capture
- You will (probably) have a REST server. Your server, running on port 8080, will have routing setup to see capture a
GET
request made to the/capture
endpoint (this is a web hook -- you're telling your server to do X when it sees a request has been made from some specific URL route) - You can now do ANYTHING on your server, such as grab data from a database, and spit it back to your client-side JavaScript app in (probably)
JSON
format since it's easy to parse.
Once you get that to work, look into Amazon Alexa or Google Home and how they handle HTTP requests. They use the same approach and you’ll find it very similar. However you seem like a go-getter willing to do machine-learning, so maybe you’ll build your own web-hook system to control request/response actions in your smart home, there are GitHub repositories out there for anything now!
Again, I’m only a full stack developer and you said you want to learn more about web servers. I believe most if not all developers should have web fundamentals down solid, and learning this stuff puts you in the nitty-gritty side of things, which I have a feeling is what you want. I’m not sure why people think this is a time-waster, development experience is development experience and that’s that; the developer just needs to be shown the optimal path.
By the way, a year is PLENTY to learn all of this since you already have programming experience. When you do learn it, then as you stated yourself you’ll have learned all the things you want to learn and will have the experience create whatever you want with MM2 and MANY other platforms (or make your own).
-
I’ll never say “don’t try an incredibly ambitious project!” because that’d just make me a hypocrite: however, I will say this:
Depending on what you actually want to do with it… you might now need to. I’ve been spending a good deal of time recently working on a setup with Home Assistant, and I used to have my instance on the same pi as my mirror. I honestly think that given the level of features that you want, you may want to look into just combining some projects with something like that – it’s open source still, but it allows your controls, remote access (provided you set up a reverse proxy or open a port), and a stupidly wide-ranging API. Mine also runs Homekit for interfacing with the family’s iPhones. and a custom Alexa skill that ties anything and everything “smart” together.
What does that have to do with the MagicMirror? Well, I’m working on it. For starters, a lot of control over the mirror itself is provided by the URL scheme setup by Jopyth’s wonderful Remote Control module. Right now I have it set up as a switch in HASS (so I can turn the display on/off easily), but I also can use HASS to send notifications to the mirror, automate hiding/content of various modules, etc! That’s all just with the URLs, not even getting into more advanced stuff – I’m working on a module that allows autodiscovery of a Mirror as an MQTT device. With the touch controls built into a lot of modules, you can already control lots of smart home things, and given the expensive API, I’m SURE that you or someone else could write a great module to control HASS directly. Even with what’s available now, it should be pretty straightforward to use the rEST API module to tell HASS (or openHAB, or Domoticz!) to toggle lights, set scenes, activate scripts, etc.
The nice thing about HASS is that it’s written in python and is pretty easily extensible! The bad thing is that it’s configured via YAML. There’s a learning curve, and it takes some tinkering – but then, if you’re gonna try and build an OS, I figure you’re already ready for that.
-
@pyrosmiley I gotta agree with you… I didn’t want to discourage him from trying…heck if that were the case NOAA3 would have never gotten done…learned a lot of new things myself…
SO perhaps it’s a great idea for him to learn and make it truly his own!! :)
-
Although I did state I thought creating your own OS was a waste of time. It may have been a bad choice of words. Lots of people state “why reinvent the wheel?” well if that were the case we’d all be using wooden wheels on our autos. The statement of “creating my Own OS” makes me think this won’t be shared with a sharing community.
If everyone created their own MM modules and didn’t share where would MM be?
I also don’t wish to discourage anyone from learning and creating something new and my OP definitely came across like that. That was not my intention. -
@ruben And if you delve into Javascript development you should consider to use TypeScript. It allows type-safe development and debugging while you develop. It translates into regular Javascript.
Actually, AngularJS is developed using TypeScript. Pretty awesome!
Just my 2 cents.
Regards,
HerrB92