smart-home-engine 0.0.1 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/web/assets/codicon-DCmgc-ay.ttf +0 -0
  4. package/dist/web/assets/index-Bdf2J0nm.js +140 -0
  5. package/dist/web/assets/index-DkhtWYJx.css +1 -0
  6. package/dist/web/assets/monaco-langs-DZ6hB11b.js +1423 -0
  7. package/dist/web/assets/monaco-langs-DyX1CsEw.css +1 -0
  8. package/dist/web/assets/tsMode-THvwQw-l.js +16 -0
  9. package/dist/web/index.html +164 -0
  10. package/dist/web/monacoeditorwork/editor.worker.bundle.js +13519 -0
  11. package/dist/web/monacoeditorwork/ts.worker.bundle.js +256353 -0
  12. package/package.json +84 -10
  13. package/src/config.js +53 -0
  14. package/src/elastic.js +19 -0
  15. package/src/index.js +1184 -0
  16. package/src/influx.js +25 -0
  17. package/src/lib/mqtt-wildcards.js +34 -0
  18. package/src/lib/parse-payload.js +29 -0
  19. package/src/lib/redis.js +74 -0
  20. package/src/lib/shedb-core.js +447 -0
  21. package/src/lib/shedb-worker.js +126 -0
  22. package/src/lib/state-store.js +97 -0
  23. package/src/lib/storage.js +74 -0
  24. package/src/matter/controller.js +307 -0
  25. package/src/sandbox/api.js +57 -0
  26. package/src/sandbox/elastic-sandbox.js +88 -0
  27. package/src/sandbox/influx-sandbox.js +107 -0
  28. package/src/sandbox/matter-sandbox.js +92 -0
  29. package/src/sandbox/shedb-sandbox.js +89 -0
  30. package/src/sandbox/stdlib.js +132 -0
  31. package/src/scripts/hello.js +3 -0
  32. package/src/web/ai-api.js +443 -0
  33. package/src/web/config-api.js +34 -0
  34. package/src/web/deps-api.js +138 -0
  35. package/src/web/git-api.js +188 -0
  36. package/src/web/log-ws.js +71 -0
  37. package/src/web/matter-api.js +102 -0
  38. package/src/web/mqtt-api.js +65 -0
  39. package/src/web/scripts-api.js +192 -0
  40. package/src/web/server.js +130 -0
  41. package/src/web/shedb-api.js +140 -0
  42. package/src/web/shedb.js +168 -0
  43. package/index.js +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Sebastian Raff <hq@ccu.io> (https://github.com/hobbyquaker)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # she - smart home engine
2
+
3
+ [![License][mit-badge]][mit-url]
4
+
5
+ > [!WARNING]
6
+ > **This project is under heavy development and many features are not working yet.** The API is changing frequently and there are no stability guarantees yet.
7
+
8
+ Your home, your rules - written in plain JavaScript.
9
+
10
+ **she** is a Node.js daemon that loads your `.js` scripts into a sandboxed VM and wires them up to MQTT, Matter, and everything else your smart home throws at them. No cloud, no lock-in, no YAML sprawl, no opinionated bloated schemata. Just scripts that do exactly what you tell them.
11
+
12
+ - **Scripts** — Monaco-based Script IDE, AI assistant, git integration, autocompletion, ...
13
+ - **MQTT** — subscribe, publish, react to state changes with wildcards, conditions, and delays
14
+ - **Matter** — pair and control Matter devices directly from your scripts
15
+ - **sheDB** — a lightweight document store with map/reduce views, right in the daemon
16
+ - **Scheduler** — cron expressions and solar events (`sunrise`, `sunset`, …) in one call
17
+ - **Web UI** — script editor, package manager, MQTT browser, Matter device manager, sheDB-Frontend, log viewer
18
+
19
+ ## Motivation
20
+
21
+ She is built around a simple idea: home automation should stay understandable, even as it grows. Instead of collecting adapters, bindings, integrations, and configuration layers, you work directly with devices, events, and logic. The result is a system that scales with your home without turning into a project of its own.
22
+
23
+ At some point every smart home platform starts promising simplicity and ends up teaching you its own ecosystem. She takes a different approach. It's built around devices, messages, and automation logic - not around ever-growing collections of adapters, bindings, and abstractions.
24
+
25
+ Spend your time automating your home, not maintaining your automation software. Less clicking through configuration screens, fewer plugins talking to plugins, and no need for YAML archaeology when something stops working. Just a straightforward path from devices to automations, built on open standards and designed for people who prefer understanding their system over managing it.
26
+
27
+ The ideas behind **she** are the result of more than a decade of building smart home software. I started publishing home automation projects on GitHub in 2012 with ccu.io and later initiated the ioBroker project before leaving it in 2014. Around the same time, I created [mqtt-scripts](https://github.com/hobbyquaker/mqtt-scripts), which has been running my own home automation ever since. Over the years I have continued working professionally in the smart home industry.
28
+
29
+ Recently, while experimenting with GitHub Copilot, I started modernizing parts of my existing software stack. What began as a small refactoring exercise quickly evolved into a bigger idea: replacing my twelve-year-old automation engine with a modern successor. The result is **she** - a combination of the proven concepts from mqtt-scripts, the event-sourced architecture of mqttDB, and a built-in Matter controller. A system that embraces open standards, integrates the growing Matter ecosystem, and remains true to the principles that made mqtt-scripts reliable enough to run a home for more than a decade.
30
+
31
+ The goal is simple: a smart home that remains understandable years later. No migration-guide marathons, no plugin jungles, no configuration archaeology. Just automation infrastructure that grows with your home instead of growing into a hobby of its own.
32
+
33
+ ## Docs
34
+
35
+ | | |
36
+ |---|---|
37
+ | [Getting started](doc/getting-started.md) | Install, write your first script, configure |
38
+ | [CLI reference](doc/cli.md) | All flags and environment variables |
39
+ | [Sandbox API](doc/sandbox-api.md) | Everything available inside a script |
40
+ | [HTTP API](doc/http-api.md) | REST endpoints and WebSocket |
41
+ | [sheDB](doc/db/README.md) | Embedded document store — script API, views, examples |
42
+ | [Examples](doc/examples.md) | Real-world script patterns |
43
+
44
+ ## Quick look
45
+
46
+ ```js
47
+ // lights.js
48
+
49
+ // Follow a motion sensor
50
+ she.mqtt.sub('home//hall/motion', { change: true }, (topic, val) => {
51
+ she.mqtt.set('home//hall/light', val ? 1 : 0);
52
+ });
53
+
54
+ // Solar schedule — no hardcoded times
55
+ she.schedule('sunset', () => she.mqtt.set('home//lights/outdoor', 1));
56
+ she.schedule('sunrise', () => she.mqtt.set('home//lights/outdoor', 0));
57
+
58
+ // Keep device metadata in sheDB
59
+ she.db.set('hall/motion', { name: 'Hall PIR', location: 'hall' });
60
+ ```
61
+
62
+ ## Quick start
63
+
64
+ ```bash
65
+ npm install -g smart-home-engine
66
+ she
67
+ ```
68
+
69
+ Then open **http://localhost:8080** and start writing.
70
+
71
+ ## License
72
+
73
+ MIT © [Sebastian Raff](https://github.com/hobbyquaker)
74
+
75
+ [mit-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat
76
+ [mit-url]: LICENSE