@camstack/server 1.2.945 → 1.2.947
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/CHANGELOG.md +12 -0
- package/package.json +9 -11
- package/system/dist/builtins/alerts/alerts.addon.js +2 -2
- package/system/dist/builtins/alerts/alerts.addon.mjs +2 -2
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +67 -22
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +67 -22
- package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +19 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +8 -7
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +8 -7
- package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/system/dist/{compile-SpeAhaZ6.js → compile-BpAtMSvc.js} +1 -1
- package/system/dist/{compile-OBMHlqD-.mjs → compile-DPGk4aRg.mjs} +1 -1
- package/system/dist/{composition-sources-DubMf_ii.mjs → composition-sources-D5bWS3nC.mjs} +2 -2
- package/system/dist/{composition-sources-D1nPv7dJ.js → composition-sources-hmri4Cu4.js} +2 -2
- package/system/dist/{core-blocks.cap-DEYCvF9J.js → core-blocks.cap-9xvotd_3.js} +2 -2
- package/system/dist/{core-blocks.cap-sW5HLDlB.mjs → core-blocks.cap-C6REo0Dd.mjs} +2 -2
- package/system/dist/{device-kind-C37Ra2wd.mjs → device-kind-B6G_HfgC.mjs} +19 -2
- package/system/dist/{device-kind-FMhJg8uC.js → device-kind-B7ESmha7.js} +24 -1
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/index.js +3 -3
- package/system/dist/index.mjs +3 -3
- package/system/dist/{named-entity-store-O_hi1y_o.js → named-entity-store-CzJ28TsK.js} +2 -2
- package/system/dist/{named-entity-store-Cq2oVrN5.mjs → named-entity-store-DJxyweoS.mjs} +2 -2
- package/system/dist/{record-kinds-BV8Gcpsx.js → record-kinds-DP2-HG3W.js} +1 -1
- package/system/dist/{record-kinds-BD2xv4Pd.mjs → record-kinds-WosKAa-D.mjs} +1 -1
- package/system/dist/{rename-composition-block-C60O0P16.js → rename-composition-block--abG_xyW.js} +27 -35
- package/system/dist/{rename-composition-block-DcX3vkwS.mjs → rename-composition-block-kmkoIx0R.mjs} +27 -35
- package/system/dist/{user-management.cap-4IEUCSdL.mjs → user-management.cap-C3eqqVdz.mjs} +1 -1
- package/system/dist/{user-management.cap-DV9Jfsj3.js → user-management.cap-D4r3UKtG.js} +1 -1
- package/system/dist/{wal-maintenance-CkPfVApC.js → wal-maintenance-CZKvoKfx.js} +0 -0
- package/system/dist/{wal-maintenance-u84_1sVl.mjs → wal-maintenance-WLoThDXX.mjs} +0 -0
- package/system/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.947] - 2026-11-24
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Rebuilt against updated dependencies.
|
|
15
|
+
|
|
16
|
+
## [1.2.946] - 2026-11-24
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- The timed-run wrapper binds to every device with a switch and re-evaluates when a device gains or loses its switch
|
|
21
|
+
|
|
10
22
|
## [1.2.945] - 2026-11-24
|
|
11
23
|
|
|
12
24
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.947",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -68,11 +68,9 @@
|
|
|
68
68
|
],
|
|
69
69
|
"requires": {
|
|
70
70
|
"addons": {
|
|
71
|
-
"@camstack/addon-admin-ui": ">=1.2.
|
|
72
|
-
"@camstack/addon-agent-ui": ">=1.2.
|
|
73
|
-
"@camstack/addon-
|
|
74
|
-
"@camstack/addon-export-hap": ">=1.2.210",
|
|
75
|
-
"@camstack/addon-provider-hikvision": ">=1.2.195"
|
|
71
|
+
"@camstack/addon-admin-ui": ">=1.2.742",
|
|
72
|
+
"@camstack/addon-agent-ui": ">=1.2.440",
|
|
73
|
+
"@camstack/addon-provider-homeassistant": ">=1.2.703"
|
|
76
74
|
},
|
|
77
75
|
"wrapper": {
|
|
78
76
|
"desktop": ">=0.0.1",
|
|
@@ -81,19 +79,19 @@
|
|
|
81
79
|
}
|
|
82
80
|
},
|
|
83
81
|
"dependencies": {
|
|
84
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
85
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
82
|
+
"@camstack/addon-admin-ui": "1.2.742",
|
|
83
|
+
"@camstack/addon-agent-ui": "1.2.439",
|
|
86
84
|
"@camstack/addon-auth": "1.2.183",
|
|
87
85
|
"@camstack/addon-benchmark": "1.2.316",
|
|
88
86
|
"@camstack/addon-decoder-nodeav": "1.2.150",
|
|
89
87
|
"@camstack/addon-notifiers": "1.2.642",
|
|
90
88
|
"@camstack/addon-pipeline": "1.2.683",
|
|
91
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
89
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.720",
|
|
92
90
|
"@camstack/addon-post-analysis": "1.2.725",
|
|
93
91
|
"@camstack/develop": "0.1.58",
|
|
94
92
|
"@camstack/sdk": "1.2.160",
|
|
95
|
-
"@camstack/types": "1.2.
|
|
96
|
-
"@camstack/ui-library": "1.2.
|
|
93
|
+
"@camstack/types": "1.2.629",
|
|
94
|
+
"@camstack/ui-library": "1.2.503",
|
|
97
95
|
"@fastify/compress": "^9.0.0",
|
|
98
96
|
"@fastify/cookie": "^11.0.2",
|
|
99
97
|
"@fastify/cors": "^11.2.0",
|
|
@@ -6,8 +6,8 @@ const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
|
6
6
|
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
7
7
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
8
|
const require_record_kind = require("../../record-kind-DoBfYHCs.js");
|
|
9
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-
|
|
10
|
-
const require_compile = require("../../compile-
|
|
9
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-9xvotd_3.js");
|
|
10
|
+
const require_compile = require("../../compile-BpAtMSvc.js");
|
|
11
11
|
const require_alert_episode = require("../../alert-episode-DaQ3prSe.js");
|
|
12
12
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
13
13
|
const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
2
2
|
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
3
|
import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
|
|
4
|
-
import { n as CORE_BLOCK_ADDON_PREFIX } from "../../core-blocks.cap-
|
|
5
|
-
import { it as alertsCapability, rt as AlertSchema } from "../../compile-
|
|
4
|
+
import { n as CORE_BLOCK_ADDON_PREFIX } from "../../core-blocks.cap-C6REo0Dd.mjs";
|
|
5
|
+
import { it as alertsCapability, rt as AlertSchema } from "../../compile-DPGk4aRg.mjs";
|
|
6
6
|
import { a as isAlertEpisodeOpen, i as alertEpisodeRank, n as alertEpisodeId, r as alertEpisodePayload } from "../../alert-episode-D-1VUUkZ.mjs";
|
|
7
7
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
8
8
|
import { a as redactLogText } from "../../log-redactor-XLDrPzOi.mjs";
|
|
@@ -9,7 +9,7 @@ const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
|
9
9
|
const require_pinned_binary = require("../../pinned-binary-BOhOSNff.js");
|
|
10
10
|
const require_device_identifiers = require("../../device-identifiers-BQg9EQi1.js");
|
|
11
11
|
const require_device_type = require("../../device-type-Cnc0NiSX.js");
|
|
12
|
-
const require_compile = require("../../compile-
|
|
12
|
+
const require_compile = require("../../compile-BpAtMSvc.js");
|
|
13
13
|
const require_snapshot_cap = require("../../snapshot.cap-CHm29hBs.js");
|
|
14
14
|
const require_declared_device = require("../../declared-device-BWphj9WE.js");
|
|
15
15
|
const require_base_device = require("../../base-device-DeSNiwZ4.js");
|
|
@@ -4,7 +4,7 @@ import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
|
4
4
|
import { t as memoizePinnedFfmpeg } from "../../pinned-binary-CrIRAi4G.mjs";
|
|
5
5
|
import { f as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../device-identifiers-iSuQCKmK.mjs";
|
|
6
6
|
import { t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
|
|
7
|
-
import { F as COMPOSED_DEVICE_STABLE_ID_PREFIX, t as compileHelper, v as COMPOSER_ADDON_ID } from "../../compile-
|
|
7
|
+
import { F as COMPOSED_DEVICE_STABLE_ID_PREFIX, t as compileHelper, v as COMPOSER_ADDON_ID } from "../../compile-DPGk4aRg.mjs";
|
|
8
8
|
import { t as snapshotCapability } from "../../snapshot.cap-CO68YvJU.mjs";
|
|
9
9
|
import { n as declarationOwnerNodeId, t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
|
|
10
10
|
import { t as BaseDevice } from "../../base-device-w_MD0Bf4.mjs";
|
|
@@ -6,14 +6,14 @@ require("../../chunk-Cek0wNdY.js");
|
|
|
6
6
|
const require_stream_catalog_cap = require("../../stream-catalog.cap-7WPsugOy.js");
|
|
7
7
|
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
8
8
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
9
|
-
const require_rename_composition_block = require("../../rename-composition-block
|
|
9
|
+
const require_rename_composition_block = require("../../rename-composition-block--abG_xyW.js");
|
|
10
10
|
const require_quantity = require("../../quantity-lY1KiTSZ.js");
|
|
11
11
|
const require_device_type = require("../../device-type-Cnc0NiSX.js");
|
|
12
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-
|
|
12
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-9xvotd_3.js");
|
|
13
13
|
const require_addon_settings_cap = require("../../addon-settings.cap-nZVHPo3X.js");
|
|
14
|
-
const require_compile = require("../../compile-
|
|
14
|
+
const require_compile = require("../../compile-BpAtMSvc.js");
|
|
15
15
|
const require_source_info = require("../../source-info-DtWf4k2j.js");
|
|
16
|
-
const require_composition_sources = require("../../composition-sources-
|
|
16
|
+
const require_composition_sources = require("../../composition-sources-hmri4Cu4.js");
|
|
17
17
|
const require_declared_device = require("../../declared-device-BWphj9WE.js");
|
|
18
18
|
const require_base_device = require("../../base-device-DeSNiwZ4.js");
|
|
19
19
|
const require_capture_engine = require("../../capture-engine-D_1IJmMs.js");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { i as motionCapability } from "../../stream-catalog.cap-CzwRDaqT.mjs";
|
|
2
2
|
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
3
3
|
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
4
|
-
import { An as colorCapability, E as valveCapability, En as consumablesCapability, Jt as groupCommandsCapability, Kt as GroupCommandResultSchema, Ln as brightnessCapability, Nn as HvacModeSchema, On as composerCapability, Pn as climateControlCapability, U as RUNNING_CUSTOMIZE_DEVICE_TYPES, c as kebabToCamel, ct as petFountainWaterItem, gt as lockControlCapability, in as FanDirectionSchema, jn as parseColorInput, m as ALL_CAPABILITY_DEFINITIONS, n as renameCompositionBlock, ot as PetFountainStatusSchema, sn as fanControlCapability, st as petFountainCapability, wn as ConsumableItemSchema, xn as coverCapability, z as switchCapability } from "../../rename-composition-block-
|
|
4
|
+
import { An as colorCapability, E as valveCapability, En as consumablesCapability, Jt as groupCommandsCapability, Kt as GroupCommandResultSchema, Ln as brightnessCapability, Nn as HvacModeSchema, On as composerCapability, Pn as climateControlCapability, U as RUNNING_CUSTOMIZE_DEVICE_TYPES, c as kebabToCamel, ct as petFountainWaterItem, gt as lockControlCapability, in as FanDirectionSchema, jn as parseColorInput, m as ALL_CAPABILITY_DEFINITIONS, n as renameCompositionBlock, ot as PetFountainStatusSchema, sn as fanControlCapability, st as petFountainCapability, wn as ConsumableItemSchema, xn as coverCapability, z as switchCapability } from "../../rename-composition-block-kmkoIx0R.mjs";
|
|
5
5
|
import { i as isReadingQuantity } from "../../quantity-D3g5SxsZ.mjs";
|
|
6
6
|
import { i as featuresOfBoundCaps, r as DeviceType, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
|
|
7
|
-
import { D as featureForwards, E as commandedMethods, O as COMPOSED_ITEM_FIXED_FIELDS, g as planComposition, j as mediaPlayerCapability, k as expressionContainsBuiltinCall, nt as compositionFieldKey, p as buildCapabilityLookup } from "../../core-blocks.cap-
|
|
7
|
+
import { D as featureForwards, E as commandedMethods, O as COMPOSED_ITEM_FIXED_FIELDS, g as planComposition, j as mediaPlayerCapability, k as expressionContainsBuiltinCall, nt as compositionFieldKey, p as buildCapabilityLookup } from "../../core-blocks.cap-C6REo0Dd.mjs";
|
|
8
8
|
import { a as tryConvertUnit } from "../../addon-settings.cap-CHpmuaQG.mjs";
|
|
9
|
-
import { $ as statisticCadenceMs, A as compositionSourceKey, D as compositionItemFieldPath, E as compositionFeatureEnabled, G as HOUR_MS, H as DEFAULT_HISTORY_RETENTION, J as nextLocalMidnight, K as MINUTE_MS, P as isForwardInputRef, Q as planStatisticTier, R as isEngineHostedHelper, T as composedDeviceStableId, U as HISTORY_FAST_MS, W as HISTORY_SLOW_MS, X as openStatistic, Y as openReset, Z as planResetTier, at as cloneStatefulExpressionMemory, ct as evaluateStatefulExpressionCall, d as fanOutTargets, et as evaluateDerivative, f as runFanOut, gt as evaluateCount, ht as disarmRoseMemory, k as compositionSliceKey, lt as toExpressionValue, m as groupTemplate, nt as integrateReading, ot as createStatefulExpressionMemory, p as sharedColorModes, q as historyRetentionFromSettings, st as evaluateExpressionSource, tt as evaluateStatistic, u as declaredSeriesKind, v as COMPOSER_ADDON_ID, w as composedDeviceRef, z as isHistoryHelper } from "../../compile-
|
|
9
|
+
import { $ as statisticCadenceMs, A as compositionSourceKey, D as compositionItemFieldPath, E as compositionFeatureEnabled, G as HOUR_MS, H as DEFAULT_HISTORY_RETENTION, J as nextLocalMidnight, K as MINUTE_MS, P as isForwardInputRef, Q as planStatisticTier, R as isEngineHostedHelper, T as composedDeviceStableId, U as HISTORY_FAST_MS, W as HISTORY_SLOW_MS, X as openStatistic, Y as openReset, Z as planResetTier, at as cloneStatefulExpressionMemory, ct as evaluateStatefulExpressionCall, d as fanOutTargets, et as evaluateDerivative, f as runFanOut, gt as evaluateCount, ht as disarmRoseMemory, k as compositionSliceKey, lt as toExpressionValue, m as groupTemplate, nt as integrateReading, ot as createStatefulExpressionMemory, p as sharedColorModes, q as historyRetentionFromSettings, st as evaluateExpressionSource, tt as evaluateStatistic, u as declaredSeriesKind, v as COMPOSER_ADDON_ID, w as composedDeviceRef, z as isHistoryHelper } from "../../compile-DPGk4aRg.mjs";
|
|
10
10
|
import { a as normalizeUnit } from "../../source-info-DGB7SdB_.mjs";
|
|
11
|
-
import { n as normalizedNativeOwner, r as compileScalarOverride } from "../../composition-sources-
|
|
11
|
+
import { n as normalizedNativeOwner, r as compileScalarOverride } from "../../composition-sources-D5bWS3nC.mjs";
|
|
12
12
|
import { t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
|
|
13
13
|
import { t as BaseDevice } from "../../base-device-w_MD0Bf4.mjs";
|
|
14
14
|
import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$4 } from "../../capture-engine-B2MmoNND.mjs";
|
|
@@ -3,7 +3,7 @@ const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
|
3
3
|
const require_stream_catalog_cap = require("../../stream-catalog.cap-7WPsugOy.js");
|
|
4
4
|
const require_base_addon = require("../../base-addon-BG7p06Hb.js");
|
|
5
5
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
6
|
-
const require_rename_composition_block = require("../../rename-composition-block
|
|
6
|
+
const require_rename_composition_block = require("../../rename-composition-block--abG_xyW.js");
|
|
7
7
|
const require_notification_targets = require("../../notification-targets-ChqpBbtR.js");
|
|
8
8
|
const require_camstack_error = require("../../camstack-error-DJ-TUAi1.js");
|
|
9
9
|
const require_notification_rules_cap = require("../../notification-rules.cap-uSLoe2pA.js");
|
|
@@ -14,16 +14,16 @@ const require_command_origin_claim = require("../../command-origin-claim-Cief660
|
|
|
14
14
|
const require_quantity = require("../../quantity-lY1KiTSZ.js");
|
|
15
15
|
const require_tag = require("../../tag-BLraBqvp.js");
|
|
16
16
|
const require_device_type = require("../../device-type-Cnc0NiSX.js");
|
|
17
|
-
const require_device_kind = require("../../device-kind-
|
|
18
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-
|
|
17
|
+
const require_device_kind = require("../../device-kind-B7ESmha7.js");
|
|
18
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-9xvotd_3.js");
|
|
19
19
|
const require_action_index = require("../../action-index-Bcnb-jyg.js");
|
|
20
|
-
const require_compile = require("../../compile-
|
|
20
|
+
const require_compile = require("../../compile-BpAtMSvc.js");
|
|
21
21
|
const require_time_window = require("../../time-window-B6UhCArd.js");
|
|
22
|
-
const require_named_entity_store = require("../../named-entity-store-
|
|
22
|
+
const require_named_entity_store = require("../../named-entity-store-CzJ28TsK.js");
|
|
23
23
|
const require_l10n = require("../../l10n-CGMvp7NF.js");
|
|
24
24
|
const require_integration_instances_cap = require("../../integration-instances.cap-DSieF1w3.js");
|
|
25
25
|
const require_cap_call_context = require("../../cap-call-context-Bd76CbOW.js");
|
|
26
|
-
const require_composition_sources = require("../../composition-sources-
|
|
26
|
+
const require_composition_sources = require("../../composition-sources-hmri4Cu4.js");
|
|
27
27
|
const require_declared_device = require("../../declared-device-BWphj9WE.js");
|
|
28
28
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
29
29
|
const require_capture_engine = require("../../capture-engine-D_1IJmMs.js");
|
|
@@ -6732,7 +6732,6 @@ function remainingWords(amount, unit) {
|
|
|
6732
6732
|
}
|
|
6733
6733
|
var timedRunContribution = /* @__PURE__ */ contribution("timed-run", require_rename_composition_block.TimedRunStatusSchema, (slice, ctx) => {
|
|
6734
6734
|
const limit = require_rename_composition_block.timedRunLimitOf(ctx.type, ctx.role);
|
|
6735
|
-
if (limit === null) return {};
|
|
6736
6735
|
const quickRun = slice?.quickRun ?? require_rename_composition_block.timedRunQuickRun(limit, null);
|
|
6737
6736
|
const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
|
|
6738
6737
|
const runArgs = {
|
|
@@ -7121,7 +7120,11 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
7121
7120
|
* A row whose caps the device is not bound to is simply absent.
|
|
7122
7121
|
*/
|
|
7123
7122
|
/** Every other type: the facts a bound cap adds, nothing type-specific. */
|
|
7124
|
-
var HERO_LAYOUT_DEFAULT = { rows: [
|
|
7123
|
+
var HERO_LAYOUT_DEFAULT = { rows: [
|
|
7124
|
+
"contact",
|
|
7125
|
+
"motion-trigger",
|
|
7126
|
+
"run-for"
|
|
7127
|
+
] };
|
|
7125
7128
|
var HEATER_LAYOUT = { rows: ["run-for", "cycle"] };
|
|
7126
7129
|
var MEDIA_PLAYER_LAYOUT = { rows: [
|
|
7127
7130
|
"now-playing",
|
|
@@ -7150,10 +7153,10 @@ var HEAT_PUMP_LAYOUT = { rows: [
|
|
|
7150
7153
|
"heat-pump-power",
|
|
7151
7154
|
"system-mode"
|
|
7152
7155
|
] };
|
|
7153
|
-
var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
|
|
7156
|
+
var SWITCH_LAYOUT = { rows: ["motion-trigger", "run-for"] };
|
|
7154
7157
|
var LOCK_LAYOUT = { rows: ["lock"] };
|
|
7155
7158
|
var ALARM_LAYOUT = { rows: ["alarm"] };
|
|
7156
|
-
var FAN_LAYOUT = { rows: ["fan"] };
|
|
7159
|
+
var FAN_LAYOUT = { rows: ["fan", "run-for"] };
|
|
7157
7160
|
var VACUUM_LAYOUT = { rows: ["vacuum", "vacuum-suction"] };
|
|
7158
7161
|
var MOWER_LAYOUT = { rows: ["mower"] };
|
|
7159
7162
|
var FEEDER_LAYOUT = { rows: ["feeder"] };
|
|
@@ -7164,7 +7167,8 @@ var LIGHT_LAYOUT = { rows: [
|
|
|
7164
7167
|
"brightness",
|
|
7165
7168
|
"color",
|
|
7166
7169
|
"contact",
|
|
7167
|
-
"motion-trigger"
|
|
7170
|
+
"motion-trigger",
|
|
7171
|
+
"run-for"
|
|
7168
7172
|
] };
|
|
7169
7173
|
var COVER_LAYOUT = { rows: ["cover"] };
|
|
7170
7174
|
var VALVE_LAYOUT = { rows: ["valve"] };
|
|
@@ -13374,6 +13378,10 @@ var TimedRunService = class {
|
|
|
13374
13378
|
armedFor = null;
|
|
13375
13379
|
inflight = Promise.resolve();
|
|
13376
13380
|
stopped = false;
|
|
13381
|
+
/** Devices whose status has been published: a switch grafted after boot is not in the boot sweep. */
|
|
13382
|
+
announced = /* @__PURE__ */ new Set();
|
|
13383
|
+
/** Devices the last read called not bound; cleared by `bindingsChanged`. */
|
|
13384
|
+
notBound = /* @__PURE__ */ new Set();
|
|
13377
13385
|
constructor(deps) {
|
|
13378
13386
|
this.deps = deps;
|
|
13379
13387
|
}
|
|
@@ -13490,6 +13498,10 @@ var TimedRunService = class {
|
|
|
13490
13498
|
};
|
|
13491
13499
|
/** Feed one `DeviceStateChanged`: a manual off cancels the pending deadline. */
|
|
13492
13500
|
async onDeviceState(state) {
|
|
13501
|
+
await this.cancelOnManualOff(state);
|
|
13502
|
+
await this.announceLateSwitchGuarded(state);
|
|
13503
|
+
}
|
|
13504
|
+
async cancelOnManualOff(state) {
|
|
13493
13505
|
const row = this.pending.get(state.deviceId);
|
|
13494
13506
|
if (row === void 0) return;
|
|
13495
13507
|
if (!(state.capName === "switch" && row.actuator === "switch" && state.slice["on"] === false || state.capName === "pet-fountain" && row.actuator === "pet-fountain" && state.slice["pumpRunning"] === false)) return;
|
|
@@ -13497,6 +13509,38 @@ var TimedRunService = class {
|
|
|
13497
13509
|
if (at !== void 0 && this.deps.now() - at < this.deps.settleMs) return;
|
|
13498
13510
|
await this.forget(state.deviceId);
|
|
13499
13511
|
}
|
|
13512
|
+
/**
|
|
13513
|
+
* A device that gained its switch after the boot sweep (a composer graft, a late
|
|
13514
|
+
* driver, D1097) is offered a timed run with no restart: the first time its switch
|
|
13515
|
+
* speaks, its status is published once, so a surface has the one-tap run to show.
|
|
13516
|
+
*/
|
|
13517
|
+
async announceLateSwitchGuarded(state) {
|
|
13518
|
+
try {
|
|
13519
|
+
await this.announceLateSwitch(state);
|
|
13520
|
+
} catch (error) {
|
|
13521
|
+
this.deps.logger.warn("timed-run could not announce a device that gained a switch", {
|
|
13522
|
+
tags: { deviceId: state.deviceId },
|
|
13523
|
+
meta: { error: String(error) }
|
|
13524
|
+
});
|
|
13525
|
+
}
|
|
13526
|
+
}
|
|
13527
|
+
async announceLateSwitch(state) {
|
|
13528
|
+
const { deviceId } = state;
|
|
13529
|
+
if (state.capName !== "switch" || this.announced.has(deviceId)) return;
|
|
13530
|
+
if (this.notBound.has(deviceId)) return;
|
|
13531
|
+
if (await this.limitOf(deviceId) === null) {
|
|
13532
|
+
this.notBound.add(deviceId);
|
|
13533
|
+
this.announced.delete(deviceId);
|
|
13534
|
+
return;
|
|
13535
|
+
}
|
|
13536
|
+
this.announced.add(deviceId);
|
|
13537
|
+
await this.publishStatus(deviceId);
|
|
13538
|
+
}
|
|
13539
|
+
/** `DeviceBindingsChanged`: the device may now (or no longer) have a switch; ask again. */
|
|
13540
|
+
bindingsChanged(deviceId) {
|
|
13541
|
+
this.notBound.delete(deviceId);
|
|
13542
|
+
this.announced.delete(deviceId);
|
|
13543
|
+
}
|
|
13500
13544
|
/** Boot: a passed deadline is switched off once, a future one is re-armed. */
|
|
13501
13545
|
async reconcile() {
|
|
13502
13546
|
const rows = await this.deps.rows.all();
|
|
@@ -13505,7 +13549,10 @@ var TimedRunService = class {
|
|
|
13505
13549
|
else this.pending.set(deviceId, body);
|
|
13506
13550
|
this.rearm();
|
|
13507
13551
|
const ids = new Set([...rows.map((row) => row.deviceId), ...await this.deps.timedRunDeviceIds()]);
|
|
13508
|
-
for (const deviceId of ids)
|
|
13552
|
+
for (const deviceId of ids) {
|
|
13553
|
+
this.announced.add(deviceId);
|
|
13554
|
+
await this.publishStatus(deviceId);
|
|
13555
|
+
}
|
|
13509
13556
|
}
|
|
13510
13557
|
/** Resolves when every deadline that already fired has been carried out. */
|
|
13511
13558
|
async settled() {
|
|
@@ -13591,11 +13638,6 @@ var TimedRunService = class {
|
|
|
13591
13638
|
};
|
|
13592
13639
|
//#endregion
|
|
13593
13640
|
//#region src/builtins/core-blocks/timed-run/timed-run-wiring.ts
|
|
13594
|
-
/**
|
|
13595
|
-
* Wires `TimedRunService` to the hub: its rows (the `timed-runs` kind), the
|
|
13596
|
-
* device registry for a device's type, the device caps for the on/off command
|
|
13597
|
-
* and `deviceState.setCapSlice` for the mirrored slice.
|
|
13598
|
-
*/
|
|
13599
13641
|
var ARM_RETRY_DELAY_MS$2 = 5e3;
|
|
13600
13642
|
var ARM_MAX_ATTEMPTS$2 = 24;
|
|
13601
13643
|
function rowsOver(records) {
|
|
@@ -13666,14 +13708,14 @@ function buildTimedRunService(deps) {
|
|
|
13666
13708
|
rows: rowsOver(deps.records),
|
|
13667
13709
|
deviceKindOf: async (deviceId) => {
|
|
13668
13710
|
const found = await need().deviceManager.getDevice.query({ deviceId });
|
|
13669
|
-
|
|
13711
|
+
if (found === null || found === void 0) return null;
|
|
13712
|
+
const { entries } = await need().deviceManager.getBindings.query({ deviceId });
|
|
13713
|
+
return entries.some((entry) => entry.capName === "timed-run") ? {
|
|
13670
13714
|
type: found.type,
|
|
13671
13715
|
role: found.role ?? null
|
|
13672
|
-
};
|
|
13673
|
-
},
|
|
13674
|
-
timedRunDeviceIds: async () => {
|
|
13675
|
-
return (await need().deviceManager.listAll.query({ projection: "slim" })).filter((d) => require_rename_composition_block.timedRunLimitOf(d.type, d.role ?? null) !== null).map((d) => d.id);
|
|
13716
|
+
} : null;
|
|
13676
13717
|
},
|
|
13718
|
+
timedRunDeviceIds: async () => need().deviceManager.listDeviceIdsByCaps.query({ capNames: ["timed-run"] }),
|
|
13677
13719
|
actuation: actuationOver(deps.api),
|
|
13678
13720
|
quickRuns: quickRunsOver(deps.settings),
|
|
13679
13721
|
publish: async (deviceId, status) => {
|
|
@@ -19870,6 +19912,9 @@ var CoreBlocksAddon = class extends require_base_addon.BaseAddon {
|
|
|
19870
19912
|
const data = require_capture_engine.parseConfirmedStateChanged(event.data);
|
|
19871
19913
|
if (data !== null) timedRun.onDeviceState(data);
|
|
19872
19914
|
});
|
|
19915
|
+
this.subscribe({ category: require_base_addon.EventCategory.DeviceBindingsChanged }, (event) => {
|
|
19916
|
+
timedRun.bindingsChanged(event.data.deviceId);
|
|
19917
|
+
});
|
|
19873
19918
|
armTimedRuns(timedRun, this.ctx.logger.child("timed-run"), { isDisposed: () => this.disposed });
|
|
19874
19919
|
this.transpiler = await loadTranspiler(this.ctx.logger);
|
|
19875
19920
|
this.remoteRuntime?.templates.reexpandBuiltinInstances().catch((error) => this.ctx.logger.warn("automation templates: built-in instances were not re-expanded", { meta: { error: error instanceof Error ? error.message : String(error) } }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as MotionStatusSchema } from "../../stream-catalog.cap-CzwRDaqT.mjs";
|
|
2
2
|
import { _ as hydrateSchema, a as isSecretRefOwnedBy, b as EventCategory$1, f as defineAddonMigrations, i as collectSecretMarkerRefs, l as RecordIntegrationInstances, o as resolveSecretMarkers, r as secretTreeFromSchema, s as transformSecretWrite, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
|
|
3
3
|
import { W as isSecretMarker, Z as errMsg$1 } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
4
|
-
import { $ as RemoteLayoutPayloadSchema, $n as unitsForQuantity, $t as FanPresetSchema, A as TemplateKindSchema, At as measurementFitsRole, B as SmokeStatusSchema, Bn as AutomationControlStatusSchema, Bt as timedRunRemaining, C as WaterHeaterStatusSchema, Cn as ContactStatusSchema, Ct as projectDeviceRow, D as VacuumControlStatusSchema, Dn as COMPOSER_RUNNER_ID, Dt as contactMeasurement, Et as resolveHeroSceneId, F as TamperStatusSchema, Fn as CarbonMonoxideStatusSchema, Ft as TimedRunStatusSchema, G as hasOwnRunningPowerDefaults, Gt as GroupStatusSchema, H as schedulersCapability, Hn as AirQualitySensorStatusSchema, Ht as HeatingValveStatusSchema, I as tagsCapability, In as BrightnessStatusSchema, It as timedRunCapability, J as REMOTE_MEDIA_COMMANDS, K as runningPowerDefaultsFor, Kn as actionWaitTotalMs, L as SWITCH_DEFAULT_OPTIONS, Lt as timedRunLimitOf, M as AutomationTemplatePayloadSchema, Mn as ClimateControlStatusSchema, Mt as temperatureMeasurement, N as reexpandAutomationInstance, Nt as textMeasurement, O as UpdateStatusSchema, Ot as emptyMeasurement, P as TemperatureSensorStatusSchema, Pt as NOT_REPORTED, Q as RemoteAssumedStateSchema, Qn as baseUnitForQuantity, Qt as FAN_CAPTURE_FIELDS, R as SwitchStatusSchema, Rn as BinaryStatusSchema, Rt as timedRunMaxIn, S as WeatherStatusSchema, Sn as ControlStatusSchema, St as ROW_READING_FACT_IDS, T as ValveStatusSchema, Tn as ConsumablesStatusSchema, Tt as REMOTE_OPEN_ACTION_ID, Ut as HeatPumpStatusSchema, V as ScriptRunnerStatusSchema, Vn as AmbientLightSensorStatusSchema, Vt as timedRunSeconds, W as RunningStateStatusSchema, Wn as actionsCapability, Wt as heatPumpInstantCop, X as EMPTY_REMOTE_ASSUMED_STATE, Xn as normalizeActionUnits, Xt as GasStatusSchema, Y as remoteCapability, Yn as capUnitResolver, Yt as GroupActiveSchema, Z as EMPTY_REMOTE_CONFIG, Zn as normalizeRecipeUnits, Zt as FloodStatusSchema, _ as WorkloadStatusSchema, _t as LawnMowerControlStatusSchema, an as SetOscillationAxisInputSchema, ar as addonIdOfActionId, bn as CoverStatusSchema, bt as HumidifierStatusSchema, c as kebabToCamel, cn as EnumSensorStatusSchema, cr as resolveActionVariables, dn as DishwasherStatusSchema, dt as NumericSensorStatusSchema, en as fanPresetsCapability, er as ActionError, et as readStoredRemoteConfig, ft as NetworkLinkStatusSchema, ht as LockControlStatusSchema, ir as INTERNAL_ACTION_PREFIX, it as PowerMeterStatusSchema, j as checkTemplatePayload, jt as powerMeasurement, k as templateCapability, kn as ColorStatusSchema, kt as humidityMeasurement, ln as DoorbellStatusSchema, lr as EventEmitterStatusSchema, lt as PetFeederStatusSchema, m as ALL_CAPABILITY_DEFINITIONS, mt as MeterStatusSchema, nn as FAN_OSCILLATION_AXIS_SETTABLE, nr as ActionVariableSchema, nt as PressureSensorStatusSchema, on as fanAxisPath, or as internalActionId, ot as PetFountainStatusSchema, pt as MotionTriggerStatusSchema, q as remoteLayoutComponentsCapability, qn as actionSourceCapability, qt as GroupCommandsSchema, rn as FanControlStatusSchema, rr as IDLE_ACTION_STATUS, rt as PresenceStatusSchema, sr as isInternalActionId, t as composedBlockIdOf, tn as FAN_OSCILLATION_AXES, tr as ActionMinDelaySecSchema, tt as PumpCycleStatusSchema, un as DoNotDisturbStatusSchema, vt as ImageStatusSchema, w as VibrationStatusSchema, wt as HERO_SCENE_ROW_IDS, x as WeatherStationStatusSchema, xt as heroLayoutCapability, yt as HumiditySensorStatusSchema, zn as BatteryStatusSchema, zt as timedRunQuickRun } from "../../rename-composition-block-
|
|
4
|
+
import { $ as RemoteLayoutPayloadSchema, $n as unitsForQuantity, $t as FanPresetSchema, A as TemplateKindSchema, At as measurementFitsRole, B as SmokeStatusSchema, Bn as AutomationControlStatusSchema, Bt as timedRunRemaining, C as WaterHeaterStatusSchema, Cn as ContactStatusSchema, Ct as projectDeviceRow, D as VacuumControlStatusSchema, Dn as COMPOSER_RUNNER_ID, Dt as contactMeasurement, Et as resolveHeroSceneId, F as TamperStatusSchema, Fn as CarbonMonoxideStatusSchema, Ft as TimedRunStatusSchema, G as hasOwnRunningPowerDefaults, Gt as GroupStatusSchema, H as schedulersCapability, Hn as AirQualitySensorStatusSchema, Ht as HeatingValveStatusSchema, I as tagsCapability, In as BrightnessStatusSchema, It as timedRunCapability, J as REMOTE_MEDIA_COMMANDS, K as runningPowerDefaultsFor, Kn as actionWaitTotalMs, L as SWITCH_DEFAULT_OPTIONS, Lt as timedRunLimitOf, M as AutomationTemplatePayloadSchema, Mn as ClimateControlStatusSchema, Mt as temperatureMeasurement, N as reexpandAutomationInstance, Nt as textMeasurement, O as UpdateStatusSchema, Ot as emptyMeasurement, P as TemperatureSensorStatusSchema, Pt as NOT_REPORTED, Q as RemoteAssumedStateSchema, Qn as baseUnitForQuantity, Qt as FAN_CAPTURE_FIELDS, R as SwitchStatusSchema, Rn as BinaryStatusSchema, Rt as timedRunMaxIn, S as WeatherStatusSchema, Sn as ControlStatusSchema, St as ROW_READING_FACT_IDS, T as ValveStatusSchema, Tn as ConsumablesStatusSchema, Tt as REMOTE_OPEN_ACTION_ID, Ut as HeatPumpStatusSchema, V as ScriptRunnerStatusSchema, Vn as AmbientLightSensorStatusSchema, Vt as timedRunSeconds, W as RunningStateStatusSchema, Wn as actionsCapability, Wt as heatPumpInstantCop, X as EMPTY_REMOTE_ASSUMED_STATE, Xn as normalizeActionUnits, Xt as GasStatusSchema, Y as remoteCapability, Yn as capUnitResolver, Yt as GroupActiveSchema, Z as EMPTY_REMOTE_CONFIG, Zn as normalizeRecipeUnits, Zt as FloodStatusSchema, _ as WorkloadStatusSchema, _t as LawnMowerControlStatusSchema, an as SetOscillationAxisInputSchema, ar as addonIdOfActionId, bn as CoverStatusSchema, bt as HumidifierStatusSchema, c as kebabToCamel, cn as EnumSensorStatusSchema, cr as resolveActionVariables, dn as DishwasherStatusSchema, dt as NumericSensorStatusSchema, en as fanPresetsCapability, er as ActionError, et as readStoredRemoteConfig, ft as NetworkLinkStatusSchema, ht as LockControlStatusSchema, ir as INTERNAL_ACTION_PREFIX, it as PowerMeterStatusSchema, j as checkTemplatePayload, jt as powerMeasurement, k as templateCapability, kn as ColorStatusSchema, kt as humidityMeasurement, ln as DoorbellStatusSchema, lr as EventEmitterStatusSchema, lt as PetFeederStatusSchema, m as ALL_CAPABILITY_DEFINITIONS, mt as MeterStatusSchema, nn as FAN_OSCILLATION_AXIS_SETTABLE, nr as ActionVariableSchema, nt as PressureSensorStatusSchema, on as fanAxisPath, or as internalActionId, ot as PetFountainStatusSchema, pt as MotionTriggerStatusSchema, q as remoteLayoutComponentsCapability, qn as actionSourceCapability, qt as GroupCommandsSchema, rn as FanControlStatusSchema, rr as IDLE_ACTION_STATUS, rt as PresenceStatusSchema, sr as isInternalActionId, t as composedBlockIdOf, tn as FAN_OSCILLATION_AXES, tr as ActionMinDelaySecSchema, tt as PumpCycleStatusSchema, un as DoNotDisturbStatusSchema, vt as ImageStatusSchema, w as VibrationStatusSchema, wt as HERO_SCENE_ROW_IDS, x as WeatherStationStatusSchema, xt as heroLayoutCapability, yt as HumiditySensorStatusSchema, zn as BatteryStatusSchema, zt as timedRunQuickRun } from "../../rename-composition-block-kmkoIx0R.mjs";
|
|
5
5
|
import { r as listNotificationTargets } from "../../notification-targets-DUA6-F2t.mjs";
|
|
6
6
|
import { t as userError } from "../../camstack-error-viZYfcj9.mjs";
|
|
7
7
|
import { i as NcTaggedRuleKindSchema, o as AlarmPanelStatusSchema, u as NotificationSchema } from "../../notification-rules.cap-ClvK6QT1.mjs";
|
|
@@ -12,16 +12,16 @@ import { n as ruleFireOfClaim } from "../../command-origin-claim-D1Wy7Qld.mjs";
|
|
|
12
12
|
import { n as baseUnitOf } from "../../quantity-D3g5SxsZ.mjs";
|
|
13
13
|
import { a as TagsFieldSchema, c as removeFromTags, i as TagStyleSchema, l as renameInTags, n as TagIdsFieldSchema, o as defaultTagColorId, r as TagNameSchema, s as normalizeTags, u as tagKey } from "../../tag-DU8pm9Bi.mjs";
|
|
14
14
|
import { n as DeviceRole, r as DeviceType$1, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
|
|
15
|
-
import {
|
|
16
|
-
import { A as MediaPlayerStatusSchema, Bt as holdOf, C as PowerSourceStateSchema, Ct as nestedStepsOf, Et as validateRecipeBounds, Ft as forEachLeaf, Gt as QuantityUnitError, I as remoteSourceSteps, It as hasEventLeaves, J as capLinkServedFields, L as resolveRemoteSource, Lt as isEventLeaf, P as findChannelSource, Q as CAP_CUSTOMIZE_CATALOG, Rt as compareValues, S as PowerSourceInfoSchema, St as REPEAT_ITEM_VAR, Tt as stepGuardOf, U as toTimings, X as expandCapLinks, Y as declaredCapLink, Z as projectCapLinkOf, _ as replacedFieldKeys, _t as validateSchedulerInput, a as coreBlockComposition, at as AutomationStateDocSchema, b as powerSourceActuatorConflicts, bt as AutomationRecipeSchema, c as coreBlocksCapability, ct as buildStepArgsTrace, d as resolveCoreBlockFiles, en as ACTION_TARGET_INVALIDATION_EVENTS, f as describeComposableCaps, ft as SchedulerError, g as planComposition, h as compositionUnionReads, ht as SchedulerSchema, i as coreBlockAddonId, l as normalizeCoreBlockWrite, lt as DEFAULT_HOLD_OVERRIDE, m as compositionSourceRefs, n as CORE_BLOCK_ADDON_PREFIX, nn as canonicalStoredStepTargets, o as coreBlockIdFromAddonId, ot as EMPTY_AUTOMATION_STATE, p as buildCapabilityLookup, r as CoreBlockSchema, rn as ON_FOR_MAX_SECONDS, s as coreBlockSourceKind, st as appendTrace, t as CORE_BLOCKS_ADDON_ID, tn as ActionTargetResolver, u as resolveCoreBlockEntry, v as topLevelFieldsOf, vt as ActionStepSchema, w as powerSourceCapability, wt as stepConditionsOf, x as powerSourceLinkOfComposition, xt as HTTP_TEXT_CAP, y as validateComposition, z as customKeyOfRole } from "../../core-blocks.cap-
|
|
15
|
+
import { i as isAirConditioner, t as canonicalStoredDeviceType } from "../../device-kind-B6G_HfgC.mjs";
|
|
16
|
+
import { A as MediaPlayerStatusSchema, Bt as holdOf, C as PowerSourceStateSchema, Ct as nestedStepsOf, Et as validateRecipeBounds, Ft as forEachLeaf, Gt as QuantityUnitError, I as remoteSourceSteps, It as hasEventLeaves, J as capLinkServedFields, L as resolveRemoteSource, Lt as isEventLeaf, P as findChannelSource, Q as CAP_CUSTOMIZE_CATALOG, Rt as compareValues, S as PowerSourceInfoSchema, St as REPEAT_ITEM_VAR, Tt as stepGuardOf, U as toTimings, X as expandCapLinks, Y as declaredCapLink, Z as projectCapLinkOf, _ as replacedFieldKeys, _t as validateSchedulerInput, a as coreBlockComposition, at as AutomationStateDocSchema, b as powerSourceActuatorConflicts, bt as AutomationRecipeSchema, c as coreBlocksCapability, ct as buildStepArgsTrace, d as resolveCoreBlockFiles, en as ACTION_TARGET_INVALIDATION_EVENTS, f as describeComposableCaps, ft as SchedulerError, g as planComposition, h as compositionUnionReads, ht as SchedulerSchema, i as coreBlockAddonId, l as normalizeCoreBlockWrite, lt as DEFAULT_HOLD_OVERRIDE, m as compositionSourceRefs, n as CORE_BLOCK_ADDON_PREFIX, nn as canonicalStoredStepTargets, o as coreBlockIdFromAddonId, ot as EMPTY_AUTOMATION_STATE, p as buildCapabilityLookup, r as CoreBlockSchema, rn as ON_FOR_MAX_SECONDS, s as coreBlockSourceKind, st as appendTrace, t as CORE_BLOCKS_ADDON_ID, tn as ActionTargetResolver, u as resolveCoreBlockEntry, v as topLevelFieldsOf, vt as ActionStepSchema, w as powerSourceCapability, wt as stepConditionsOf, x as powerSourceLinkOfComposition, xt as HTTP_TEXT_CAP, y as validateComposition, z as customKeyOfRole } from "../../core-blocks.cap-C6REo0Dd.mjs";
|
|
17
17
|
import { a as findVocabAction, i as assertDeviceOffers, n as actionEffect, o as vocabActionIdFor, s as vocabCall, t as VocabActionError } from "../../action-index-DwPHO2nz.mjs";
|
|
18
|
-
import { A as compositionSourceKey, C as canonicalStoredBlockTarget, E as compositionFeatureEnabled, I as HelperMemberSchema, L as helperMembers, S as CompositionSchema, T as composedDeviceStableId, V as DAY_MS, _t as evaluateDwell, q as historyRetentionFromSettings, v as COMPOSER_ADDON_ID, w as composedDeviceRef } from "../../compile-
|
|
18
|
+
import { A as compositionSourceKey, C as canonicalStoredBlockTarget, E as compositionFeatureEnabled, I as HelperMemberSchema, L as helperMembers, S as CompositionSchema, T as composedDeviceStableId, V as DAY_MS, _t as evaluateDwell, q as historyRetentionFromSettings, v as COMPOSER_ADDON_ID, w as composedDeviceRef } from "../../compile-DPGk4aRg.mjs";
|
|
19
19
|
import { _ as zoneOnlySite, d as nextOccurrence, f as occurrenceOn, g as weekdayOfLocalDate, p as siteFor, u as localDateOf } from "../../time-window-BnUBULgu.mjs";
|
|
20
|
-
import { _ as stableIdMapOf, a as loadPrefixed, d as ConditionMirror, f as collectWhenMirrorSources, g as nextTimeBoundaryInMs, h as hasTimeLeaves, l as tagIdFromKey, m as hasHoldLeaves, n as EntityNotFoundError, o as unwrapStoredValue, p as evaluateWhenTree, r as NamedEntityStore, t as EntityNameTakenError } from "../../named-entity-store-
|
|
20
|
+
import { _ as stableIdMapOf, a as loadPrefixed, d as ConditionMirror, f as collectWhenMirrorSources, g as nextTimeBoundaryInMs, h as hasTimeLeaves, l as tagIdFromKey, m as hasHoldLeaves, n as EntityNotFoundError, o as unwrapStoredValue, p as evaluateWhenTree, r as NamedEntityStore, t as EntityNameTakenError } from "../../named-entity-store-DJxyweoS.mjs";
|
|
21
21
|
import { t } from "../../l10n-Bu6aUvSY.mjs";
|
|
22
22
|
import { t as integrationInstancesCapability } from "../../integration-instances.cap-BWttO42A.mjs";
|
|
23
23
|
import { t as commandOrigin$1 } from "../../cap-call-context-DNwdgGSQ.mjs";
|
|
24
|
-
import { r as compileScalarOverride, t as describeCompositionSources } from "../../composition-sources-
|
|
24
|
+
import { r as compileScalarOverride, t as describeCompositionSources } from "../../composition-sources-D5bWS3nC.mjs";
|
|
25
25
|
import { r as seedInstanceOnce, t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
|
|
26
26
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
27
27
|
import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$1 } from "../../capture-engine-B2MmoNND.mjs";
|
|
@@ -6726,7 +6726,6 @@ function remainingWords(amount, unit) {
|
|
|
6726
6726
|
}
|
|
6727
6727
|
var timedRunContribution = /* @__PURE__ */ contribution("timed-run", TimedRunStatusSchema, (slice, ctx) => {
|
|
6728
6728
|
const limit = timedRunLimitOf(ctx.type, ctx.role);
|
|
6729
|
-
if (limit === null) return {};
|
|
6730
6729
|
const quickRun = slice?.quickRun ?? timedRunQuickRun(limit, null);
|
|
6731
6730
|
const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
|
|
6732
6731
|
const runArgs = {
|
|
@@ -7115,7 +7114,11 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
7115
7114
|
* A row whose caps the device is not bound to is simply absent.
|
|
7116
7115
|
*/
|
|
7117
7116
|
/** Every other type: the facts a bound cap adds, nothing type-specific. */
|
|
7118
|
-
var HERO_LAYOUT_DEFAULT = { rows: [
|
|
7117
|
+
var HERO_LAYOUT_DEFAULT = { rows: [
|
|
7118
|
+
"contact",
|
|
7119
|
+
"motion-trigger",
|
|
7120
|
+
"run-for"
|
|
7121
|
+
] };
|
|
7119
7122
|
var HEATER_LAYOUT = { rows: ["run-for", "cycle"] };
|
|
7120
7123
|
var MEDIA_PLAYER_LAYOUT = { rows: [
|
|
7121
7124
|
"now-playing",
|
|
@@ -7144,10 +7147,10 @@ var HEAT_PUMP_LAYOUT = { rows: [
|
|
|
7144
7147
|
"heat-pump-power",
|
|
7145
7148
|
"system-mode"
|
|
7146
7149
|
] };
|
|
7147
|
-
var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
|
|
7150
|
+
var SWITCH_LAYOUT = { rows: ["motion-trigger", "run-for"] };
|
|
7148
7151
|
var LOCK_LAYOUT = { rows: ["lock"] };
|
|
7149
7152
|
var ALARM_LAYOUT = { rows: ["alarm"] };
|
|
7150
|
-
var FAN_LAYOUT = { rows: ["fan"] };
|
|
7153
|
+
var FAN_LAYOUT = { rows: ["fan", "run-for"] };
|
|
7151
7154
|
var VACUUM_LAYOUT = { rows: ["vacuum", "vacuum-suction"] };
|
|
7152
7155
|
var MOWER_LAYOUT = { rows: ["mower"] };
|
|
7153
7156
|
var FEEDER_LAYOUT = { rows: ["feeder"] };
|
|
@@ -7158,7 +7161,8 @@ var LIGHT_LAYOUT = { rows: [
|
|
|
7158
7161
|
"brightness",
|
|
7159
7162
|
"color",
|
|
7160
7163
|
"contact",
|
|
7161
|
-
"motion-trigger"
|
|
7164
|
+
"motion-trigger",
|
|
7165
|
+
"run-for"
|
|
7162
7166
|
] };
|
|
7163
7167
|
var COVER_LAYOUT = { rows: ["cover"] };
|
|
7164
7168
|
var VALVE_LAYOUT = { rows: ["valve"] };
|
|
@@ -13367,6 +13371,10 @@ var TimedRunService = class {
|
|
|
13367
13371
|
armedFor = null;
|
|
13368
13372
|
inflight = Promise.resolve();
|
|
13369
13373
|
stopped = false;
|
|
13374
|
+
/** Devices whose status has been published: a switch grafted after boot is not in the boot sweep. */
|
|
13375
|
+
announced = /* @__PURE__ */ new Set();
|
|
13376
|
+
/** Devices the last read called not bound; cleared by `bindingsChanged`. */
|
|
13377
|
+
notBound = /* @__PURE__ */ new Set();
|
|
13370
13378
|
constructor(deps) {
|
|
13371
13379
|
this.deps = deps;
|
|
13372
13380
|
}
|
|
@@ -13483,6 +13491,10 @@ var TimedRunService = class {
|
|
|
13483
13491
|
};
|
|
13484
13492
|
/** Feed one `DeviceStateChanged`: a manual off cancels the pending deadline. */
|
|
13485
13493
|
async onDeviceState(state) {
|
|
13494
|
+
await this.cancelOnManualOff(state);
|
|
13495
|
+
await this.announceLateSwitchGuarded(state);
|
|
13496
|
+
}
|
|
13497
|
+
async cancelOnManualOff(state) {
|
|
13486
13498
|
const row = this.pending.get(state.deviceId);
|
|
13487
13499
|
if (row === void 0) return;
|
|
13488
13500
|
if (!(state.capName === "switch" && row.actuator === "switch" && state.slice["on"] === false || state.capName === "pet-fountain" && row.actuator === "pet-fountain" && state.slice["pumpRunning"] === false)) return;
|
|
@@ -13490,6 +13502,38 @@ var TimedRunService = class {
|
|
|
13490
13502
|
if (at !== void 0 && this.deps.now() - at < this.deps.settleMs) return;
|
|
13491
13503
|
await this.forget(state.deviceId);
|
|
13492
13504
|
}
|
|
13505
|
+
/**
|
|
13506
|
+
* A device that gained its switch after the boot sweep (a composer graft, a late
|
|
13507
|
+
* driver, D1097) is offered a timed run with no restart: the first time its switch
|
|
13508
|
+
* speaks, its status is published once, so a surface has the one-tap run to show.
|
|
13509
|
+
*/
|
|
13510
|
+
async announceLateSwitchGuarded(state) {
|
|
13511
|
+
try {
|
|
13512
|
+
await this.announceLateSwitch(state);
|
|
13513
|
+
} catch (error) {
|
|
13514
|
+
this.deps.logger.warn("timed-run could not announce a device that gained a switch", {
|
|
13515
|
+
tags: { deviceId: state.deviceId },
|
|
13516
|
+
meta: { error: String(error) }
|
|
13517
|
+
});
|
|
13518
|
+
}
|
|
13519
|
+
}
|
|
13520
|
+
async announceLateSwitch(state) {
|
|
13521
|
+
const { deviceId } = state;
|
|
13522
|
+
if (state.capName !== "switch" || this.announced.has(deviceId)) return;
|
|
13523
|
+
if (this.notBound.has(deviceId)) return;
|
|
13524
|
+
if (await this.limitOf(deviceId) === null) {
|
|
13525
|
+
this.notBound.add(deviceId);
|
|
13526
|
+
this.announced.delete(deviceId);
|
|
13527
|
+
return;
|
|
13528
|
+
}
|
|
13529
|
+
this.announced.add(deviceId);
|
|
13530
|
+
await this.publishStatus(deviceId);
|
|
13531
|
+
}
|
|
13532
|
+
/** `DeviceBindingsChanged`: the device may now (or no longer) have a switch; ask again. */
|
|
13533
|
+
bindingsChanged(deviceId) {
|
|
13534
|
+
this.notBound.delete(deviceId);
|
|
13535
|
+
this.announced.delete(deviceId);
|
|
13536
|
+
}
|
|
13493
13537
|
/** Boot: a passed deadline is switched off once, a future one is re-armed. */
|
|
13494
13538
|
async reconcile() {
|
|
13495
13539
|
const rows = await this.deps.rows.all();
|
|
@@ -13498,7 +13542,10 @@ var TimedRunService = class {
|
|
|
13498
13542
|
else this.pending.set(deviceId, body);
|
|
13499
13543
|
this.rearm();
|
|
13500
13544
|
const ids = new Set([...rows.map((row) => row.deviceId), ...await this.deps.timedRunDeviceIds()]);
|
|
13501
|
-
for (const deviceId of ids)
|
|
13545
|
+
for (const deviceId of ids) {
|
|
13546
|
+
this.announced.add(deviceId);
|
|
13547
|
+
await this.publishStatus(deviceId);
|
|
13548
|
+
}
|
|
13502
13549
|
}
|
|
13503
13550
|
/** Resolves when every deadline that already fired has been carried out. */
|
|
13504
13551
|
async settled() {
|
|
@@ -13584,11 +13631,6 @@ var TimedRunService = class {
|
|
|
13584
13631
|
};
|
|
13585
13632
|
//#endregion
|
|
13586
13633
|
//#region src/builtins/core-blocks/timed-run/timed-run-wiring.ts
|
|
13587
|
-
/**
|
|
13588
|
-
* Wires `TimedRunService` to the hub: its rows (the `timed-runs` kind), the
|
|
13589
|
-
* device registry for a device's type, the device caps for the on/off command
|
|
13590
|
-
* and `deviceState.setCapSlice` for the mirrored slice.
|
|
13591
|
-
*/
|
|
13592
13634
|
var ARM_RETRY_DELAY_MS$2 = 5e3;
|
|
13593
13635
|
var ARM_MAX_ATTEMPTS$2 = 24;
|
|
13594
13636
|
function rowsOver(records) {
|
|
@@ -13659,14 +13701,14 @@ function buildTimedRunService(deps) {
|
|
|
13659
13701
|
rows: rowsOver(deps.records),
|
|
13660
13702
|
deviceKindOf: async (deviceId) => {
|
|
13661
13703
|
const found = await need().deviceManager.getDevice.query({ deviceId });
|
|
13662
|
-
|
|
13704
|
+
if (found === null || found === void 0) return null;
|
|
13705
|
+
const { entries } = await need().deviceManager.getBindings.query({ deviceId });
|
|
13706
|
+
return entries.some((entry) => entry.capName === "timed-run") ? {
|
|
13663
13707
|
type: found.type,
|
|
13664
13708
|
role: found.role ?? null
|
|
13665
|
-
};
|
|
13666
|
-
},
|
|
13667
|
-
timedRunDeviceIds: async () => {
|
|
13668
|
-
return (await need().deviceManager.listAll.query({ projection: "slim" })).filter((d) => timedRunLimitOf(d.type, d.role ?? null) !== null).map((d) => d.id);
|
|
13709
|
+
} : null;
|
|
13669
13710
|
},
|
|
13711
|
+
timedRunDeviceIds: async () => need().deviceManager.listDeviceIdsByCaps.query({ capNames: ["timed-run"] }),
|
|
13670
13712
|
actuation: actuationOver(deps.api),
|
|
13671
13713
|
quickRuns: quickRunsOver(deps.settings),
|
|
13672
13714
|
publish: async (deviceId, status) => {
|
|
@@ -19853,6 +19895,9 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
19853
19895
|
const data = parseConfirmedStateChanged(event.data);
|
|
19854
19896
|
if (data !== null) timedRun.onDeviceState(data);
|
|
19855
19897
|
});
|
|
19898
|
+
this.subscribe({ category: EventCategory$1.DeviceBindingsChanged }, (event) => {
|
|
19899
|
+
timedRun.bindingsChanged(event.data.deviceId);
|
|
19900
|
+
});
|
|
19856
19901
|
armTimedRuns(timedRun, this.ctx.logger.child("timed-run"), { isDisposed: () => this.disposed });
|
|
19857
19902
|
this.transpiler = await loadTranspiler(this.ctx.logger);
|
|
19858
19903
|
this.remoteRuntime?.templates.reexpandBuiltinInstances().catch((error) => this.ctx.logger.warn("automation templates: built-in instances were not re-expanded", { meta: { error: error instanceof Error ? error.message : String(error) } }));
|
|
@@ -46,9 +46,12 @@ export interface DeviceKind {
|
|
|
46
46
|
}
|
|
47
47
|
export interface TimedRunServiceDeps {
|
|
48
48
|
readonly rows: TimedRunRows;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The device's type and role, or null when it is gone or has nothing to run (no
|
|
51
|
+
* switch, and not a pet fountain, D1097): together they decide the limit.
|
|
52
|
+
*/
|
|
50
53
|
readonly deviceKindOf: (deviceId: number) => Promise<DeviceKind | null>;
|
|
51
|
-
/** Every device
|
|
54
|
+
/** Every device a timed run is offered on: boot publishes each one's status. */
|
|
52
55
|
readonly timedRunDeviceIds: () => Promise<readonly number[]>;
|
|
53
56
|
readonly actuation: TimedRunActuation;
|
|
54
57
|
readonly quickRuns: TimedRunQuickRuns;
|
|
@@ -76,6 +79,10 @@ export declare class TimedRunService implements ITimedRunProvider {
|
|
|
76
79
|
private armedFor;
|
|
77
80
|
private inflight;
|
|
78
81
|
private stopped;
|
|
82
|
+
/** Devices whose status has been published: a switch grafted after boot is not in the boot sweep. */
|
|
83
|
+
private readonly announced;
|
|
84
|
+
/** Devices the last read called not bound; cleared by `bindingsChanged`. */
|
|
85
|
+
private readonly notBound;
|
|
79
86
|
constructor(deps: TimedRunServiceDeps);
|
|
80
87
|
getStatus: ITimedRunProvider["getStatus"];
|
|
81
88
|
getOptions: ITimedRunProvider["getOptions"];
|
|
@@ -97,6 +104,16 @@ export declare class TimedRunService implements ITimedRunProvider {
|
|
|
97
104
|
cancel: ITimedRunProvider["cancel"];
|
|
98
105
|
/** Feed one `DeviceStateChanged`: a manual off cancels the pending deadline. */
|
|
99
106
|
onDeviceState(state: ObservedDeviceState): Promise<void>;
|
|
107
|
+
private cancelOnManualOff;
|
|
108
|
+
/**
|
|
109
|
+
* A device that gained its switch after the boot sweep (a composer graft, a late
|
|
110
|
+
* driver, D1097) is offered a timed run with no restart: the first time its switch
|
|
111
|
+
* speaks, its status is published once, so a surface has the one-tap run to show.
|
|
112
|
+
*/
|
|
113
|
+
private announceLateSwitchGuarded;
|
|
114
|
+
private announceLateSwitch;
|
|
115
|
+
/** `DeviceBindingsChanged`: the device may now (or no longer) have a switch; ask again. */
|
|
116
|
+
bindingsChanged(deviceId: number): void;
|
|
100
117
|
/** Boot: a passed deadline is switched off once, a future one is re-armed. */
|
|
101
118
|
reconcile(): Promise<void>;
|
|
102
119
|
/** Resolves when every deadline that already fired has been carried out. */
|