smart-home-engine 1.53.0 → 1.53.1
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.
- package/dist/web/assets/{index-COKTfw7g.js → index-CBrAPut6.js} +4 -4
- package/dist/web/assets/{tsMode-BIGdBOAo.js → tsMode-CzP5eDeL.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/src/index.js +15 -0
- package/src/web/ai-tools.js +1 -1
- package/src/web/prompts/tools.md +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-DKJI_o9J.js";import{t as I}from"./index-CBrAPut6.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
}
|
|
176
176
|
})();
|
|
177
177
|
</script>
|
|
178
|
-
<script type="module" crossorigin src="/assets/index-
|
|
178
|
+
<script type="module" crossorigin src="/assets/index-CBrAPut6.js"></script>
|
|
179
179
|
<link rel="modulepreload" crossorigin href="/assets/monaco-langs-DKJI_o9J.js">
|
|
180
180
|
<link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
|
|
181
181
|
<link rel="stylesheet" crossorigin href="/assets/index-x3Sn9IKo.css">
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -691,6 +691,9 @@ if (config.url) {
|
|
|
691
691
|
state.lc = state.val === oldState.val ? oldState.lc : ts;
|
|
692
692
|
store.setObject('mqtt::' + topic, state);
|
|
693
693
|
store.setObject('var::' + varName, state);
|
|
694
|
+
// dispatch now, as setVariable() does: the broker's echo of the status publish below finds the store
|
|
695
|
+
// already updated, so a { change: true } subscription would never see the change (B-22)
|
|
696
|
+
stateChange(topic, state, oldState, msg);
|
|
694
697
|
mqtt.publish(topic, JSON.stringify(state), { retain: true });
|
|
695
698
|
} else {
|
|
696
699
|
if (!state) {
|
|
@@ -701,6 +704,18 @@ if (config.url) {
|
|
|
701
704
|
state.ts = new Date().getTime();
|
|
702
705
|
}
|
|
703
706
|
oldState = store.getObject('mqtt::' + topic) || {};
|
|
707
|
+
// our own echo: she publishes <prefix>/status/<name> retained after a var/set or she.var.set(), and the
|
|
708
|
+
// broker delivers it back (we subscribe to #). The subscriptions were dispatched at set time; the
|
|
709
|
+
// echo carries the stored state verbatim (same ts and lc), so it is stored again but not dispatched.
|
|
710
|
+
if (
|
|
711
|
+
topicArr[0] === config.variablePrefix &&
|
|
712
|
+
topicArr[1] === 'status' &&
|
|
713
|
+
oldState.ts === state.ts &&
|
|
714
|
+
oldState.lc === state.lc &&
|
|
715
|
+
JSON.stringify(oldState.val) === JSON.stringify(state.val)
|
|
716
|
+
) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
704
719
|
// lc (last change): prefer a payload-provided value; otherwise set it
|
|
705
720
|
// on value change and carry the previous lc over when the value is
|
|
706
721
|
// unchanged. Previously the old lc was simply lost on repeated
|
package/src/web/ai-tools.js
CHANGED
|
@@ -1350,7 +1350,7 @@ function analysisLoaders(ctx) {
|
|
|
1350
1350
|
} catch {
|
|
1351
1351
|
/* module missing */
|
|
1352
1352
|
}
|
|
1353
|
-
if (!client) throw new Error('no Elasticsearch integration is configured in she (config "elastic")');
|
|
1353
|
+
if (!client) throw new Error('no Elasticsearch integration is configured in she (config "elastic"); use data.history (InfluxDB) for values over time instead');
|
|
1354
1354
|
const fromMs = needTime(from, 'from');
|
|
1355
1355
|
const toMs = needTime(to, 'to');
|
|
1356
1356
|
const cap = Math.min(Math.max(1, Number(limit) || 1000), 5000);
|
package/src/web/prompts/tools.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Use the tools; they read the running daemon. Where to start:
|
|
3
3
|
- a room ("the light in the workshop", "presence in the bathroom"): describe_room first — every device, variable, script and discovery device of the room in one call; then narrow with describe_device (several names at once), get_timeline or get_topic_history
|
|
4
4
|
- one device: describe_device; the current value of a topic: get_mqtt_topic; topics by pattern or value: search_mqtt_topics
|
|
5
|
-
- anything about the past — "why", "when", "how often", "since when": get_timeline (the changes of several topics merged in time order; the tool for "what happened"), get_topic_history (the values of one or several topics over time), get_topic_messages (the raw messages of one topic)
|
|
5
|
+
- anything about the past — "why", "when", "how often", "since when": get_timeline (the changes of several topics merged in time order; the tool for "what happened"), get_topic_history (the values of one or several topics over time), get_topic_messages (the raw messages of one topic; needs Elasticsearch — without it use the history)
|
|
6
|
+
- a question that needs counting, correlating or comparing more than two topics over time ("did the light go off while the echo kept playing", "how often per evening", "what else changed in the minute before"): run_analysis first — one call with the computation in JavaScript beats a dozen history calls, and the user sees the code
|
|
6
7
|
- which script does what: read_script (the source with its subscriptions, publishes and the scripts wired to it), list_scripts, who_publishes
|
|
7
8
|
- what a script did or logged: get_script_logs with a time window; what is still pending: list_timers
|
|
8
9
|
- "nothing happens": get_health first, then list_services for the adapters
|
|
9
10
|
- Matter: list_matter_devices (with state), get_matter_attribute; sheDB: list_shedb_docs, get_shedb_doc
|
|
10
|
-
- research that would take many calls or arithmetic over long lists (counts per hour, correlations, durations): run_analysis — write the computation in JavaScript over `data.topics`, `data.history`, `data.messages`, `data.log` and return a small result; the user sees the code and the result
|
|
11
11
|
How to call them:
|
|
12
12
|
- ask for every independent tool in the same turn — the calls of a turn run concurrently, and each turn costs a round trip
|
|
13
13
|
- use MQTT filters (`radar-x/status/#`, `zigbee2mqtt/+_workshop/#`) where the topic tree is known; a substring search is for an unknown name
|