@camstack/types 1.2.529 → 1.2.530
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/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/capability-definition.d.ts +15 -0
- package/dist/capabilities/climate-control.cap.d.ts +26 -1
- package/dist/capabilities/enum-sensor.cap.d.ts +1 -1
- package/dist/capabilities/hero-layout.cap.d.ts +158 -17
- package/dist/capabilities/water-heater.cap.d.ts +5 -1
- package/dist/device/hero/climate-view.d.ts +45 -0
- package/dist/device/hero/hero-contribution-kit.d.ts +27 -0
- package/dist/device/hero/hero-contributions-access.d.ts +2 -0
- package/dist/device/hero/hero-contributions-actuators.d.ts +2 -0
- package/dist/device/hero/hero-contributions-climate.d.ts +3 -0
- package/dist/device/hero/hero-contributions-devices.d.ts +2 -0
- package/dist/device/hero/hero-contributions-groups.d.ts +2 -0
- package/dist/device/hero/hero-contributions-sensors.d.ts +2 -0
- package/dist/device/hero/hero-contributions.d.ts +2 -5
- package/dist/device/hero/hero-fragment.d.ts +11 -1
- package/dist/device/hero/hero-look.d.ts +80 -14
- package/dist/device/hero/hero-model.d.ts +224 -34
- package/dist/device/hero/hero-row.d.ts +30 -5
- package/dist/device/hero/media-player-view.d.ts +6 -0
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/runtime-state-durability.d.ts +6 -1
- package/dist/index.js +2488 -216
- package/dist/index.mjs +2488 -216
- package/dist/{sleep-CqvzKIq2.mjs → sleep-CfYvHNFz.mjs} +16 -0
- package/dist/{sleep-DX_umr22.js → sleep-CqsZMKxq.js} +16 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as PipelineRunResultBridge, $i as dehydrateSchema, $n as DEVICE_SETTINGS_CONTRIBUTION_METHODS, $r as RECORD_MAX_DATA_BYTES, $t as DEFAULT_DISPLAY_PREFERENCE, A as isCommand, Ai as RevConflictError, An as PEER_BYTES_STALL_MS, Ar as createDurableState, At as isDebugChannelName, B as withoutCallerStamp, Bi as secretsOverMigrationApi, Bn as RecordFieldPathSchema, Br as mapSecretLeaves, Bt as DecodedAudioChunkSchema, Ci as PlaintextSecretError, Cn as forgetKnownSecret, Cr as resolveSecretMarkers, Ct as DEBUG_WATCH_REARM_EVERY_MS, D as createSliceHandle, Di as RecordTooLargeError, Dn as shortSecretRefHash, Dr as resolveDeviceSettings, Dt as __resetDebugInterestForTests, E as createMirrorSource, Ei as RecordSecretUnavailableError, En as scrubKnownSecrets, Er as nodeIdOfScopedKey, Et as DebugWatchTable, Fi as recordsErrorFromMessage, Fn as SHARE_VIEW_KINDS, Fr as RecordIntegrationInstances, Ft as CAM_PROFILE_ORDER, G as CAP_COMMAND_ORIGIN_CONTEXT_KEY, Gi as createEvent, Gn as StoredRecordKindDeclarationSchema, Gr as secretArrayPrefixes, Gt as StreamSourceEntrySchema, H as defineCustomActions, Hi as AddonMigrationDefinitionError, Hn as RecordKindDeclarationSchema, Hr as recordArrayItemPath, Ht as ProfileRtspEntrySchema, Ii as defaultIntegrationDepsOver, In as DisposerChain, Ir as isInstanceEnabled, It as CamProfileSchema, J as nodePin, Ji as WELL_KNOWN_TABS, Jn as defineRecordKinds, Jr as RECORD_CLASSES, Jt as SubscribeAudioChunksResultSchema, K as CAP_NODE_PIN_CONTEXT_KEY, Ki as emitReadiness, Kn as assertValidDeclaration, Kr as RECORD_BATCH_MAX, Kt as StreamSourceSchema, L as CAP_NAMES, Li as integrationRowsApiOver, Ln as defineEntryKind, Lr as secretViewsOf, Lt as CamStreamKindSchema, M as HF_BASE_URL, Mi as UnindexedFilterError, Mn as PeerBytesTicketSchema, Mr as registrySwitchPortsOver, Mt as AudioStreamPickSchema, N as HF_REPO, Ni as UnknownRecordKindError, Nn as CALLER_USERNAME_HEADER, Nr as registrySwitchToBodyId, Nt as BrokerStatsSchema, O as auditedFields, Oi as RecordUniqueViolationError, On as PEER_BYTES_CHUNK_BYTES, Or as resolvedValues, Ot as createDebugEmitter, P as RUNTIME_DEFAULTS, Pi as asRecordsError, Pn as DATAPLANE_SECRET_HEADER, Pr as registrySwitchToBodyMigration, Pt as BrokerStatusSchema, Q as viewerUiCapability, Qi as dehydrateConfigField, Qn as DEFAULT_RUNTIME_STATE_DURABILITY, Qr as RECORD_ID_MAX_LENGTH, Qt as selectAssignedProfileSlots, Ri as recordsOverMigrationApi, Rn as entryBody, Rr as REMOVE_LEAF, Rt as CamStreamResolutionSchema, S as invokeTrpcLeaf, Sa as isAudioChunkFormat, Si as NoCallerError, Sn as clearKnownSecrets, Sr as isSecretRefOwnedBy, St as DEBUG_WATCH_HARD_CAP_MS, T as createLazyTrpcSource, Ti as RecordNotFoundError, Tn as registerKnownSecret, Tr as SCOPED_SETTINGS_SCOPES, Tt as DebugInterest, U as describeCustomActions, Ui as defineAddonMigrations, Un as RecordKindNameSchema, Ur as recordSecretCollection, Ut as ProfileSlotSchema, V as customAction, Vi as switchRecordsOverMigrationApi, Vn as RecordIndexSchema, Vr as parseSecretPath, Vt as FrameHandleSchema, W as deviceCustomAction, Wi as runAddonMigrations, Wn as RecordRetentionSchema, Wr as recordSecretRef, Wt as ProfileSlotStatusSchema, X as readNodePin, Xi as collectHydratedFieldEntries, Xn as collectZodSecretPaths, Xr as RECORD_DEFAULT_MAX_DATA_BYTES, Xt as makeSourceBrokerId, Y as readCommandOrigin, Yi as WELL_KNOWN_TAB_MAP, Yn as SECRET_META, Yr as RECORD_DATABASES, Yt as makeProfileBrokerId, Z as toNodeId, Zi as collectHydratedFieldValues, Zn as isZodSecret, Zr as RECORD_DELETE_BATCH, Zt as parseProfileBrokerId, _ as readErrorI18n, _a as AddonMigrationsBlockedError, _i as BatchTooLargeError, _n as assertTransactScope, _r as parseSecretStatePath, _t as ReadinessTimeoutError, a as asJsonArray, aa as isSecretFieldView, ai as RECORD_SWEEP_INTERVAL_MS, an as historyUnitFor, ar as expandCapMethods, at as adminUiCapability, b as isDeviceScopedCap, ba as audioChunkBytesPerSample, bi as ForeignSecretMarkerError, bn as createSecretsAccess, br as KeychainWriteRefusedError, bt as scopeKey, c as asString, ca as makeSecretMarker, ci as buildSecretRef, cn as DeviceTransitionSchema, cr as method, ct as actionEffect, d as parseJsonUnknown, da as collectKeychainStoredKeys, di as isSecretRef, dn as TransitionCommandSchema, dr as systemMethod, dt as vocabActionIdFor, ea as hydrateSchema, ei as RECORD_MAX_INDEXES, en as DISPLAY_PREFERENCES, er as DEVICE_STATUS_METHOD, et as PipelineStepInputSchema, f as hfModelUrl, fa as collectSecretConfigKeys, fi as normalizeSecretOwner, fn as TransitionOutcomeSchema, fr as BaseAddon, ft as CAP_VOCABULARY, g as ErrorI18nPayloadSchema, ga as schemaDeclaresAnyField, gi as optionalLinkField, gn as createRecordsAccess, gr as mergeSecretStatePaths, gt as ReadinessRegistry, h as ErrorCodeSchema, ha as omitTransientConfig, hi as linksOfKind, hn as makeInMemoryRecords, hr as normalizeAddonInitResult, ht as MODEL_FORMATS, i as asBoolean, ia as isSecretClear, ii as RECORD_SETTINGS_MAX_ROWS, in as displayUnitFor, ir as event, it as DEVICE_CHILDREN_BATCH_MAX, j as DEFAULT_TOKEN_EXPIRY, ji as TransactRefusedError, jn as PEER_BYTES_TICKET_TTL_MS, jr as moveRegistrySwitchToBody, jt as AudioChunkFormatSchema, k as commandEffect, ki as RecordsError, kn as PEER_BYTES_MAX_OUTSTANDING, kr as normalizeNodeId, kt as getDebugInterest, l as parseJsonArray, la as toSecretFieldView, li as formatSecretScope, ln as TransitionActorKindSchema, lr as optionalMethod, lt as allVocabActions, m as CamstackError, ma as isSecretConfigField, mi as linkField, mn as CommandOriginClaimSchema, mr as migrationSet, mt as t, n as sleepCancellable, na as SECRET_CLEAR, ni as RECORD_QUERY_MAX, nn as ReadingQuantitySchema, nr as HISTORY_UNIT_LABELS, nt as RawStateResultSchema, o as asJsonObject, oa as isSecretMarker, oi as SECRET_REF_SCHEME, on as isReadingQuantity, or as historyItemFieldPath, ot as AddonPageDeclarationSchema, p as BOOT_RECOVERY_BACKOFF_MS, pa as isKeychainStoredField, pi as parseSecretRef, pn as TransitionValueSchema, pr as classifyStoreError, pt as CAP_VOCABULARY_BY_NAME, q as commandOrigin, qi as isEvent, qn as declarationsOf, qr as RECORD_BATCH_MAX_BYTES, qt as SubscribeAudioChunksInputSchema, r as maskUrlCredentials, ra as classifySecretWrite, ri as RECORD_SECRET_COLLECTION_PREFIX, rn as baseUnitOf, rr as PROVIDER_PIN_FIELD, rt as deviceOpsCapability, s as asNumber, sa as isSecretMarkerLike, si as arrayItemFieldPath, sn as readingMeta, sr as isDeviceConfigCap, st as addonPagesSourceCapability, t as sleep, ta as resolveHydratedFieldValue, ti as RECORD_MAX_INDEX_FIELDS, tn as QUANTITY_BASE, tr as HISTORY_DEFAULT_MIN_INTERVAL_MS, tt as MIGRATION_API_VERSION, u as parseJsonObject, ua as REDACTED_SECRET, ui as globalSecretScope, un as TransitionActorSchema, ur as resolveCapMount, ut as findVocabAction, v as userError, va as findMigrationsBlocked, vi as DeclarationRefusedError, vn as resolveSecretViewsIn, vr as secretTreeFromPaths, vt as emitDownForOwnedCaps, w as createEventBusSliceSource, wi as RECORDS_ERROR_CODES, wn as knownSecretCount, wr as transformSecretWrite, wt as DEBUG_WATCH_WINDOW_MS, x as createDeviceProxy, xa as expandAudioChunkToF32le, xi as InvalidRecordError, xn as MIN_SCRUBBED_LENGTH, xr as collectSecretMarkerRefs, xt as DEBUG_CHANNEL_PREFIX, y as DEVICE_SCOPED_CAPS, ya as AUDIO_CHUNK_FORMATS, yi as FilterRequiredError, yn as REVALIDATE_AFTER_MS, yr as secretTreeFromSchema, yt as readinessKey, z as CALLER_STAMPED_CAPABILITIES, zi as rowsDepsOver, zn as EntryDescriptorSchema, zr as collectSecretLeaves, zt as CameraStreamSchema } from "./sleep-
|
|
1
|
+
import { $ as PipelineRunResultBridge, $i as dehydrateSchema, $n as DEVICE_SETTINGS_CONTRIBUTION_METHODS, $r as RECORD_MAX_DATA_BYTES, $t as DEFAULT_DISPLAY_PREFERENCE, A as isCommand, Ai as RevConflictError, An as PEER_BYTES_STALL_MS, Ar as createDurableState, At as isDebugChannelName, B as withoutCallerStamp, Bi as secretsOverMigrationApi, Bn as RecordFieldPathSchema, Br as mapSecretLeaves, Bt as DecodedAudioChunkSchema, Ci as PlaintextSecretError, Cn as forgetKnownSecret, Cr as resolveSecretMarkers, Ct as DEBUG_WATCH_REARM_EVERY_MS, D as createSliceHandle, Di as RecordTooLargeError, Dn as shortSecretRefHash, Dr as resolveDeviceSettings, Dt as __resetDebugInterestForTests, E as createMirrorSource, Ei as RecordSecretUnavailableError, En as scrubKnownSecrets, Er as nodeIdOfScopedKey, Et as DebugWatchTable, Fi as recordsErrorFromMessage, Fn as SHARE_VIEW_KINDS, Fr as RecordIntegrationInstances, Ft as CAM_PROFILE_ORDER, G as CAP_COMMAND_ORIGIN_CONTEXT_KEY, Gi as createEvent, Gn as StoredRecordKindDeclarationSchema, Gr as secretArrayPrefixes, Gt as StreamSourceEntrySchema, H as defineCustomActions, Hi as AddonMigrationDefinitionError, Hn as RecordKindDeclarationSchema, Hr as recordArrayItemPath, Ht as ProfileRtspEntrySchema, Ii as defaultIntegrationDepsOver, In as DisposerChain, Ir as isInstanceEnabled, It as CamProfileSchema, J as nodePin, Ji as WELL_KNOWN_TABS, Jn as defineRecordKinds, Jr as RECORD_CLASSES, Jt as SubscribeAudioChunksResultSchema, K as CAP_NODE_PIN_CONTEXT_KEY, Ki as emitReadiness, Kn as assertValidDeclaration, Kr as RECORD_BATCH_MAX, Kt as StreamSourceSchema, L as CAP_NAMES, Li as integrationRowsApiOver, Ln as defineEntryKind, Lr as secretViewsOf, Lt as CamStreamKindSchema, M as HF_BASE_URL, Mi as UnindexedFilterError, Mn as PeerBytesTicketSchema, Mr as registrySwitchPortsOver, Mt as AudioStreamPickSchema, N as HF_REPO, Ni as UnknownRecordKindError, Nn as CALLER_USERNAME_HEADER, Nr as registrySwitchToBodyId, Nt as BrokerStatsSchema, O as auditedFields, Oi as RecordUniqueViolationError, On as PEER_BYTES_CHUNK_BYTES, Or as resolvedValues, Ot as createDebugEmitter, P as RUNTIME_DEFAULTS, Pi as asRecordsError, Pn as DATAPLANE_SECRET_HEADER, Pr as registrySwitchToBodyMigration, Pt as BrokerStatusSchema, Q as viewerUiCapability, Qi as dehydrateConfigField, Qn as DEFAULT_RUNTIME_STATE_DURABILITY, Qr as RECORD_ID_MAX_LENGTH, Qt as selectAssignedProfileSlots, Ri as recordsOverMigrationApi, Rn as entryBody, Rr as REMOVE_LEAF, Rt as CamStreamResolutionSchema, S as invokeTrpcLeaf, Sa as isAudioChunkFormat, Si as NoCallerError, Sn as clearKnownSecrets, Sr as isSecretRefOwnedBy, St as DEBUG_WATCH_HARD_CAP_MS, T as createLazyTrpcSource, Ti as RecordNotFoundError, Tn as registerKnownSecret, Tr as SCOPED_SETTINGS_SCOPES, Tt as DebugInterest, U as describeCustomActions, Ui as defineAddonMigrations, Un as RecordKindNameSchema, Ur as recordSecretCollection, Ut as ProfileSlotSchema, V as customAction, Vi as switchRecordsOverMigrationApi, Vn as RecordIndexSchema, Vr as parseSecretPath, Vt as FrameHandleSchema, W as deviceCustomAction, Wi as runAddonMigrations, Wn as RecordRetentionSchema, Wr as recordSecretRef, Wt as ProfileSlotStatusSchema, X as readNodePin, Xi as collectHydratedFieldEntries, Xn as collectZodSecretPaths, Xr as RECORD_DEFAULT_MAX_DATA_BYTES, Xt as makeSourceBrokerId, Y as readCommandOrigin, Yi as WELL_KNOWN_TAB_MAP, Yn as SECRET_META, Yr as RECORD_DATABASES, Yt as makeProfileBrokerId, Z as toNodeId, Zi as collectHydratedFieldValues, Zn as isZodSecret, Zr as RECORD_DELETE_BATCH, Zt as parseProfileBrokerId, _ as readErrorI18n, _a as AddonMigrationsBlockedError, _i as BatchTooLargeError, _n as assertTransactScope, _r as parseSecretStatePath, _t as ReadinessTimeoutError, a as asJsonArray, aa as isSecretFieldView, ai as RECORD_SWEEP_INTERVAL_MS, an as historyUnitFor, ar as expandCapMethods, at as adminUiCapability, b as isDeviceScopedCap, ba as audioChunkBytesPerSample, bi as ForeignSecretMarkerError, bn as createSecretsAccess, br as KeychainWriteRefusedError, bt as scopeKey, c as asString, ca as makeSecretMarker, ci as buildSecretRef, cn as DeviceTransitionSchema, cr as method, ct as actionEffect, d as parseJsonUnknown, da as collectKeychainStoredKeys, di as isSecretRef, dn as TransitionCommandSchema, dr as systemMethod, dt as vocabActionIdFor, ea as hydrateSchema, ei as RECORD_MAX_INDEXES, en as DISPLAY_PREFERENCES, er as DEVICE_STATUS_METHOD, et as PipelineStepInputSchema, f as hfModelUrl, fa as collectSecretConfigKeys, fi as normalizeSecretOwner, fn as TransitionOutcomeSchema, fr as BaseAddon, ft as CAP_VOCABULARY, g as ErrorI18nPayloadSchema, ga as schemaDeclaresAnyField, gi as optionalLinkField, gn as createRecordsAccess, gr as mergeSecretStatePaths, gt as ReadinessRegistry, h as ErrorCodeSchema, ha as omitTransientConfig, hi as linksOfKind, hn as makeInMemoryRecords, hr as normalizeAddonInitResult, ht as MODEL_FORMATS, i as asBoolean, ia as isSecretClear, ii as RECORD_SETTINGS_MAX_ROWS, in as displayUnitFor, ir as event, it as DEVICE_CHILDREN_BATCH_MAX, j as DEFAULT_TOKEN_EXPIRY, ji as TransactRefusedError, jn as PEER_BYTES_TICKET_TTL_MS, jr as moveRegistrySwitchToBody, jt as AudioChunkFormatSchema, k as commandEffect, ki as RecordsError, kn as PEER_BYTES_MAX_OUTSTANDING, kr as normalizeNodeId, kt as getDebugInterest, l as parseJsonArray, la as toSecretFieldView, li as formatSecretScope, ln as TransitionActorKindSchema, lr as optionalMethod, lt as allVocabActions, m as CamstackError, ma as isSecretConfigField, mi as linkField, mn as CommandOriginClaimSchema, mr as migrationSet, mt as t, n as sleepCancellable, na as SECRET_CLEAR, ni as RECORD_QUERY_MAX, nn as ReadingQuantitySchema, nr as HISTORY_UNIT_LABELS, nt as RawStateResultSchema, o as asJsonObject, oa as isSecretMarker, oi as SECRET_REF_SCHEME, on as isReadingQuantity, or as historyItemFieldPath, ot as AddonPageDeclarationSchema, p as BOOT_RECOVERY_BACKOFF_MS, pa as isKeychainStoredField, pi as parseSecretRef, pn as TransitionValueSchema, pr as classifyStoreError, pt as CAP_VOCABULARY_BY_NAME, q as commandOrigin, qi as isEvent, qn as declarationsOf, qr as RECORD_BATCH_MAX_BYTES, qt as SubscribeAudioChunksInputSchema, r as maskUrlCredentials, ra as classifySecretWrite, ri as RECORD_SECRET_COLLECTION_PREFIX, rn as baseUnitOf, rr as PROVIDER_PIN_FIELD, rt as deviceOpsCapability, s as asNumber, sa as isSecretMarkerLike, si as arrayItemFieldPath, sn as readingMeta, sr as isDeviceConfigCap, st as addonPagesSourceCapability, t as sleep, ta as resolveHydratedFieldValue, ti as RECORD_MAX_INDEX_FIELDS, tn as QUANTITY_BASE, tr as HISTORY_DEFAULT_MIN_INTERVAL_MS, tt as MIGRATION_API_VERSION, u as parseJsonObject, ua as REDACTED_SECRET, ui as globalSecretScope, un as TransitionActorSchema, ur as resolveCapMount, ut as findVocabAction, v as userError, va as findMigrationsBlocked, vi as DeclarationRefusedError, vn as resolveSecretViewsIn, vr as secretTreeFromPaths, vt as emitDownForOwnedCaps, w as createEventBusSliceSource, wi as RECORDS_ERROR_CODES, wn as knownSecretCount, wr as transformSecretWrite, wt as DEBUG_WATCH_WINDOW_MS, x as createDeviceProxy, xa as expandAudioChunkToF32le, xi as InvalidRecordError, xn as MIN_SCRUBBED_LENGTH, xr as collectSecretMarkerRefs, xt as DEBUG_CHANNEL_PREFIX, y as DEVICE_SCOPED_CAPS, ya as AUDIO_CHUNK_FORMATS, yi as FilterRequiredError, yn as REVALIDATE_AFTER_MS, yr as secretTreeFromSchema, yt as readinessKey, z as CALLER_STAMPED_CAPABILITIES, zi as rowsDepsOver, zn as EntryDescriptorSchema, zr as collectSecretLeaves, zt as CameraStreamSchema } from "./sleep-CfYvHNFz.mjs";
|
|
2
2
|
import { i as publicEventCategories, n as OWNER_ONLY_EVENT_CATEGORIES, r as isOwnerOnlyEventCategory, t as EventCategory } from "./event-category-78tcBemo.mjs";
|
|
3
3
|
import { a as featuresOfBoundCaps, i as DeviceType, n as DeviceFeature, o as errMsg, r as DeviceRole, t as ChargingStatus } from "./device-type-CbDhVwFP.mjs";
|
|
4
4
|
import { $ as ExpressionHelperSpecSchema, $t as evaluateAst, A as MAX_COMPOSITION_FIELDS_PER_FEATURE, An as sliceChangedAt, At as maxDurationMs, B as featureSources, Bn as RESTREAM_INPUT_PROBE, Bt as evaluateDerivative, C as CompositionPassthroughFeatureSchema, Cn as SOURCE_CAP_ACTIVE_FIELD, Ct as MIN_CUSTOM_MINUTES, D as FORWARD_INPUT_KEY, Dn as evaluateSensorLevelEdge, Dt as StatisticWindowSchema, E as CompositionTargetSchema, En as evaluateSensorEdge, Et as RollingWindowSchema, F as compositionItemFieldPath, Ft as planStatisticTier, G as ARITHMETIC_OPS, Gn as buildVideoArgs, Gt as EXPRESSION_INJECTED_NOW, H as isForwardInputRef, Hn as buildAudioArgs, Ht as integrateReading, I as compositionReadKey, It as rollingDurationMs, J as ArithmeticHelperSpecSchema, Jn as logBannerArgs, Jt as evaluateExpressionSource, K as ActiveCriterionSchema, Kn as invocationFromEncodeProfile, Kt as cloneStatefulExpressionMemory, L as compositionSliceKey, Ln as canonicalHash, Lt as statisticCadenceMs, M as composedDeviceRef, Mt as openReset, N as composedDeviceStableId, Nt as openStatistic, O as MAX_COMPOSITION_CODE_LENGTH, On as isSourceCap, Ot as historyRetentionFromSettings, P as compositionFeatureEnabled, Pt as planResetTier, Q as EXPRESSION_OUTPUTS, Qt as createExpressionScope, R as compositionSourceKey, Rn as Fmp4BoxSplitter, Rt as SERIES_KINDS, S as CompositionNewTargetSchema, Sn as SOURCE_CAPS, St as MINUTE_MS, T as CompositionSeriesSourceSchema, Tn as SOURCE_DEVICE_TYPES, Tt as ROLLING_SPANS, U as ACTIVE_CRITERIA, Un as buildFfmpegArgs, Ut as KWH_PER_WATT_MS, V as fieldReads, Vn as audioPlanFromEncodeProfile, Vt as evaluateStatistic, W as AGGREGATE_REDUCERS, Wn as buildInputArgs, Wt as wattMillisecondsToKwh, X as DERIVATIVE_UNITS, Xn as resolveStreamMaps, Xt as toExpressionValue, Y as BINARY_AGGREGATES, Yn as pickVideoEncoder, Yt as evaluateStatefulExpressionCall, Z as DerivativeHelperSpecSchema, Zt as validateExpressionSource, _ as CompositionForwardArgSchema, _n as evaluateRose, _t as DEFAULT_HISTORY_RETENTION, a as CUSTOMIZATION_BLOCK_NAME_PREFIX, an as EXPRESSION_IDENTIFIER_RE, at as INTEGRAL_OUTPUTS, b as CompositionItemEntrySchema, bn as ExpressionParseError, bt as HISTORY_TIERS, c as CompositionCodeSourceSchema, cn as MAX_EXPRESSION_CALL_ARGS, ct as NUMERIC_AGGREGATES, d as CompositionExpressionSourceSchema, dn as RESERVED_BINDING_NAMES, dt as helperMembers, en as compileExpression, et as GROUP_TEMPLATE_IDS, f as CompositionExtensionCommandSchema, fn as EXPRESSION_BUILTINS, ft as isHistoryHelper, g as CompositionFieldsFeatureSchema, gn as evaluateDwell, gt as DAY_MS, h as CompositionFieldSourceSchema, hn as evaluateCount, ht as CalendarWindowSchema, i as COMPOSITION_ITEM_KEY_RE, in as EXPRESSION_COMPILE_CACHE_CAPACITY, it as HelperSpecSchema, j as MAX_COMPOSITION_ITEMS, jn as FFMPEG_PATH_ENV, jt as nextLocalMidnight, k as MAX_COMPOSITION_FEATURES, kn as sliceActiveValue, kt as integralCadenceMs, l as CompositionCommandTargetSchema, ln as MAX_EXPRESSION_EVAL_STEPS, lt as StatisticHelperSpecSchema, m as CompositionFieldReadSchema, mn as disarmRoseMemory, mt as CALENDAR_PERIODS, n as COMPOSER_ADDON_ID, nn as parseExpression, nt as GroupTemplateIdSchema, o as CompositionAggregateSourceSchema, on as MAX_EXPRESSION_AST_NODES, ot as IntegralHelperSpecSchema, p as CompositionFeatureSchema, pn as EXPRESSION_BUILTIN_NAMES, pt as CompositionSourceRefSchema, q as AggregateReducerSchema, qn as isSoftwareDecode, qt as createStatefulExpressionMemory, r as COMPOSITION_ITEM_ARRAY_PATH, rn as tokenize, rt as HelperMemberSchema, s as CompositionBindingSchema, sn as MAX_EXPRESSION_BINDINGS, st as MAX_HELPER_MEMBERS, t as COMPOSED_DEVICE_STABLE_ID_PREFIX, tn as compileExpressionSafe, tt as GroupHelperSpecSchema, u as CompositionExistingTargetSchema, un as MAX_EXPRESSION_SOURCE_LENGTH, ut as ThresholdHelperSpecSchema, v as CompositionForwardCommandSchema, vn as isStatefulBuiltin, vt as HISTORY_FAST_MS, w as CompositionSchema, wn as SOURCE_CAP_CHANGED_AT_FIELD, wt as RESET_PERIODS, x as CompositionLiteralBindingSchema, xn as DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, xt as HOUR_MS, y as CompositionFromSourceSchema, yn as ExpressionEvalError, yt as HISTORY_SLOW_MS, z as featureFieldEntries, zn as AUDIO_PRESETS, zt as STATISTIC_STATS } from "./composition-CXCX78IR.mjs";
|
|
@@ -41647,6 +41647,12 @@ var ClimateControlStatusSchema = z.object({
|
|
|
41647
41647
|
maxTemp: z.number().nullable().optional().meta(readingMeta("temperature")),
|
|
41648
41648
|
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
41649
41649
|
tempStep: z.number().positive().nullable().optional().meta(readingMeta("temperature")),
|
|
41650
|
+
/**
|
|
41651
|
+
* The last non-off mode the device reported. Kept by the device-state mirror on every
|
|
41652
|
+
* write (providers never set it), so "turn on" can return to it. Absent until the device
|
|
41653
|
+
* has reported a running mode.
|
|
41654
|
+
*/
|
|
41655
|
+
lastActiveMode: HvacModeSchema.exclude(["off"]).optional(),
|
|
41650
41656
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
41651
41657
|
lastFetchedAt: z.number()
|
|
41652
41658
|
});
|
|
@@ -41731,7 +41737,8 @@ var climateControlCapability = {
|
|
|
41731
41737
|
* See `RuntimeStateDurability`. Enforced by
|
|
41732
41738
|
* `scripts/check-runtime-state-durability.ts`.
|
|
41733
41739
|
*/
|
|
41734
|
-
durability: "
|
|
41740
|
+
durability: "restored",
|
|
41741
|
+
restoredStateFields: ["lastActiveMode"],
|
|
41735
41742
|
/**
|
|
41736
41743
|
* History (D850): recorded series. Celsius by contract; setpoints keep every change (`minIntervalMs: 0`).
|
|
41737
41744
|
*/
|
|
@@ -43086,7 +43093,7 @@ function irSourceProblem(source) {
|
|
|
43086
43093
|
throw err;
|
|
43087
43094
|
}
|
|
43088
43095
|
}
|
|
43089
|
-
function same(a, b) {
|
|
43096
|
+
function same$1(a, b) {
|
|
43090
43097
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
43091
43098
|
}
|
|
43092
43099
|
/** The `digits` source that declares this channel number, or null. */
|
|
@@ -43100,7 +43107,7 @@ function findChannelSource(sources, number) {
|
|
|
43100
43107
|
* the number reach the same source; nothing else is guessed.
|
|
43101
43108
|
*/
|
|
43102
43109
|
function resolveRemoteSource(sources, query) {
|
|
43103
|
-
const byName = sources.find((source) => same(source.name, query));
|
|
43110
|
+
const byName = sources.find((source) => same$1(source.name, query));
|
|
43104
43111
|
if (byName !== void 0) return byName;
|
|
43105
43112
|
const byId = sources.find((source) => source.id === query.trim());
|
|
43106
43113
|
if (byId !== void 0) return byId;
|
|
@@ -53601,7 +53608,7 @@ var enumSensorCapability = {
|
|
|
53601
53608
|
} } },
|
|
53602
53609
|
/** Clock fields: written, but excluded from the compare that decides
|
|
53603
53610
|
* whether persisting is worth a SQLite commit. */
|
|
53604
|
-
volatileStateFields: ["lastFetchedAt"]
|
|
53611
|
+
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
53605
53612
|
};
|
|
53606
53613
|
//#endregion
|
|
53607
53614
|
//#region src/capabilities/event-emitter.cap.ts
|
|
@@ -55272,22 +55279,51 @@ var HERO_ROW_IDS = [
|
|
|
55272
55279
|
"volume",
|
|
55273
55280
|
"source",
|
|
55274
55281
|
"contact",
|
|
55275
|
-
"motion-trigger"
|
|
55282
|
+
"motion-trigger",
|
|
55283
|
+
"lock",
|
|
55284
|
+
"alarm",
|
|
55285
|
+
"fan",
|
|
55286
|
+
"vacuum",
|
|
55287
|
+
"mower",
|
|
55288
|
+
"feeder",
|
|
55289
|
+
"fountain",
|
|
55290
|
+
"pump-cycle",
|
|
55291
|
+
"automation",
|
|
55292
|
+
"script",
|
|
55293
|
+
"do-not-disturb",
|
|
55294
|
+
"brightness",
|
|
55295
|
+
"color",
|
|
55296
|
+
"cover",
|
|
55297
|
+
"valve",
|
|
55298
|
+
"humidifier",
|
|
55299
|
+
"update",
|
|
55300
|
+
"button",
|
|
55301
|
+
"climate-mode",
|
|
55302
|
+
"climate-fan",
|
|
55303
|
+
"setpoint",
|
|
55304
|
+
"channel",
|
|
55305
|
+
"control"
|
|
55276
55306
|
];
|
|
55277
55307
|
var HeroRowIdSchema = z.enum(HERO_ROW_IDS);
|
|
55278
|
-
|
|
55279
|
-
var HeroArgsSchema = z.record(z.string(), z.union([
|
|
55308
|
+
var HeroArgValueSchema = z.lazy(() => z.union([
|
|
55280
55309
|
z.string(),
|
|
55281
55310
|
z.number(),
|
|
55282
|
-
z.boolean()
|
|
55311
|
+
z.boolean(),
|
|
55312
|
+
z.record(z.string(), HeroArgValueSchema)
|
|
55283
55313
|
]));
|
|
55314
|
+
var HeroArgsSchema = z.record(z.string(), HeroArgValueSchema);
|
|
55284
55315
|
/** A cap method called on the hero's device. */
|
|
55285
55316
|
var HeroCallSchema = z.object({
|
|
55286
55317
|
cap: z.string(),
|
|
55287
55318
|
method: z.string(),
|
|
55288
55319
|
args: HeroArgsSchema
|
|
55289
55320
|
});
|
|
55290
|
-
var HeroConfirmSchema = z.enum([
|
|
55321
|
+
var HeroConfirmSchema = z.enum([
|
|
55322
|
+
"off-while-running",
|
|
55323
|
+
"unlock",
|
|
55324
|
+
"install",
|
|
55325
|
+
"press"
|
|
55326
|
+
]);
|
|
55291
55327
|
var HeroActionSchema = z.object({
|
|
55292
55328
|
/** Unique within the model; the `gated` list and the specs name it. */
|
|
55293
55329
|
id: z.string(),
|
|
@@ -55383,7 +55419,11 @@ var HeroConsumptionSlotSchema = z.discriminatedUnion("kind", [z.object({
|
|
|
55383
55419
|
})]);
|
|
55384
55420
|
var HeroOwnPowerSlotSchema = z.object({
|
|
55385
55421
|
/** Which cap the power is switched through; the renderer never needs it. */
|
|
55386
|
-
source: z.enum([
|
|
55422
|
+
source: z.enum([
|
|
55423
|
+
"switch",
|
|
55424
|
+
"media-player",
|
|
55425
|
+
"climate-control"
|
|
55426
|
+
]),
|
|
55387
55427
|
/** `null` = unknown, never off. */
|
|
55388
55428
|
on: z.boolean().nullable(),
|
|
55389
55429
|
assumed: z.boolean(),
|
|
@@ -55420,7 +55460,23 @@ var HeroFactSchema = z.object({
|
|
|
55420
55460
|
"remaining",
|
|
55421
55461
|
"volume",
|
|
55422
55462
|
"source",
|
|
55423
|
-
"consumables"
|
|
55463
|
+
"consumables",
|
|
55464
|
+
"since",
|
|
55465
|
+
"speed",
|
|
55466
|
+
"progress",
|
|
55467
|
+
"level",
|
|
55468
|
+
"last-run",
|
|
55469
|
+
"event",
|
|
55470
|
+
"members",
|
|
55471
|
+
"failures",
|
|
55472
|
+
"reading",
|
|
55473
|
+
"climate",
|
|
55474
|
+
"temperature",
|
|
55475
|
+
"humidity",
|
|
55476
|
+
"pressure",
|
|
55477
|
+
"air-quality",
|
|
55478
|
+
"illuminance",
|
|
55479
|
+
"valve"
|
|
55424
55480
|
]),
|
|
55425
55481
|
icon: IconKeySchema.nullable(),
|
|
55426
55482
|
text: HeroTextSchema,
|
|
@@ -88079,6 +88135,11 @@ var WaterHeaterStatusSchema = z.object({
|
|
|
88079
88135
|
minTemp: z.number().nullable().meta(readingMeta("temperature")),
|
|
88080
88136
|
/** HA `max_temp` attribute. Null when not reported. */
|
|
88081
88137
|
maxTemp: z.number().nullable().meta(readingMeta("temperature")),
|
|
88138
|
+
/**
|
|
88139
|
+
* The last operation mode other than `off` the device reported. Kept by the device-state
|
|
88140
|
+
* mirror on every write (providers never set it), so "turn on" can return to it.
|
|
88141
|
+
*/
|
|
88142
|
+
lastActiveMode: z.string().optional(),
|
|
88082
88143
|
/** Ms epoch when the slice was last updated. */
|
|
88083
88144
|
lastChangedAt: z.number()
|
|
88084
88145
|
});
|
|
@@ -88126,7 +88187,8 @@ var waterHeaterCapability = {
|
|
|
88126
88187
|
* See `RuntimeStateDurability`. Enforced by
|
|
88127
88188
|
* `scripts/check-runtime-state-durability.ts`.
|
|
88128
88189
|
*/
|
|
88129
|
-
durability: "
|
|
88190
|
+
durability: "restored",
|
|
88191
|
+
restoredStateFields: ["lastActiveMode"],
|
|
88130
88192
|
/**
|
|
88131
88193
|
* History (D850): recorded series. The schema carries no unit; providers publish Celsius. Setpoint keeps every change.
|
|
88132
88194
|
*/
|
|
@@ -94486,7 +94548,7 @@ var ACTUATOR_TEMPLATE_IDS = [
|
|
|
94486
94548
|
"media-player",
|
|
94487
94549
|
"climate"
|
|
94488
94550
|
];
|
|
94489
|
-
function row$
|
|
94551
|
+
function row$2(cap, method, requires = null, confirm = false) {
|
|
94490
94552
|
return {
|
|
94491
94553
|
cap,
|
|
94492
94554
|
method,
|
|
@@ -94496,41 +94558,41 @@ function row$1(cap, method, requires = null, confirm = false) {
|
|
|
94496
94558
|
}
|
|
94497
94559
|
/** The first row's cap is the type's own: always offered, members without it are skipped. */
|
|
94498
94560
|
var ACTUATOR_METHODS = {
|
|
94499
|
-
switch: [row$
|
|
94561
|
+
switch: [row$2("switch", "setState")],
|
|
94500
94562
|
light: [
|
|
94501
|
-
row$
|
|
94502
|
-
row$
|
|
94503
|
-
row$
|
|
94563
|
+
row$2("switch", "setState"),
|
|
94564
|
+
row$2("brightness", "setBrightness"),
|
|
94565
|
+
row$2("color", "setColor")
|
|
94504
94566
|
],
|
|
94505
94567
|
fan: [
|
|
94506
|
-
row$
|
|
94507
|
-
row$
|
|
94508
|
-
row$
|
|
94509
|
-
row$
|
|
94510
|
-
row$
|
|
94568
|
+
row$2("switch", "setState"),
|
|
94569
|
+
row$2("fan-control", "setPercentage", DeviceFeature.FanSpeed),
|
|
94570
|
+
row$2("fan-control", "setPreset", DeviceFeature.FanPreset),
|
|
94571
|
+
row$2("fan-control", "setDirection", DeviceFeature.FanDirection),
|
|
94572
|
+
row$2("fan-control", "setOscillating", DeviceFeature.FanOscillating)
|
|
94511
94573
|
],
|
|
94512
94574
|
cover: [
|
|
94513
|
-
row$
|
|
94514
|
-
row$
|
|
94515
|
-
row$
|
|
94516
|
-
row$
|
|
94517
|
-
row$
|
|
94575
|
+
row$2("cover", "open"),
|
|
94576
|
+
row$2("cover", "close"),
|
|
94577
|
+
row$2("cover", "stop", DeviceFeature.CoverStoppable),
|
|
94578
|
+
row$2("cover", "setPosition", DeviceFeature.CoverPositionable),
|
|
94579
|
+
row$2("cover", "setTiltPosition", DeviceFeature.CoverTilt)
|
|
94518
94580
|
],
|
|
94519
94581
|
valve: [
|
|
94520
|
-
row$
|
|
94521
|
-
row$
|
|
94522
|
-
row$
|
|
94582
|
+
row$2("valve", "open"),
|
|
94583
|
+
row$2("valve", "close"),
|
|
94584
|
+
row$2("valve", "setPosition", DeviceFeature.ValvePositionable)
|
|
94523
94585
|
],
|
|
94524
|
-
lock: [row$
|
|
94586
|
+
lock: [row$2("lock-control", "lock"), row$2("lock-control", "unlock", null, true)],
|
|
94525
94587
|
"media-player": [
|
|
94526
|
-
row$
|
|
94527
|
-
row$
|
|
94528
|
-
row$
|
|
94588
|
+
row$2("media-player", "play"),
|
|
94589
|
+
row$2("media-player", "pause"),
|
|
94590
|
+
row$2("media-player", "setVolume", DeviceFeature.MediaPlayerVolume)
|
|
94529
94591
|
],
|
|
94530
94592
|
climate: [
|
|
94531
|
-
row$
|
|
94532
|
-
row$
|
|
94533
|
-
row$
|
|
94593
|
+
row$2("climate-control", "setMode"),
|
|
94594
|
+
row$2("climate-control", "setTarget"),
|
|
94595
|
+
row$2("climate-control", "setFanMode", DeviceFeature.ClimateFanMode)
|
|
94534
94596
|
]
|
|
94535
94597
|
};
|
|
94536
94598
|
function actuatorMethodRow(templateId, cap, method) {
|
|
@@ -100107,6 +100169,1684 @@ function resolveMutate(router, method) {
|
|
|
100107
100169
|
return typeof mutate === "function" ? mutate : null;
|
|
100108
100170
|
}
|
|
100109
100171
|
//#endregion
|
|
100172
|
+
//#region src/device/hero/hero-contribution-kit.ts
|
|
100173
|
+
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
100174
|
+
function contribution(cap, schema, build) {
|
|
100175
|
+
return {
|
|
100176
|
+
cap,
|
|
100177
|
+
contribute: (raw, ctx) => {
|
|
100178
|
+
const parsed = schema.safeParse(raw);
|
|
100179
|
+
return build(parsed.success ? parsed.data : void 0, ctx);
|
|
100180
|
+
}
|
|
100181
|
+
};
|
|
100182
|
+
}
|
|
100183
|
+
function action(id, label, icon, cap, method, args = {}, emphasis = "normal", confirm = null) {
|
|
100184
|
+
return {
|
|
100185
|
+
id,
|
|
100186
|
+
label,
|
|
100187
|
+
icon,
|
|
100188
|
+
call: {
|
|
100189
|
+
cap,
|
|
100190
|
+
method,
|
|
100191
|
+
args
|
|
100192
|
+
},
|
|
100193
|
+
emphasis,
|
|
100194
|
+
confirm
|
|
100195
|
+
};
|
|
100196
|
+
}
|
|
100197
|
+
var asAction = (a) => ({
|
|
100198
|
+
kind: "action",
|
|
100199
|
+
action: a
|
|
100200
|
+
});
|
|
100201
|
+
function reading(source, state, assumed = false, title) {
|
|
100202
|
+
return title === void 0 ? {
|
|
100203
|
+
source,
|
|
100204
|
+
state,
|
|
100205
|
+
assumed
|
|
100206
|
+
} : {
|
|
100207
|
+
source,
|
|
100208
|
+
state,
|
|
100209
|
+
assumed,
|
|
100210
|
+
title
|
|
100211
|
+
};
|
|
100212
|
+
}
|
|
100213
|
+
function fact(id, icon, text, tone = "muted") {
|
|
100214
|
+
return {
|
|
100215
|
+
id,
|
|
100216
|
+
icon,
|
|
100217
|
+
text,
|
|
100218
|
+
tone
|
|
100219
|
+
};
|
|
100220
|
+
}
|
|
100221
|
+
function row$1(id, icon, status, controls = []) {
|
|
100222
|
+
return {
|
|
100223
|
+
id,
|
|
100224
|
+
icon,
|
|
100225
|
+
status,
|
|
100226
|
+
controls: [...controls]
|
|
100227
|
+
};
|
|
100228
|
+
}
|
|
100229
|
+
/** "5 min" / "3 h" / "2 d" since `at`; `null` when the moment is unknown (0) or in the future. */
|
|
100230
|
+
function elapsedText(at, now) {
|
|
100231
|
+
if (at <= 0 || at > now) return null;
|
|
100232
|
+
const min = Math.floor((now - at) / 6e4);
|
|
100233
|
+
if (min < 1) return t("just now", "adesso");
|
|
100234
|
+
if (min < 60) return t(`${min} min ago`, `${min} min fa`);
|
|
100235
|
+
const h = Math.floor(min / 60);
|
|
100236
|
+
if (h < 48) return t(`${h} h ago`, `${h} h fa`);
|
|
100237
|
+
const d = Math.floor(h / 24);
|
|
100238
|
+
return t(`${d} d ago`, `${d} g fa`);
|
|
100239
|
+
}
|
|
100240
|
+
/** Joins words with " · ", skipping what is not there. */
|
|
100241
|
+
function joinText(parts) {
|
|
100242
|
+
const present = parts.filter((p) => p !== null);
|
|
100243
|
+
if (present.length === 0) return null;
|
|
100244
|
+
return t(present.map((p) => p.en).join(" · "), present.map((p) => p.it).join(" · "));
|
|
100245
|
+
}
|
|
100246
|
+
//#endregion
|
|
100247
|
+
//#region src/device/hero/hero-contributions-access.ts
|
|
100248
|
+
/**
|
|
100249
|
+
* What the access and automation caps add to a hero (D1023): a lock, an alarm
|
|
100250
|
+
* panel, an automation, a script and a media player's do-not-disturb. Every
|
|
100251
|
+
* contribution is typed against the cap's own status schema; a slice that does
|
|
100252
|
+
* not parse reads as "not answered" and the state is `unknown`, never `off`
|
|
100253
|
+
* (D315/D393). Nothing is guessed: with an unknown state the actions the cap
|
|
100254
|
+
* offers are offered separately.
|
|
100255
|
+
*/
|
|
100256
|
+
var LOCK_WORDS = {
|
|
100257
|
+
locked: {
|
|
100258
|
+
state: "on",
|
|
100259
|
+
title: t("Locked", "Chiusa"),
|
|
100260
|
+
door: "closed"
|
|
100261
|
+
},
|
|
100262
|
+
unlocked: {
|
|
100263
|
+
state: "standby",
|
|
100264
|
+
title: t("Unlocked", "Aperta"),
|
|
100265
|
+
door: "open"
|
|
100266
|
+
},
|
|
100267
|
+
locking: {
|
|
100268
|
+
state: "running",
|
|
100269
|
+
title: t("Locking", "In chiusura"),
|
|
100270
|
+
door: "closed"
|
|
100271
|
+
},
|
|
100272
|
+
unlocking: {
|
|
100273
|
+
state: "running",
|
|
100274
|
+
title: t("Unlocking", "In apertura"),
|
|
100275
|
+
door: "open"
|
|
100276
|
+
},
|
|
100277
|
+
jammed: {
|
|
100278
|
+
state: "alert",
|
|
100279
|
+
title: t("Jammed", "Bloccata"),
|
|
100280
|
+
door: null
|
|
100281
|
+
},
|
|
100282
|
+
"door-open": {
|
|
100283
|
+
state: "standby",
|
|
100284
|
+
title: t("Door open", "Porta aperta"),
|
|
100285
|
+
door: "open"
|
|
100286
|
+
}
|
|
100287
|
+
};
|
|
100288
|
+
var lockAction = (primary) => action("lock.lock", t("Lock", "Chiudi"), "lock", "lock-control", "lock", {}, primary ? "primary" : "normal");
|
|
100289
|
+
var unlockAction = (primary) => action("lock.unlock", t("Unlock", "Apri"), "lock-open", "lock-control", "unlock", {}, primary ? "primary" : "normal", "unlock");
|
|
100290
|
+
function lockControls(state, latch) {
|
|
100291
|
+
const open = asAction(action("lock.open", t("Open latch", "Apri il chiavistello"), "door-open", "lock-control", "open", {}, "normal", "unlock"));
|
|
100292
|
+
switch (state) {
|
|
100293
|
+
case "locked": return [asAction(unlockAction(true)), ...latch ? [open] : []];
|
|
100294
|
+
case "unlocked": return [asAction(lockAction(true)), ...latch ? [open] : []];
|
|
100295
|
+
case "jammed": return [asAction(unlockAction(false)), asAction(lockAction(false))];
|
|
100296
|
+
case null: return [asAction(lockAction(false)), asAction(unlockAction(false))];
|
|
100297
|
+
default: return [];
|
|
100298
|
+
}
|
|
100299
|
+
}
|
|
100300
|
+
var lockContribution = contribution("lock-control", LockControlStatusSchema, (slice, ctx) => {
|
|
100301
|
+
const state = slice?.state ?? null;
|
|
100302
|
+
const words = state === null ? null : LOCK_WORDS[state];
|
|
100303
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
100304
|
+
const title = words?.title ?? t("Unknown", "Sconosciuto");
|
|
100305
|
+
return {
|
|
100306
|
+
reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
|
|
100307
|
+
rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
|
|
100308
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
|
|
100309
|
+
...words?.door == null ? {} : { scene: { mode: words.door } }
|
|
100310
|
+
};
|
|
100311
|
+
});
|
|
100312
|
+
var ALARM_WORDS = {
|
|
100313
|
+
disarmed: {
|
|
100314
|
+
state: "off",
|
|
100315
|
+
title: t("Disarmed", "Disinserito")
|
|
100316
|
+
},
|
|
100317
|
+
armed_home: {
|
|
100318
|
+
state: "on",
|
|
100319
|
+
title: t("Armed home", "Inserito in casa")
|
|
100320
|
+
},
|
|
100321
|
+
armed_away: {
|
|
100322
|
+
state: "on",
|
|
100323
|
+
title: t("Armed away", "Inserito fuori casa")
|
|
100324
|
+
},
|
|
100325
|
+
armed_night: {
|
|
100326
|
+
state: "on",
|
|
100327
|
+
title: t("Armed night", "Inserito notte")
|
|
100328
|
+
},
|
|
100329
|
+
armed_vacation: {
|
|
100330
|
+
state: "on",
|
|
100331
|
+
title: t("Armed vacation", "Inserito vacanza")
|
|
100332
|
+
},
|
|
100333
|
+
armed_custom_bypass: {
|
|
100334
|
+
state: "on",
|
|
100335
|
+
title: t("Armed with bypass", "Inserito con esclusioni")
|
|
100336
|
+
},
|
|
100337
|
+
arming: {
|
|
100338
|
+
state: "standby",
|
|
100339
|
+
title: t("Arming", "Inserimento")
|
|
100340
|
+
},
|
|
100341
|
+
disarming: {
|
|
100342
|
+
state: "standby",
|
|
100343
|
+
title: t("Disarming", "Disinserimento")
|
|
100344
|
+
},
|
|
100345
|
+
pending: {
|
|
100346
|
+
state: "standby",
|
|
100347
|
+
title: t("Entry delay", "Ritardo di ingresso")
|
|
100348
|
+
},
|
|
100349
|
+
triggered: {
|
|
100350
|
+
state: "alert",
|
|
100351
|
+
title: t("Triggered", "Allarme in corso")
|
|
100352
|
+
}
|
|
100353
|
+
};
|
|
100354
|
+
var ARM_LABELS = {
|
|
100355
|
+
home: t("Arm home", "Inserisci in casa"),
|
|
100356
|
+
away: t("Arm away", "Inserisci fuori casa"),
|
|
100357
|
+
night: t("Arm night", "Inserisci notte"),
|
|
100358
|
+
vacation: t("Arm vacation", "Inserisci vacanza"),
|
|
100359
|
+
custom_bypass: t("Arm with bypass", "Inserisci con esclusioni")
|
|
100360
|
+
};
|
|
100361
|
+
var ALARM_MODES = [
|
|
100362
|
+
"home",
|
|
100363
|
+
"away",
|
|
100364
|
+
"night",
|
|
100365
|
+
"vacation",
|
|
100366
|
+
"custom_bypass"
|
|
100367
|
+
];
|
|
100368
|
+
function alarmControls(state, modes, requiresCode) {
|
|
100369
|
+
if (requiresCode) return [];
|
|
100370
|
+
const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
|
|
100371
|
+
const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
|
|
100372
|
+
switch (state) {
|
|
100373
|
+
case "disarmed": return arm(true);
|
|
100374
|
+
case "arming":
|
|
100375
|
+
case "disarming": return [];
|
|
100376
|
+
case null: return [];
|
|
100377
|
+
default: return [disarm];
|
|
100378
|
+
}
|
|
100379
|
+
}
|
|
100380
|
+
var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
100381
|
+
"lock-control": lockContribution,
|
|
100382
|
+
"alarm-panel": contribution("alarm-panel", AlarmPanelStatusSchema, (slice, ctx) => {
|
|
100383
|
+
const state = slice?.state ?? null;
|
|
100384
|
+
const words = state === null ? null : ALARM_WORDS[state];
|
|
100385
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
100386
|
+
const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
|
|
100387
|
+
return {
|
|
100388
|
+
reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
|
|
100389
|
+
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
|
|
100390
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
|
|
100391
|
+
};
|
|
100392
|
+
}),
|
|
100393
|
+
"automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
|
|
100394
|
+
const failed = slice?.lastError != null;
|
|
100395
|
+
const state = slice === void 0 ? "unknown" : failed ? "alert" : slice.isRunning ? "running" : slice.enabled ? "on" : "off";
|
|
100396
|
+
const title = slice === void 0 ? void 0 : failed ? t("Failed", "In errore") : slice.isRunning ? t("Running", "In esecuzione") : slice.enabled ? t("Enabled", "Attiva") : t("Disabled", "Disattivata");
|
|
100397
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastTriggeredAt, ctx.now);
|
|
100398
|
+
const run = action("automation.run", t("Run now", "Esegui ora"), "play", "automation-control", "trigger", {}, "primary");
|
|
100399
|
+
const toggle = {
|
|
100400
|
+
kind: "toggle",
|
|
100401
|
+
id: "automation.enabled",
|
|
100402
|
+
label: t("Enabled", "Attiva"),
|
|
100403
|
+
on: slice?.enabled ?? null,
|
|
100404
|
+
turnOn: action("automation.enable", t("Enable", "Attiva"), "play", "automation-control", "enable"),
|
|
100405
|
+
turnOff: action("automation.disable", t("Disable", "Disattiva"), "square", "automation-control", "disable")
|
|
100406
|
+
};
|
|
100407
|
+
return {
|
|
100408
|
+
reading: reading("automation-control", state, false, title),
|
|
100409
|
+
rows: [row$1("automation", "workflow", joinText([
|
|
100410
|
+
title ?? t("Unknown", "Sconosciuto"),
|
|
100411
|
+
last === null ? null : t(`Ran ${last.en}`, `Eseguita ${last.it}`),
|
|
100412
|
+
slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
|
|
100413
|
+
]), [asAction(run), toggle])],
|
|
100414
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
100415
|
+
};
|
|
100416
|
+
}),
|
|
100417
|
+
"script-runner": contribution("script-runner", ScriptRunnerStatusSchema, (slice, ctx) => {
|
|
100418
|
+
const failed = slice?.lastRunSuccess === false;
|
|
100419
|
+
const state = slice === void 0 ? "unknown" : slice.isRunning ? "running" : failed ? "alert" : "idle";
|
|
100420
|
+
const title = slice === void 0 ? void 0 : slice.isRunning ? t("Running", "In esecuzione") : failed ? t("Failed", "In errore") : t("Ready", "Pronto");
|
|
100421
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastRunAt, ctx.now);
|
|
100422
|
+
const control = slice?.isRunning === true ? action("script.stop", t("Stop", "Ferma"), "square", "script-runner", "stop", {}, "primary") : action("script.run", t("Run", "Esegui"), "play", "script-runner", "run", {}, "primary");
|
|
100423
|
+
return {
|
|
100424
|
+
reading: reading("script-runner", state, false, title),
|
|
100425
|
+
rows: [row$1("script", "scroll-text", joinText([
|
|
100426
|
+
title ?? t("Unknown", "Sconosciuto"),
|
|
100427
|
+
last === null ? null : t(`Ran ${last.en}`, `Eseguito ${last.it}`),
|
|
100428
|
+
slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
|
|
100429
|
+
]), [asAction(control)])],
|
|
100430
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
100431
|
+
};
|
|
100432
|
+
}),
|
|
100433
|
+
"do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
|
|
100434
|
+
const on = slice?.enabled ?? null;
|
|
100435
|
+
return { rows: [row$1("do-not-disturb", "bell-off", on === null ? t("Unknown", "Sconosciuto") : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
|
|
100436
|
+
kind: "toggle",
|
|
100437
|
+
id: "do-not-disturb.toggle",
|
|
100438
|
+
label: t("Do not disturb", "Non disturbare"),
|
|
100439
|
+
on,
|
|
100440
|
+
turnOn: action("do-not-disturb.on", t("Turn on", "Attiva"), "bell-off", "do-not-disturb", "setEnabled", { enabled: true }),
|
|
100441
|
+
turnOff: action("do-not-disturb.off", t("Turn off", "Disattiva"), "bell", "do-not-disturb", "setEnabled", { enabled: false })
|
|
100442
|
+
}])] };
|
|
100443
|
+
})
|
|
100444
|
+
};
|
|
100445
|
+
//#endregion
|
|
100446
|
+
//#region src/device/hero/hero-contributions-devices.ts
|
|
100447
|
+
/**
|
|
100448
|
+
* What the household-device caps add to a hero (D1023): a fan, a robot vacuum,
|
|
100449
|
+
* a robot mower, a pet feeder, a pet fountain and its pump cycle. Typed against
|
|
100450
|
+
* each cap's own status schema; a slice that does not parse is "not answered"
|
|
100451
|
+
* (`unknown`, never `off`, D315/D393). A measurement the device did not report
|
|
100452
|
+
* is absent from the facts, never a zero (D393).
|
|
100453
|
+
*/
|
|
100454
|
+
var has$3 = (ctx, f) => ctx.features.includes(f);
|
|
100455
|
+
var unknownText = t("Unknown", "Sconosciuto");
|
|
100456
|
+
var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
100457
|
+
var unit = (n) => Math.min(1, Math.max(0, n / 100));
|
|
100458
|
+
/** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
|
|
100459
|
+
function ownBattery(level, ctx) {
|
|
100460
|
+
if (level === null || ctx.caps.includes("battery")) return [];
|
|
100461
|
+
const tone = level <= 20 ? "danger" : level <= 40 ? "warning" : "success";
|
|
100462
|
+
return [fact("battery", "battery", t(`Battery ${Math.round(level)}%`, `Batteria ${Math.round(level)}%`), tone)];
|
|
100463
|
+
}
|
|
100464
|
+
var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice, ctx) => {
|
|
100465
|
+
const speed = slice?.speed ?? null;
|
|
100466
|
+
const state = speed === null ? "unknown" : speed > 0 ? "running" : "off";
|
|
100467
|
+
const controls = [];
|
|
100468
|
+
if (speed !== null || has$3(ctx, DeviceFeature.FanSpeed)) controls.push({
|
|
100469
|
+
kind: "slider",
|
|
100470
|
+
id: "fan.speed",
|
|
100471
|
+
label: t("Speed", "Velocità"),
|
|
100472
|
+
value: speed,
|
|
100473
|
+
min: 0,
|
|
100474
|
+
max: 100,
|
|
100475
|
+
step: slice?.percentageStep ?? 1,
|
|
100476
|
+
unit: "%",
|
|
100477
|
+
call: {
|
|
100478
|
+
cap: "fan-control",
|
|
100479
|
+
method: "setPercentage",
|
|
100480
|
+
args: {}
|
|
100481
|
+
},
|
|
100482
|
+
valueArg: "speed"
|
|
100483
|
+
});
|
|
100484
|
+
if (slice !== void 0 && slice.availablePresets.length > 0) controls.push({
|
|
100485
|
+
kind: "picker",
|
|
100486
|
+
id: "fan.preset",
|
|
100487
|
+
label: t("Mode", "Modalità"),
|
|
100488
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
100489
|
+
options: [...slice.availablePresets],
|
|
100490
|
+
call: {
|
|
100491
|
+
cap: "fan-control",
|
|
100492
|
+
method: "setPreset",
|
|
100493
|
+
args: {}
|
|
100494
|
+
},
|
|
100495
|
+
valueArg: "preset"
|
|
100496
|
+
});
|
|
100497
|
+
if (slice?.oscillating != null || has$3(ctx, DeviceFeature.FanOscillating)) controls.push({
|
|
100498
|
+
kind: "toggle",
|
|
100499
|
+
id: "fan.oscillating",
|
|
100500
|
+
label: t("Oscillate", "Oscilla"),
|
|
100501
|
+
on: slice?.oscillating ?? null,
|
|
100502
|
+
turnOn: action("fan.oscillate.on", t("Oscillate", "Oscilla"), "refresh-cw", "fan-control", "setOscillating", { oscillating: true }),
|
|
100503
|
+
turnOff: action("fan.oscillate.off", t("Hold still", "Fermo"), "square", "fan-control", "setOscillating", { oscillating: false })
|
|
100504
|
+
});
|
|
100505
|
+
if (slice?.direction != null || has$3(ctx, DeviceFeature.FanDirection)) controls.push({
|
|
100506
|
+
kind: "picker",
|
|
100507
|
+
id: "fan.direction",
|
|
100508
|
+
label: t("Direction", "Direzione"),
|
|
100509
|
+
current: slice?.direction ?? null,
|
|
100510
|
+
options: ["forward", "reverse"],
|
|
100511
|
+
call: {
|
|
100512
|
+
cap: "fan-control",
|
|
100513
|
+
method: "setDirection",
|
|
100514
|
+
args: {}
|
|
100515
|
+
},
|
|
100516
|
+
valueArg: "direction"
|
|
100517
|
+
});
|
|
100518
|
+
const speedText = speed === null ? null : pct$1(speed);
|
|
100519
|
+
const preset = slice?.preset ?? "";
|
|
100520
|
+
const status = speed === null ? unknownText : joinText([speed === 0 ? t("Off", "Spento") : t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : t(preset, preset)]);
|
|
100521
|
+
return {
|
|
100522
|
+
reading: reading("fan-control", state),
|
|
100523
|
+
rows: [{
|
|
100524
|
+
id: "fan",
|
|
100525
|
+
icon: "fan",
|
|
100526
|
+
status,
|
|
100527
|
+
controls
|
|
100528
|
+
}],
|
|
100529
|
+
...speedText === null ? {} : {
|
|
100530
|
+
facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
|
|
100531
|
+
tiles: { right: [{
|
|
100532
|
+
label: t("Speed", "Velocità"),
|
|
100533
|
+
value: speedText
|
|
100534
|
+
}] },
|
|
100535
|
+
scene: { level: unit(speed ?? 0) }
|
|
100536
|
+
}
|
|
100537
|
+
};
|
|
100538
|
+
});
|
|
100539
|
+
var VACUUM_WORDS = {
|
|
100540
|
+
idle: {
|
|
100541
|
+
state: "idle",
|
|
100542
|
+
title: t("Idle", "Inattivo")
|
|
100543
|
+
},
|
|
100544
|
+
cleaning: {
|
|
100545
|
+
state: "running",
|
|
100546
|
+
title: t("Cleaning", "Pulisce")
|
|
100547
|
+
},
|
|
100548
|
+
paused: {
|
|
100549
|
+
state: "standby",
|
|
100550
|
+
title: t("Paused", "In pausa")
|
|
100551
|
+
},
|
|
100552
|
+
returning: {
|
|
100553
|
+
state: "running",
|
|
100554
|
+
title: t("Returning to base", "Torna alla base")
|
|
100555
|
+
},
|
|
100556
|
+
docked: {
|
|
100557
|
+
state: "idle",
|
|
100558
|
+
title: t("Docked", "In base")
|
|
100559
|
+
},
|
|
100560
|
+
drying: {
|
|
100561
|
+
state: "running",
|
|
100562
|
+
title: t("Drying", "Asciuga")
|
|
100563
|
+
},
|
|
100564
|
+
error: {
|
|
100565
|
+
state: "alert",
|
|
100566
|
+
title: t("Error", "Errore")
|
|
100567
|
+
}
|
|
100568
|
+
};
|
|
100569
|
+
function robotAction(cap, prefix, id, en, it, icon, method, primary = false) {
|
|
100570
|
+
return asAction(action(`${prefix}.${id}`, t(en, it), icon, cap, method, {}, primary ? "primary" : "normal"));
|
|
100571
|
+
}
|
|
100572
|
+
var vac = (id, en, it, icon, method, primary = false) => robotAction("vacuum-control", "vacuum", id, en, it, icon, method, primary);
|
|
100573
|
+
function vacuumControls(state) {
|
|
100574
|
+
const start = (primary) => vac("start", "Start", "Avvia", "play", "start", primary);
|
|
100575
|
+
const resume = vac("resume", "Resume", "Riprendi", "play", "start", true);
|
|
100576
|
+
const pause = (primary) => vac("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
100577
|
+
const base = vac("base", "Return to base", "Torna alla base", "house", "returnToBase");
|
|
100578
|
+
switch (state) {
|
|
100579
|
+
case "cleaning": return [pause(true), base];
|
|
100580
|
+
case "paused": return [resume, base];
|
|
100581
|
+
case "returning":
|
|
100582
|
+
case "drying": return [vac("stop", "Stop", "Ferma", "square", "stop")];
|
|
100583
|
+
case "idle": return [start(true), base];
|
|
100584
|
+
case "docked": return [start(true)];
|
|
100585
|
+
case "error": return [base];
|
|
100586
|
+
case null: return [
|
|
100587
|
+
start(false),
|
|
100588
|
+
pause(false),
|
|
100589
|
+
base
|
|
100590
|
+
];
|
|
100591
|
+
}
|
|
100592
|
+
}
|
|
100593
|
+
var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchema, (slice, ctx) => {
|
|
100594
|
+
const state = slice?.state ?? null;
|
|
100595
|
+
const words = state === null ? null : VACUUM_WORDS[state];
|
|
100596
|
+
const title = state === "error" && slice?.errorLabel ? t(slice.errorLabel, slice.errorLabel) : words?.title;
|
|
100597
|
+
const controls = vacuumControls(state);
|
|
100598
|
+
if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
|
|
100599
|
+
kind: "picker",
|
|
100600
|
+
id: "vacuum.suction",
|
|
100601
|
+
label: t("Suction", "Aspirazione"),
|
|
100602
|
+
current: slice.fanSpeed,
|
|
100603
|
+
options: [...slice.availableFanSpeeds],
|
|
100604
|
+
call: {
|
|
100605
|
+
cap: "vacuum-control",
|
|
100606
|
+
method: "setFanSpeed",
|
|
100607
|
+
args: {}
|
|
100608
|
+
},
|
|
100609
|
+
valueArg: "speed"
|
|
100610
|
+
});
|
|
100611
|
+
if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
|
|
100612
|
+
const progress = state === "cleaning" ? slice?.progress ?? null : null;
|
|
100613
|
+
return {
|
|
100614
|
+
reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
|
|
100615
|
+
rows: [{
|
|
100616
|
+
id: "vacuum",
|
|
100617
|
+
icon: "bot",
|
|
100618
|
+
status: title ?? unknownText,
|
|
100619
|
+
controls
|
|
100620
|
+
}],
|
|
100621
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
100622
|
+
...progress === null ? {} : {
|
|
100623
|
+
tiles: { right: [{
|
|
100624
|
+
label: t("Progress", "Avanzamento"),
|
|
100625
|
+
value: pct$1(progress)
|
|
100626
|
+
}] },
|
|
100627
|
+
scene: { level: unit(progress) }
|
|
100628
|
+
}
|
|
100629
|
+
};
|
|
100630
|
+
});
|
|
100631
|
+
var MOWER_WORDS = {
|
|
100632
|
+
idle: {
|
|
100633
|
+
state: "idle",
|
|
100634
|
+
title: t("Idle", "Inattivo")
|
|
100635
|
+
},
|
|
100636
|
+
mowing: {
|
|
100637
|
+
state: "running",
|
|
100638
|
+
title: t("Mowing", "Taglia")
|
|
100639
|
+
},
|
|
100640
|
+
paused: {
|
|
100641
|
+
state: "standby",
|
|
100642
|
+
title: t("Paused", "In pausa")
|
|
100643
|
+
},
|
|
100644
|
+
docked: {
|
|
100645
|
+
state: "idle",
|
|
100646
|
+
title: t("Docked", "In base")
|
|
100647
|
+
},
|
|
100648
|
+
error: {
|
|
100649
|
+
state: "alert",
|
|
100650
|
+
title: t("Error", "Errore")
|
|
100651
|
+
}
|
|
100652
|
+
};
|
|
100653
|
+
var mow = (id, en, it, icon, method, primary = false) => robotAction("lawn-mower-control", "mower", id, en, it, icon, method, primary);
|
|
100654
|
+
function mowerControls(activity) {
|
|
100655
|
+
const start = (primary) => mow("start", "Start mowing", "Avvia il taglio", "play", "startMowing", primary);
|
|
100656
|
+
const pause = (primary) => mow("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
100657
|
+
const dock = mow("dock", "Return to base", "Torna alla base", "house", "dock");
|
|
100658
|
+
switch (activity) {
|
|
100659
|
+
case "mowing": return [pause(true), dock];
|
|
100660
|
+
case "paused": return [mow("resume", "Resume", "Riprendi", "play", "startMowing", true), dock];
|
|
100661
|
+
case "idle": return [start(true), dock];
|
|
100662
|
+
case "docked": return [start(true)];
|
|
100663
|
+
case "error": return [dock];
|
|
100664
|
+
case null: return [
|
|
100665
|
+
start(false),
|
|
100666
|
+
pause(false),
|
|
100667
|
+
dock
|
|
100668
|
+
];
|
|
100669
|
+
}
|
|
100670
|
+
}
|
|
100671
|
+
var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatusSchema, (slice, ctx) => {
|
|
100672
|
+
const activity = slice?.activity ?? null;
|
|
100673
|
+
const words = activity === null ? null : MOWER_WORDS[activity];
|
|
100674
|
+
const title = activity === "error" && slice?.currentCodeLabel ? t(slice.currentCodeLabel, slice.currentCodeLabel) : words?.title;
|
|
100675
|
+
const progress = activity === "mowing" ? slice?.progress ?? null : null;
|
|
100676
|
+
return {
|
|
100677
|
+
reading: reading("lawn-mower-control", words?.state ?? "unknown", false, title),
|
|
100678
|
+
rows: [{
|
|
100679
|
+
id: "mower",
|
|
100680
|
+
icon: "sprout",
|
|
100681
|
+
status: title ?? unknownText,
|
|
100682
|
+
controls: mowerControls(activity)
|
|
100683
|
+
}],
|
|
100684
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
100685
|
+
...progress === null ? {} : {
|
|
100686
|
+
tiles: { right: [{
|
|
100687
|
+
label: t("Progress", "Avanzamento"),
|
|
100688
|
+
value: pct$1(progress)
|
|
100689
|
+
}] },
|
|
100690
|
+
scene: { level: unit(progress) }
|
|
100691
|
+
}
|
|
100692
|
+
};
|
|
100693
|
+
});
|
|
100694
|
+
function feederWords(slice) {
|
|
100695
|
+
if (slice === void 0) return null;
|
|
100696
|
+
if (slice.status === "offline") return {
|
|
100697
|
+
state: "offline",
|
|
100698
|
+
title: t("Offline", "Non raggiungibile")
|
|
100699
|
+
};
|
|
100700
|
+
if (slice.error !== null) return {
|
|
100701
|
+
state: "alert",
|
|
100702
|
+
title: t(slice.error, slice.error)
|
|
100703
|
+
};
|
|
100704
|
+
if (slice.feeding) return {
|
|
100705
|
+
state: "running",
|
|
100706
|
+
title: t("Dispensing", "Eroga")
|
|
100707
|
+
};
|
|
100708
|
+
if (slice.eating) return {
|
|
100709
|
+
state: "running",
|
|
100710
|
+
title: t("Pet is eating", "Sta mangiando")
|
|
100711
|
+
};
|
|
100712
|
+
if (slice.lowFood) return {
|
|
100713
|
+
state: "standby",
|
|
100714
|
+
title: t("Food is low", "Cibo in esaurimento")
|
|
100715
|
+
};
|
|
100716
|
+
return {
|
|
100717
|
+
state: "idle",
|
|
100718
|
+
title: t("Ready", "Pronto")
|
|
100719
|
+
};
|
|
100720
|
+
}
|
|
100721
|
+
/** The manual portion the card offers: the last one given, else the hardware minimum. */
|
|
100722
|
+
function feedArgs(slice) {
|
|
100723
|
+
if (slice.isDualHopper) return {
|
|
100724
|
+
hopper1: slice.lastFeedHopper1 ?? 4,
|
|
100725
|
+
hopper2: slice.lastFeedHopper2 ?? 4
|
|
100726
|
+
};
|
|
100727
|
+
return { grams: slice.lastFeedGrams ?? 4 };
|
|
100728
|
+
}
|
|
100729
|
+
function feederControls(slice) {
|
|
100730
|
+
return [
|
|
100731
|
+
asAction(slice.feeding ? action("feeder.cancel", t("Cancel", "Annulla"), "square", "pet-feeder", "cancelFeed", {}, "primary") : action("feeder.feed", slice.isDualHopper ? t("Feed", "Eroga") : t(`Feed ${slice.lastFeedGrams ?? 4} g`, `Eroga ${slice.lastFeedGrams ?? 4} g`), "bone", "pet-feeder", "feed", feedArgs(slice), "primary")),
|
|
100732
|
+
asAction(action("feeder.call", t("Call pet", "Chiama"), "volume-2", "pet-feeder", "callPet")),
|
|
100733
|
+
{
|
|
100734
|
+
kind: "toggle",
|
|
100735
|
+
id: "feeder.child-lock",
|
|
100736
|
+
label: t("Child lock", "Blocco bambini"),
|
|
100737
|
+
on: slice.childLock,
|
|
100738
|
+
turnOn: action("feeder.child-lock.on", t("Lock", "Blocca"), "lock", "pet-feeder", "setChildLock", { on: true }),
|
|
100739
|
+
turnOff: action("feeder.child-lock.off", t("Unlock", "Sblocca"), "lock-open", "pet-feeder", "setChildLock", { on: false })
|
|
100740
|
+
}
|
|
100741
|
+
];
|
|
100742
|
+
}
|
|
100743
|
+
var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slice, ctx) => {
|
|
100744
|
+
const words = feederWords(slice);
|
|
100745
|
+
const last = slice?.lastFeedGrams ?? null;
|
|
100746
|
+
return {
|
|
100747
|
+
reading: reading("pet-feeder", words?.state ?? "unknown", false, words?.title),
|
|
100748
|
+
rows: [{
|
|
100749
|
+
id: "feeder",
|
|
100750
|
+
icon: "bone",
|
|
100751
|
+
status: words?.title ?? unknownText,
|
|
100752
|
+
controls: slice === void 0 ? [] : feederControls(slice)
|
|
100753
|
+
}],
|
|
100754
|
+
facts: [
|
|
100755
|
+
...slice?.lowFood === true ? [fact("level", "bone", t("Food low", "Cibo in esaurimento"), "warning")] : [],
|
|
100756
|
+
...last === null ? [] : [fact("last-run", "clock", t(`Last ${last} g`, `Ultimo ${last} g`))],
|
|
100757
|
+
...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
|
|
100758
|
+
],
|
|
100759
|
+
...last === null ? {} : { tiles: { right: [{
|
|
100760
|
+
label: t("Last portion", "Ultima porzione"),
|
|
100761
|
+
value: t(`${last} g`, `${last} g`)
|
|
100762
|
+
}] } }
|
|
100763
|
+
};
|
|
100764
|
+
});
|
|
100765
|
+
var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
|
|
100766
|
+
const pump = slice?.pumpRunning ?? null;
|
|
100767
|
+
const fault = slice?.error ?? null;
|
|
100768
|
+
const empty = slice?.empty === true;
|
|
100769
|
+
const state = slice === void 0 ? "unknown" : fault !== null || empty ? "alert" : pump === null ? "unknown" : pump ? "running" : "off";
|
|
100770
|
+
const title = slice === void 0 ? void 0 : fault !== null ? t(fault, fault) : empty ? t("Tank empty", "Serbatoio vuoto") : pump === null ? void 0 : pump ? t("Pump running", "Pompa attiva") : t("Pump off", "Pompa spenta");
|
|
100771
|
+
const level = slice?.waterLevel ?? null;
|
|
100772
|
+
const control = {
|
|
100773
|
+
kind: "toggle",
|
|
100774
|
+
id: "fountain.pump",
|
|
100775
|
+
label: t("Pump", "Pompa"),
|
|
100776
|
+
on: pump,
|
|
100777
|
+
turnOn: action("fountain.pump.on", t("Pump on", "Accendi la pompa"), "droplets", "pet-fountain", "setPump", { on: true }, "primary"),
|
|
100778
|
+
turnOff: action("fountain.pump.off", t("Pump off", "Spegni la pompa"), "square", "pet-fountain", "setPump", { on: false })
|
|
100779
|
+
};
|
|
100780
|
+
return {
|
|
100781
|
+
reading: reading("pet-fountain", state, false, title),
|
|
100782
|
+
rows: [{
|
|
100783
|
+
id: "fountain",
|
|
100784
|
+
icon: "droplets",
|
|
100785
|
+
status: title ?? unknownText,
|
|
100786
|
+
controls: slice === void 0 ? [] : [control]
|
|
100787
|
+
}],
|
|
100788
|
+
...level === null ? {} : {
|
|
100789
|
+
facts: [fact("level", "droplets", t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
|
|
100790
|
+
tiles: { right: [{
|
|
100791
|
+
label: t("Water", "Acqua"),
|
|
100792
|
+
value: pct$1(level)
|
|
100793
|
+
}] },
|
|
100794
|
+
scene: { level: unit(level) }
|
|
100795
|
+
}
|
|
100796
|
+
};
|
|
100797
|
+
});
|
|
100798
|
+
var minutesOf = (seconds) => Math.max(0, Math.round(seconds / 60));
|
|
100799
|
+
var DEVICES_FAMILY_CONTRIBUTIONS = {
|
|
100800
|
+
"fan-control": fanContribution,
|
|
100801
|
+
"vacuum-control": vacuumContribution,
|
|
100802
|
+
"lawn-mower-control": mowerContribution,
|
|
100803
|
+
"pet-feeder": feederContribution,
|
|
100804
|
+
"pet-fountain": fountainContribution,
|
|
100805
|
+
"pump-cycle": contribution("pump-cycle", PumpCycleStatusSchema, (slice) => {
|
|
100806
|
+
const enabled = slice?.enabled ?? null;
|
|
100807
|
+
const cycle = slice?.onTime != null && slice.offTime != null ? t(`${minutesOf(slice.onTime)} min on · ${minutesOf(slice.offTime)} min off`, `${minutesOf(slice.onTime)} min acceso · ${minutesOf(slice.offTime)} min spento`) : null;
|
|
100808
|
+
return { rows: [row$1("pump-cycle", "timer", enabled === null ? unknownText : enabled ? joinText([t("Cycling", "A cicli"), cycle]) : t("Runs continuously", "Sempre attiva"), [{
|
|
100809
|
+
kind: "toggle",
|
|
100810
|
+
id: "pump-cycle.enabled",
|
|
100811
|
+
label: t("Pump cycle", "Ciclo pompa"),
|
|
100812
|
+
on: enabled,
|
|
100813
|
+
turnOn: action("pump-cycle.on", t("Cycle the pump", "Attiva il ciclo"), "timer", "pump-cycle", "setEnabled", { on: true }),
|
|
100814
|
+
turnOff: action("pump-cycle.off", t("Run continuously", "Sempre attiva"), "timer-off", "pump-cycle", "setEnabled", { on: false })
|
|
100815
|
+
}])] };
|
|
100816
|
+
})
|
|
100817
|
+
};
|
|
100818
|
+
//#endregion
|
|
100819
|
+
//#region src/device/hero/hero-contributions-actuators.ts
|
|
100820
|
+
/**
|
|
100821
|
+
* What the moving and dimming caps add to a hero (D1023): a light's brightness
|
|
100822
|
+
* and colour, a cover, a valve and a humidifier. Moving a cover or a valve is
|
|
100823
|
+
* an ACTION the person presses, never a toggle that fires by itself; a slice
|
|
100824
|
+
* that does not parse reads `unknown`, never closed or off (D315/D393).
|
|
100825
|
+
*/
|
|
100826
|
+
var has$2 = (ctx, f) => ctx.features.includes(f);
|
|
100827
|
+
var pct = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
100828
|
+
var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
|
|
100829
|
+
const level = slice?.level ?? null;
|
|
100830
|
+
return {
|
|
100831
|
+
...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
|
|
100832
|
+
...level === null ? {} : {
|
|
100833
|
+
facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
|
|
100834
|
+
scene: { level: level / 100 }
|
|
100835
|
+
},
|
|
100836
|
+
rows: [row$1("brightness", "sun-dim", level === null ? null : t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
|
|
100837
|
+
kind: "slider",
|
|
100838
|
+
id: "brightness.level",
|
|
100839
|
+
label: t("Brightness", "Luminosità"),
|
|
100840
|
+
value: level,
|
|
100841
|
+
min: 0,
|
|
100842
|
+
max: 100,
|
|
100843
|
+
step: 1,
|
|
100844
|
+
unit: "%",
|
|
100845
|
+
call: {
|
|
100846
|
+
cap: "brightness",
|
|
100847
|
+
method: "setBrightness",
|
|
100848
|
+
args: {}
|
|
100849
|
+
},
|
|
100850
|
+
valueArg: "level"
|
|
100851
|
+
}])]
|
|
100852
|
+
};
|
|
100853
|
+
});
|
|
100854
|
+
/**
|
|
100855
|
+
* Preset colours as actions: `setColor` takes a nested `{ mode, … }` argument, which a
|
|
100856
|
+
* hero action carries (D1023). Only the modes the bulb declares are offered, each a
|
|
100857
|
+
* valid `setColor` input; a bulb that declares none is shown, not set.
|
|
100858
|
+
*/
|
|
100859
|
+
var WHITE_PRESETS = [
|
|
100860
|
+
{
|
|
100861
|
+
id: "color.warm",
|
|
100862
|
+
en: "Warm white",
|
|
100863
|
+
it: "Bianco caldo",
|
|
100864
|
+
icon: "sun",
|
|
100865
|
+
mired: 370
|
|
100866
|
+
},
|
|
100867
|
+
{
|
|
100868
|
+
id: "color.neutral",
|
|
100869
|
+
en: "Neutral white",
|
|
100870
|
+
it: "Bianco neutro",
|
|
100871
|
+
icon: "lightbulb",
|
|
100872
|
+
mired: 250
|
|
100873
|
+
},
|
|
100874
|
+
{
|
|
100875
|
+
id: "color.cool",
|
|
100876
|
+
en: "Cool white",
|
|
100877
|
+
it: "Bianco freddo",
|
|
100878
|
+
icon: "snowflake",
|
|
100879
|
+
mired: 154
|
|
100880
|
+
}
|
|
100881
|
+
];
|
|
100882
|
+
var HUE_PRESETS = [
|
|
100883
|
+
{
|
|
100884
|
+
id: "color.red",
|
|
100885
|
+
en: "Red",
|
|
100886
|
+
it: "Rosso",
|
|
100887
|
+
hue: 0
|
|
100888
|
+
},
|
|
100889
|
+
{
|
|
100890
|
+
id: "color.amber",
|
|
100891
|
+
en: "Amber",
|
|
100892
|
+
it: "Ambra",
|
|
100893
|
+
hue: 40
|
|
100894
|
+
},
|
|
100895
|
+
{
|
|
100896
|
+
id: "color.green",
|
|
100897
|
+
en: "Green",
|
|
100898
|
+
it: "Verde",
|
|
100899
|
+
hue: 120
|
|
100900
|
+
},
|
|
100901
|
+
{
|
|
100902
|
+
id: "color.cyan",
|
|
100903
|
+
en: "Cyan",
|
|
100904
|
+
it: "Ciano",
|
|
100905
|
+
hue: 180
|
|
100906
|
+
},
|
|
100907
|
+
{
|
|
100908
|
+
id: "color.blue",
|
|
100909
|
+
en: "Blue",
|
|
100910
|
+
it: "Blu",
|
|
100911
|
+
hue: 240
|
|
100912
|
+
},
|
|
100913
|
+
{
|
|
100914
|
+
id: "color.purple",
|
|
100915
|
+
en: "Purple",
|
|
100916
|
+
it: "Viola",
|
|
100917
|
+
hue: 280
|
|
100918
|
+
}
|
|
100919
|
+
];
|
|
100920
|
+
function colorControls(ctx, current) {
|
|
100921
|
+
const controls = [];
|
|
100922
|
+
if (has$2(ctx, DeviceFeature.LightColorMired)) for (const p of WHITE_PRESETS) controls.push(asAction(action(p.id, t(p.en, p.it), p.icon, "color", "setColor", { color: {
|
|
100923
|
+
mode: "mired",
|
|
100924
|
+
colorTemperature: p.mired
|
|
100925
|
+
} })));
|
|
100926
|
+
if (has$2(ctx, DeviceFeature.LightColorHsv)) {
|
|
100927
|
+
const s = current?.s ?? 100;
|
|
100928
|
+
const v = current?.v ?? 100;
|
|
100929
|
+
for (const p of HUE_PRESETS) controls.push(asAction(action(p.id, t(p.en, p.it), "palette", "color", "setColor", { color: {
|
|
100930
|
+
mode: "hsv",
|
|
100931
|
+
hsv: {
|
|
100932
|
+
h: p.hue,
|
|
100933
|
+
s,
|
|
100934
|
+
v
|
|
100935
|
+
}
|
|
100936
|
+
} })));
|
|
100937
|
+
}
|
|
100938
|
+
return controls;
|
|
100939
|
+
}
|
|
100940
|
+
var colorContribution = contribution("color", ColorStatusSchema, (slice, ctx) => {
|
|
100941
|
+
let words = null;
|
|
100942
|
+
if (slice !== void 0) {
|
|
100943
|
+
if (slice.mode === "mired" && slice.colorTemperature !== void 0 && slice.colorTemperature > 0) {
|
|
100944
|
+
const kelvin = Math.round(1e6 / slice.colorTemperature);
|
|
100945
|
+
words = t(`${kelvin} K`, `${kelvin} K`);
|
|
100946
|
+
} else if (slice.mode === "rgb" && slice.rgb !== void 0) {
|
|
100947
|
+
const c = `RGB ${slice.rgb.r}, ${slice.rgb.g}, ${slice.rgb.b}`;
|
|
100948
|
+
words = t(c, c);
|
|
100949
|
+
} else if (slice.mode === "hsv" && slice.hsv !== void 0) words = t(`Hue ${Math.round(slice.hsv.h)}°`, `Tonalità ${Math.round(slice.hsv.h)}°`);
|
|
100950
|
+
}
|
|
100951
|
+
return {
|
|
100952
|
+
...words === null ? {} : { facts: [fact("reading", "palette", words)] },
|
|
100953
|
+
rows: [row$1("color", "palette", words, colorControls(ctx, slice?.mode === "hsv" && slice.hsv !== void 0 ? slice.hsv : null))]
|
|
100954
|
+
};
|
|
100955
|
+
});
|
|
100956
|
+
function travelWords(state, position) {
|
|
100957
|
+
const partial = position !== null && position > 0 && position < 100;
|
|
100958
|
+
const at = position === null ? null : Math.round(position);
|
|
100959
|
+
switch (state) {
|
|
100960
|
+
case "open": return {
|
|
100961
|
+
state: "on",
|
|
100962
|
+
title: partial ? t(`${at}% open`, `Aperto al ${at}%`) : t("Open", "Aperto"),
|
|
100963
|
+
mode: "open"
|
|
100964
|
+
};
|
|
100965
|
+
case "closed": return {
|
|
100966
|
+
state: "off",
|
|
100967
|
+
title: t("Closed", "Chiuso"),
|
|
100968
|
+
mode: "closed"
|
|
100969
|
+
};
|
|
100970
|
+
case "opening": return {
|
|
100971
|
+
state: "running",
|
|
100972
|
+
title: t("Opening", "In apertura"),
|
|
100973
|
+
mode: "open"
|
|
100974
|
+
};
|
|
100975
|
+
case "closing": return {
|
|
100976
|
+
state: "running",
|
|
100977
|
+
title: t("Closing", "In chiusura"),
|
|
100978
|
+
mode: "closed"
|
|
100979
|
+
};
|
|
100980
|
+
case "stopped": return {
|
|
100981
|
+
state: "idle",
|
|
100982
|
+
title: at === null ? t("Stopped", "Fermo") : t(`Stopped at ${at}%`, `Fermo al ${at}%`),
|
|
100983
|
+
mode: position === null ? null : position > 0 ? "open" : "closed"
|
|
100984
|
+
};
|
|
100985
|
+
}
|
|
100986
|
+
}
|
|
100987
|
+
/** Open / stop / close are actions; the one that makes sense next carries the emphasis. */
|
|
100988
|
+
function travelActions(s, state, moving) {
|
|
100989
|
+
const emphasis = (wanted) => wanted ? "primary" : "normal";
|
|
100990
|
+
const open = action(`${s.cap}.open`, t("Open", "Apri"), "arrow-up", s.cap, "open", {}, emphasis(state === "closed" || state === "closing"));
|
|
100991
|
+
const stop = action(`${s.cap}.stop`, t("Stop", "Ferma"), "square", s.cap, "stop", {}, emphasis(moving));
|
|
100992
|
+
const close = action(`${s.cap}.close`, t("Close", "Chiudi"), "arrow-down", s.cap, "close", {}, emphasis(state === "open" || state === "opening"));
|
|
100993
|
+
return s.stoppable || moving ? [
|
|
100994
|
+
open,
|
|
100995
|
+
stop,
|
|
100996
|
+
close
|
|
100997
|
+
] : [open, close];
|
|
100998
|
+
}
|
|
100999
|
+
function positionSlider(s, position) {
|
|
101000
|
+
return {
|
|
101001
|
+
kind: "slider",
|
|
101002
|
+
id: `${s.cap}.position`,
|
|
101003
|
+
label: t("Position", "Posizione"),
|
|
101004
|
+
value: position,
|
|
101005
|
+
min: 0,
|
|
101006
|
+
max: 100,
|
|
101007
|
+
step: 1,
|
|
101008
|
+
unit: "%",
|
|
101009
|
+
call: {
|
|
101010
|
+
cap: s.cap,
|
|
101011
|
+
method: "setPosition",
|
|
101012
|
+
args: {}
|
|
101013
|
+
},
|
|
101014
|
+
valueArg: "position"
|
|
101015
|
+
};
|
|
101016
|
+
}
|
|
101017
|
+
function travelFragment(s, state, position, tilt, ctx) {
|
|
101018
|
+
if (state === void 0) return {
|
|
101019
|
+
reading: reading(s.source, "unknown"),
|
|
101020
|
+
rows: [row$1(s.rowId, "arrow-up", null, travelActions(s, void 0, false).map(asAction))]
|
|
101021
|
+
};
|
|
101022
|
+
const words = travelWords(state, position);
|
|
101023
|
+
const controls = travelActions(s, state, state === "opening" || state === "closing").map(asAction);
|
|
101024
|
+
if (position !== null || s.positionable) controls.push(positionSlider(s, position));
|
|
101025
|
+
if (s.cap === "cover" && (tilt !== null || has$2(ctx, DeviceFeature.CoverTilt))) controls.push({
|
|
101026
|
+
kind: "slider",
|
|
101027
|
+
id: "cover.tilt",
|
|
101028
|
+
label: t("Tilt", "Inclinazione"),
|
|
101029
|
+
value: tilt,
|
|
101030
|
+
min: 0,
|
|
101031
|
+
max: 100,
|
|
101032
|
+
step: 1,
|
|
101033
|
+
unit: "%",
|
|
101034
|
+
call: {
|
|
101035
|
+
cap: "cover",
|
|
101036
|
+
method: "setTiltPosition",
|
|
101037
|
+
args: {}
|
|
101038
|
+
},
|
|
101039
|
+
valueArg: "tiltPosition"
|
|
101040
|
+
});
|
|
101041
|
+
return {
|
|
101042
|
+
reading: reading(s.source, words.state, false, words.title),
|
|
101043
|
+
...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
|
|
101044
|
+
scene: {
|
|
101045
|
+
...words.mode === null ? {} : { mode: words.mode },
|
|
101046
|
+
...position === null ? {} : { level: position / 100 }
|
|
101047
|
+
},
|
|
101048
|
+
rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
|
|
101049
|
+
};
|
|
101050
|
+
}
|
|
101051
|
+
var ACTUATORS_FAMILY_CONTRIBUTIONS = {
|
|
101052
|
+
brightness: brightnessContribution,
|
|
101053
|
+
color: colorContribution,
|
|
101054
|
+
cover: contribution("cover", CoverStatusSchema, (slice, ctx) => travelFragment({
|
|
101055
|
+
cap: "cover",
|
|
101056
|
+
rowId: "cover",
|
|
101057
|
+
source: "cover",
|
|
101058
|
+
stoppable: has$2(ctx, DeviceFeature.CoverStoppable),
|
|
101059
|
+
positionable: has$2(ctx, DeviceFeature.CoverPositionable)
|
|
101060
|
+
}, slice?.state, slice?.position ?? null, slice?.tiltPosition ?? null, ctx)),
|
|
101061
|
+
valve: contribution("valve", ValveStatusSchema, (slice, ctx) => travelFragment({
|
|
101062
|
+
cap: "valve",
|
|
101063
|
+
rowId: "valve",
|
|
101064
|
+
source: "valve",
|
|
101065
|
+
stoppable: false,
|
|
101066
|
+
positionable: has$2(ctx, DeviceFeature.ValvePositionable)
|
|
101067
|
+
}, slice?.state, slice?.position ?? null, null, ctx)),
|
|
101068
|
+
humidifier: contribution("humidifier", HumidifierStatusSchema, (slice) => {
|
|
101069
|
+
if (slice === void 0) return { reading: reading("humidifier", "unknown") };
|
|
101070
|
+
const action_ = slice.action;
|
|
101071
|
+
let state = "off";
|
|
101072
|
+
let title = t("Off", "Spento");
|
|
101073
|
+
if (slice.on) if (action_ === "humidifying") {
|
|
101074
|
+
state = "running";
|
|
101075
|
+
title = t("Humidifying", "Umidifica");
|
|
101076
|
+
} else if (action_ === "drying") {
|
|
101077
|
+
state = "running";
|
|
101078
|
+
title = t("Drying", "Deumidifica");
|
|
101079
|
+
} else if (action_ === "idle") {
|
|
101080
|
+
state = "idle";
|
|
101081
|
+
title = t("Idle", "In attesa");
|
|
101082
|
+
} else {
|
|
101083
|
+
state = "on";
|
|
101084
|
+
title = t("On", "Acceso");
|
|
101085
|
+
}
|
|
101086
|
+
const controls = [{
|
|
101087
|
+
kind: "toggle",
|
|
101088
|
+
id: "humidifier.power",
|
|
101089
|
+
label: t("Power", "Accensione"),
|
|
101090
|
+
on: slice.on,
|
|
101091
|
+
turnOn: action("humidifier.on", t("Turn on", "Accendi"), "power", "humidifier", "setOn", { on: true }),
|
|
101092
|
+
turnOff: action("humidifier.off", t("Turn off", "Spegni"), "power-off", "humidifier", "setOn", { on: false })
|
|
101093
|
+
}];
|
|
101094
|
+
if (slice.targetHumidity !== null) controls.push({
|
|
101095
|
+
kind: "slider",
|
|
101096
|
+
id: "humidifier.target",
|
|
101097
|
+
label: t("Target", "Obiettivo"),
|
|
101098
|
+
value: slice.targetHumidity,
|
|
101099
|
+
min: slice.minHumidity ?? 0,
|
|
101100
|
+
max: slice.maxHumidity ?? 100,
|
|
101101
|
+
step: 1,
|
|
101102
|
+
unit: "%",
|
|
101103
|
+
call: {
|
|
101104
|
+
cap: "humidifier",
|
|
101105
|
+
method: "setTargetHumidity",
|
|
101106
|
+
args: {}
|
|
101107
|
+
},
|
|
101108
|
+
valueArg: "humidity"
|
|
101109
|
+
});
|
|
101110
|
+
if (slice.availableModes.length > 0) controls.push({
|
|
101111
|
+
kind: "picker",
|
|
101112
|
+
id: "humidifier.mode",
|
|
101113
|
+
label: t("Mode", "Modalità"),
|
|
101114
|
+
current: slice.mode,
|
|
101115
|
+
options: [...slice.availableModes],
|
|
101116
|
+
call: {
|
|
101117
|
+
cap: "humidifier",
|
|
101118
|
+
method: "setMode",
|
|
101119
|
+
args: {}
|
|
101120
|
+
},
|
|
101121
|
+
valueArg: "mode"
|
|
101122
|
+
});
|
|
101123
|
+
const now = slice.currentHumidity;
|
|
101124
|
+
return {
|
|
101125
|
+
reading: reading("humidifier", state, false, title),
|
|
101126
|
+
...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
|
|
101127
|
+
...slice.targetHumidity === null ? {} : { tiles: { right: [{
|
|
101128
|
+
label: t("Target", "Obiettivo"),
|
|
101129
|
+
value: pct(slice.targetHumidity)
|
|
101130
|
+
}] } },
|
|
101131
|
+
...now === null ? {} : { scene: { level: now / 100 } },
|
|
101132
|
+
rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : t(slice.mode, slice.mode)]), controls)]
|
|
101133
|
+
};
|
|
101134
|
+
})
|
|
101135
|
+
};
|
|
101136
|
+
var GROUPS_FAMILY_CONTRIBUTIONS = {
|
|
101137
|
+
"group-active": contribution("group-active", GroupActiveSchema, (slice) => {
|
|
101138
|
+
if (slice === void 0) return { reading: reading("group-active", "unknown") };
|
|
101139
|
+
return { reading: reading("group-active", slice.active ? "on" : "off", false, slice.active ? t("Active", "Attivo") : t("Inactive", "Non attivo")) };
|
|
101140
|
+
}),
|
|
101141
|
+
"group-status": contribution("group-status", GroupStatusSchema, (slice) => {
|
|
101142
|
+
if (slice === void 0) return {};
|
|
101143
|
+
const text = slice.excluded === 0 ? t(`${slice.total} members`, `${slice.total} membri`) : t(`${slice.included} of ${slice.total} reporting`, `${slice.included} di ${slice.total} rispondono`);
|
|
101144
|
+
return {
|
|
101145
|
+
facts: [fact("members", "users", text, slice.excluded === 0 ? "muted" : "warning")],
|
|
101146
|
+
tiles: { left: [{
|
|
101147
|
+
label: t("Members", "Membri"),
|
|
101148
|
+
value: text
|
|
101149
|
+
}] }
|
|
101150
|
+
};
|
|
101151
|
+
}),
|
|
101152
|
+
"group-commands": contribution("group-commands", GroupCommandsSchema, (slice) => {
|
|
101153
|
+
if (slice === void 0) return {};
|
|
101154
|
+
const failed = slice.results.filter((r) => !r.ok).length;
|
|
101155
|
+
if (failed === 0) return {};
|
|
101156
|
+
const total = slice.results.length;
|
|
101157
|
+
return { facts: [fact("failures", "triangle-alert", t(`${failed} of ${total} failed`, `${failed} di ${total} falliti`), "danger")] };
|
|
101158
|
+
}),
|
|
101159
|
+
"event-emitter": contribution("event-emitter", EventEmitterStatusSchema, (slice, ctx) => {
|
|
101160
|
+
if (slice === void 0) return { reading: reading("event-emitter", "unknown") };
|
|
101161
|
+
const last = slice.lastEvent;
|
|
101162
|
+
const ago = last === null ? null : elapsedText(last.timestamp, ctx.now);
|
|
101163
|
+
return {
|
|
101164
|
+
reading: reading("event-emitter", "idle", false, t("Listening", "In ascolto")),
|
|
101165
|
+
...last === null ? {} : { facts: [fact("event", "radio-tower", ago === null ? t(last.eventType, last.eventType) : t(`${last.eventType} · ${ago.en}`, `${last.eventType} · ${ago.it}`), "primary")] },
|
|
101166
|
+
tiles: { right: [{
|
|
101167
|
+
label: t("Events", "Eventi"),
|
|
101168
|
+
value: t(`${slice.eventCountSinceStart}`, `${slice.eventCountSinceStart}`)
|
|
101169
|
+
}] }
|
|
101170
|
+
};
|
|
101171
|
+
})
|
|
101172
|
+
};
|
|
101173
|
+
//#endregion
|
|
101174
|
+
//#region src/device/hero/hero-contributions-sensors.ts
|
|
101175
|
+
/**
|
|
101176
|
+
* What the sensing caps add to a hero (D1023): the alarm sensors (smoke, flood,
|
|
101177
|
+
* gas, tamper, vibration), motion, presence, the doorbell, the generic binary
|
|
101178
|
+
* and meter, the weather station, a firmware update, an image and the two
|
|
101179
|
+
* caps a person acts on directly (a button, a control).
|
|
101180
|
+
*
|
|
101181
|
+
* A sensor's title is its READING ("Clear" / "Detected"), never a power word:
|
|
101182
|
+
* the generic On / Off belong to something that can be switched. A slice that
|
|
101183
|
+
* does not parse is "not answered" and reads `unknown`, never clear (D315/D393);
|
|
101184
|
+
* a measurement the device did not report is absent, never a zero (D393).
|
|
101185
|
+
*/
|
|
101186
|
+
/** The recency of a transition as the top line's "since" fact; absent when never observed. */
|
|
101187
|
+
function sinceFact(at, now, tone = "muted") {
|
|
101188
|
+
if (at === null) return [];
|
|
101189
|
+
const ago = elapsedText(at, now);
|
|
101190
|
+
return ago === null ? [] : [fact("since", "clock", ago, tone)];
|
|
101191
|
+
}
|
|
101192
|
+
function detection(spec) {
|
|
101193
|
+
return contribution(spec.cap, spec.schema, (slice, ctx) => {
|
|
101194
|
+
if (slice === void 0) return { reading: reading(spec.source, "unknown") };
|
|
101195
|
+
const tripped = spec.flag(slice);
|
|
101196
|
+
const changed = spec.changedAt(slice);
|
|
101197
|
+
return {
|
|
101198
|
+
reading: reading(spec.source, tripped ? spec.yesState : "idle", false, tripped ? spec.words.yes : spec.words.no),
|
|
101199
|
+
facts: sinceFact(changed === 0 ? null : changed, ctx.now, tripped ? "danger" : "muted")
|
|
101200
|
+
};
|
|
101201
|
+
});
|
|
101202
|
+
}
|
|
101203
|
+
var detected = {
|
|
101204
|
+
yes: t("Detected", "Rilevato"),
|
|
101205
|
+
no: t("Clear", "Libero")
|
|
101206
|
+
};
|
|
101207
|
+
var smokeContribution = detection({
|
|
101208
|
+
cap: "smoke",
|
|
101209
|
+
source: "smoke",
|
|
101210
|
+
schema: SmokeStatusSchema,
|
|
101211
|
+
words: {
|
|
101212
|
+
yes: t("Smoke detected", "Fumo rilevato"),
|
|
101213
|
+
no: t("Clear", "Nessun fumo")
|
|
101214
|
+
},
|
|
101215
|
+
yesState: "alert",
|
|
101216
|
+
flag: (s) => s.detected,
|
|
101217
|
+
changedAt: (s) => s.lastChangedAt
|
|
101218
|
+
});
|
|
101219
|
+
var floodContribution = detection({
|
|
101220
|
+
cap: "flood",
|
|
101221
|
+
source: "flood",
|
|
101222
|
+
schema: FloodStatusSchema,
|
|
101223
|
+
words: {
|
|
101224
|
+
yes: t("Leak detected", "Perdita rilevata"),
|
|
101225
|
+
no: t("Dry", "Asciutto")
|
|
101226
|
+
},
|
|
101227
|
+
yesState: "alert",
|
|
101228
|
+
flag: (s) => s.flooded,
|
|
101229
|
+
changedAt: (s) => s.lastChangedAt
|
|
101230
|
+
});
|
|
101231
|
+
var gasContribution = detection({
|
|
101232
|
+
cap: "gas",
|
|
101233
|
+
source: "gas",
|
|
101234
|
+
schema: GasStatusSchema,
|
|
101235
|
+
words: {
|
|
101236
|
+
yes: t("Gas detected", "Gas rilevato"),
|
|
101237
|
+
no: t("Clear", "Nessun gas")
|
|
101238
|
+
},
|
|
101239
|
+
yesState: "alert",
|
|
101240
|
+
flag: (s) => s.detected,
|
|
101241
|
+
changedAt: (s) => s.lastChangedAt
|
|
101242
|
+
});
|
|
101243
|
+
var tamperContribution = detection({
|
|
101244
|
+
cap: "tamper",
|
|
101245
|
+
source: "tamper",
|
|
101246
|
+
schema: TamperStatusSchema,
|
|
101247
|
+
words: {
|
|
101248
|
+
yes: t("Tampered", "Manomesso"),
|
|
101249
|
+
no: t("Secure", "Integro")
|
|
101250
|
+
},
|
|
101251
|
+
yesState: "alert",
|
|
101252
|
+
flag: (s) => s.tampered,
|
|
101253
|
+
changedAt: (s) => s.lastChangedAt
|
|
101254
|
+
});
|
|
101255
|
+
var vibrationContribution = detection({
|
|
101256
|
+
cap: "vibration",
|
|
101257
|
+
source: "vibration",
|
|
101258
|
+
schema: VibrationStatusSchema,
|
|
101259
|
+
words: {
|
|
101260
|
+
yes: t("Vibration", "Vibrazione"),
|
|
101261
|
+
no: t("Still", "Fermo")
|
|
101262
|
+
},
|
|
101263
|
+
yesState: "on",
|
|
101264
|
+
flag: (s) => s.detected,
|
|
101265
|
+
changedAt: (s) => s.lastChangedAt
|
|
101266
|
+
});
|
|
101267
|
+
var binaryContribution = detection({
|
|
101268
|
+
cap: "binary",
|
|
101269
|
+
source: "binary",
|
|
101270
|
+
schema: BinaryStatusSchema,
|
|
101271
|
+
words: {
|
|
101272
|
+
yes: t("Active", "Attivo"),
|
|
101273
|
+
no: t("Inactive", "Inattivo")
|
|
101274
|
+
},
|
|
101275
|
+
yesState: "on",
|
|
101276
|
+
flag: (s) => s.on,
|
|
101277
|
+
changedAt: (s) => s.lastChangedAt
|
|
101278
|
+
});
|
|
101279
|
+
var motionContribution = contribution("motion", MotionStatusSchema, (slice, ctx) => {
|
|
101280
|
+
if (slice === void 0) return { reading: reading("motion", "unknown") };
|
|
101281
|
+
const last = slice.lastDetectedAt;
|
|
101282
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
101283
|
+
return {
|
|
101284
|
+
reading: reading("motion", slice.detected ? "on" : "idle", false, slice.detected ? detected.yes : t("Clear", "Nessun movimento")),
|
|
101285
|
+
...ago === null ? {} : { facts: [fact("since", "clock", t(`Last motion ${ago.en}`, `Ultimo movimento ${ago.it}`), slice.detected ? "primary" : "muted")] }
|
|
101286
|
+
};
|
|
101287
|
+
});
|
|
101288
|
+
var presenceContribution = contribution("presence", PresenceStatusSchema, (slice, ctx) => {
|
|
101289
|
+
if (slice === void 0) return { reading: reading("presence", "unknown") };
|
|
101290
|
+
const zone = slice.state;
|
|
101291
|
+
const home = zone === "home";
|
|
101292
|
+
const away = zone === "not_home";
|
|
101293
|
+
const title = home ? t("Home", "A casa") : away ? t("Away", "Fuori casa") : t(zone, zone);
|
|
101294
|
+
const facts = [];
|
|
101295
|
+
if (slice.location !== null && slice.location !== "") facts.push(fact("reading", "map-pin", t(slice.location, slice.location)));
|
|
101296
|
+
facts.push(...sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now));
|
|
101297
|
+
return {
|
|
101298
|
+
reading: reading("presence", away ? "off" : "on", false, title),
|
|
101299
|
+
facts
|
|
101300
|
+
};
|
|
101301
|
+
});
|
|
101302
|
+
/** A ring this recent still reads as "ringing". */
|
|
101303
|
+
var RINGING_MS = 3e4;
|
|
101304
|
+
var doorbellContribution = contribution("doorbell", DoorbellStatusSchema, (slice, ctx) => {
|
|
101305
|
+
if (slice === void 0) return { reading: reading("doorbell", "unknown") };
|
|
101306
|
+
const last = slice.lastPressedAt;
|
|
101307
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
101308
|
+
const ringing = last !== null && ctx.now >= last && ctx.now - last < RINGING_MS;
|
|
101309
|
+
const title = ringing ? t("Ringing", "Suona") : ago === null ? t("No ring yet", "Nessun squillo") : t(`Last ring ${ago.en}`, `Ultimo squillo ${ago.it}`);
|
|
101310
|
+
const count = slice.pressCountSinceStart;
|
|
101311
|
+
return {
|
|
101312
|
+
...ctx.caps.includes("motion") && !ringing ? {} : { reading: reading("doorbell", ringing ? "on" : "idle", false, title) },
|
|
101313
|
+
facts: [...ctx.caps.includes("motion") && !ringing ? [fact("event", "bell", title)] : [], ...count > 0 ? [fact("event", "bell-ring", t(`${count} ring${count === 1 ? "" : "s"}`, `${count} squilli`))] : []]
|
|
101314
|
+
};
|
|
101315
|
+
});
|
|
101316
|
+
var number = (n) => `${Number(n.toFixed(2))}`;
|
|
101317
|
+
var meterContribution = contribution("meter", MeterStatusSchema, (slice, ctx) => {
|
|
101318
|
+
if (slice === void 0 || slice.value === null) return { reading: reading("meter", "unknown") };
|
|
101319
|
+
const value = number(slice.value);
|
|
101320
|
+
return {
|
|
101321
|
+
reading: reading("meter", "idle", false, t(value, value)),
|
|
101322
|
+
facts: sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now)
|
|
101323
|
+
};
|
|
101324
|
+
});
|
|
101325
|
+
var CONDITION_WORDS = {
|
|
101326
|
+
sunny: t("Sunny", "Soleggiato"),
|
|
101327
|
+
"clear-night": t("Clear night", "Notte serena"),
|
|
101328
|
+
cloudy: t("Cloudy", "Nuvoloso"),
|
|
101329
|
+
partlycloudy: t("Partly cloudy", "Parzialmente nuvoloso"),
|
|
101330
|
+
rainy: t("Rain", "Pioggia"),
|
|
101331
|
+
pouring: t("Heavy rain", "Pioggia forte"),
|
|
101332
|
+
snowy: t("Snow", "Neve"),
|
|
101333
|
+
"snowy-rainy": t("Sleet", "Nevischio"),
|
|
101334
|
+
fog: t("Fog", "Nebbia"),
|
|
101335
|
+
windy: t("Windy", "Ventoso"),
|
|
101336
|
+
"windy-variant": t("Windy", "Ventoso"),
|
|
101337
|
+
lightning: t("Thunderstorm", "Temporale"),
|
|
101338
|
+
"lightning-rainy": t("Thunderstorm", "Temporale"),
|
|
101339
|
+
hail: t("Hail", "Grandine"),
|
|
101340
|
+
exceptional: t("Exceptional", "Eccezionale")
|
|
101341
|
+
};
|
|
101342
|
+
var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, ctx) => {
|
|
101343
|
+
if (slice === void 0) return { reading: reading("weather", "unknown") };
|
|
101344
|
+
const { condition, temperature, humidity, pressure, windSpeed } = slice;
|
|
101345
|
+
const celsius = temperature === null ? null : `${number(temperature)}°C`;
|
|
101346
|
+
const word = condition === null ? null : CONDITION_WORDS[condition] ?? t(condition, condition);
|
|
101347
|
+
const title = word ?? (celsius === null ? null : t(celsius, celsius));
|
|
101348
|
+
if (title === null) return { reading: reading("weather", "unknown") };
|
|
101349
|
+
const facts = [];
|
|
101350
|
+
if (celsius !== null && word !== null) facts.push(fact("reading", "thermometer", t(celsius, celsius), "primary"));
|
|
101351
|
+
if (humidity !== null) facts.push(fact("reading", "droplets", t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)));
|
|
101352
|
+
if (windSpeed !== null) facts.push(fact("reading", "wind", t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)));
|
|
101353
|
+
if (pressure !== null) facts.push(fact("reading", "gauge", t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)));
|
|
101354
|
+
facts.push(...sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now));
|
|
101355
|
+
const left = [];
|
|
101356
|
+
if (humidity !== null) left.push({
|
|
101357
|
+
label: t("Humidity", "Umidità"),
|
|
101358
|
+
value: t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)
|
|
101359
|
+
});
|
|
101360
|
+
if (pressure !== null) left.push({
|
|
101361
|
+
label: t("Pressure", "Pressione"),
|
|
101362
|
+
value: t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)
|
|
101363
|
+
});
|
|
101364
|
+
const right = windSpeed === null ? [] : [{
|
|
101365
|
+
label: t("Wind", "Vento"),
|
|
101366
|
+
value: t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)
|
|
101367
|
+
}];
|
|
101368
|
+
return {
|
|
101369
|
+
reading: reading("weather", "on", false, title),
|
|
101370
|
+
facts,
|
|
101371
|
+
tiles: {
|
|
101372
|
+
left,
|
|
101373
|
+
right
|
|
101374
|
+
}
|
|
101375
|
+
};
|
|
101376
|
+
});
|
|
101377
|
+
var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
|
|
101378
|
+
if (slice === void 0) return { reading: reading("update", "unknown") };
|
|
101379
|
+
const { currentVersion, availableVersion, inProgress, updatable } = slice;
|
|
101380
|
+
const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
|
|
101381
|
+
if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
|
|
101382
|
+
const state = inProgress ? "running" : pending ? "standby" : "idle";
|
|
101383
|
+
const title = inProgress ? t("Updating", "Aggiornamento in corso") : pending ? t("Update available", "Aggiornamento disponibile") : t("Up to date", "Aggiornato");
|
|
101384
|
+
const versions = currentVersion === null ? pending ? t(`${availableVersion}`, `${availableVersion}`) : null : pending ? t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
|
|
101385
|
+
const install = pending && updatable && !inProgress ? [asAction(action("update.install", t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
|
|
101386
|
+
return {
|
|
101387
|
+
reading: reading("update", state, false, title),
|
|
101388
|
+
facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
|
|
101389
|
+
rows: [row$1("update", "download", versions, install)]
|
|
101390
|
+
};
|
|
101391
|
+
});
|
|
101392
|
+
var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
|
|
101393
|
+
if (slice === void 0) return { reading: reading("image", "unknown") };
|
|
101394
|
+
if (slice.url === null) return { reading: reading("image", "idle", false, t("No image yet", "Nessuna immagine")) };
|
|
101395
|
+
const ago = slice.lastUpdated === null ? null : elapsedText(slice.lastUpdated, ctx.now);
|
|
101396
|
+
return {
|
|
101397
|
+
reading: reading("image", "on", false, ago === null ? t("Image", "Immagine") : t(`Updated ${ago.en}`, `Aggiornata ${ago.it}`)),
|
|
101398
|
+
artworkUrl: slice.url
|
|
101399
|
+
};
|
|
101400
|
+
});
|
|
101401
|
+
/** A button has no state to read: it is always ready, so it is never `unknown`. */
|
|
101402
|
+
var buttonContribution = {
|
|
101403
|
+
cap: "button",
|
|
101404
|
+
contribute: () => ({
|
|
101405
|
+
reading: reading("button", "idle", false, t("Ready", "Pronto")),
|
|
101406
|
+
rows: [row$1("button", "pointer", null, [asAction(action("button.press", t("Press", "Premi"), "pointer", "button", "press", {}, "primary", "press"))])]
|
|
101407
|
+
})
|
|
101408
|
+
};
|
|
101409
|
+
var controlContribution = contribution("control", ControlStatusSchema, (slice, ctx) => {
|
|
101410
|
+
if (slice === void 0) return { reading: reading("control", "unknown") };
|
|
101411
|
+
const text = typeof slice.value === "number" ? number(slice.value) : slice.value;
|
|
101412
|
+
return {
|
|
101413
|
+
reading: reading("control", "on", false, t(text, text)),
|
|
101414
|
+
facts: sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now),
|
|
101415
|
+
rows: controlRows(slice)
|
|
101416
|
+
};
|
|
101417
|
+
});
|
|
101418
|
+
var CONTROL_LABEL = t("Value", "Valore");
|
|
101419
|
+
/** A number with known bounds is a slider, a choice a picker; text and dates stay read-only. */
|
|
101420
|
+
function controlRows(slice) {
|
|
101421
|
+
if (slice.kind === "numeric" && typeof slice.value === "number") {
|
|
101422
|
+
if (slice.min === void 0 || slice.max === void 0) return [];
|
|
101423
|
+
return [row$1("control", "sliders-horizontal", null, [{
|
|
101424
|
+
kind: "slider",
|
|
101425
|
+
id: "control.value",
|
|
101426
|
+
label: CONTROL_LABEL,
|
|
101427
|
+
value: slice.value,
|
|
101428
|
+
min: slice.min,
|
|
101429
|
+
max: slice.max,
|
|
101430
|
+
step: slice.step ?? 1,
|
|
101431
|
+
unit: "",
|
|
101432
|
+
call: {
|
|
101433
|
+
cap: "control",
|
|
101434
|
+
method: "setValue",
|
|
101435
|
+
args: { control: { kind: "numeric" } }
|
|
101436
|
+
},
|
|
101437
|
+
valueArg: "control.value"
|
|
101438
|
+
}])];
|
|
101439
|
+
}
|
|
101440
|
+
if (slice.kind === "select" && typeof slice.value === "string") return [row$1("control", "sliders-horizontal", null, [{
|
|
101441
|
+
kind: "picker",
|
|
101442
|
+
id: "control.value",
|
|
101443
|
+
label: CONTROL_LABEL,
|
|
101444
|
+
current: slice.value,
|
|
101445
|
+
options: slice.options,
|
|
101446
|
+
call: {
|
|
101447
|
+
cap: "control",
|
|
101448
|
+
method: "setValue",
|
|
101449
|
+
args: { control: { kind: "select" } }
|
|
101450
|
+
},
|
|
101451
|
+
valueArg: "control.value"
|
|
101452
|
+
}])];
|
|
101453
|
+
return [];
|
|
101454
|
+
}
|
|
101455
|
+
var SENSORS_FAMILY_CONTRIBUTIONS = {
|
|
101456
|
+
smoke: smokeContribution,
|
|
101457
|
+
flood: floodContribution,
|
|
101458
|
+
gas: gasContribution,
|
|
101459
|
+
tamper: tamperContribution,
|
|
101460
|
+
vibration: vibrationContribution,
|
|
101461
|
+
binary: binaryContribution,
|
|
101462
|
+
motion: motionContribution,
|
|
101463
|
+
presence: presenceContribution,
|
|
101464
|
+
doorbell: doorbellContribution,
|
|
101465
|
+
meter: meterContribution,
|
|
101466
|
+
weather: weatherContribution,
|
|
101467
|
+
update: updateContribution,
|
|
101468
|
+
image: imageContribution,
|
|
101469
|
+
button: buttonContribution,
|
|
101470
|
+
control: controlContribution
|
|
101471
|
+
};
|
|
101472
|
+
//#endregion
|
|
101473
|
+
//#region src/device/hero/climate-view.ts
|
|
101474
|
+
var MODE_LABEL = {
|
|
101475
|
+
off: t("Off", "Spento"),
|
|
101476
|
+
heat: t("Heating", "Riscalda"),
|
|
101477
|
+
cool: t("Cooling", "Freddo"),
|
|
101478
|
+
auto: t("Auto", "Auto"),
|
|
101479
|
+
heat_cool: t("Heat/Cool", "Caldo/Freddo"),
|
|
101480
|
+
fan_only: t("Fan only", "Solo ventola"),
|
|
101481
|
+
dry: t("Drying", "Deumidifica")
|
|
101482
|
+
};
|
|
101483
|
+
var SCENE_MODE = {
|
|
101484
|
+
off: null,
|
|
101485
|
+
heat: "heat",
|
|
101486
|
+
cool: "cool",
|
|
101487
|
+
auto: "auto",
|
|
101488
|
+
heat_cool: "auto",
|
|
101489
|
+
fan_only: "fan",
|
|
101490
|
+
dry: "dry"
|
|
101491
|
+
};
|
|
101492
|
+
/** Without a remembered mode, "turn on" picks the first of these the device accepts. */
|
|
101493
|
+
var ON_MODE_PREFERENCE = [
|
|
101494
|
+
"auto",
|
|
101495
|
+
"heat_cool",
|
|
101496
|
+
"heat",
|
|
101497
|
+
"cool"
|
|
101498
|
+
];
|
|
101499
|
+
/** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
|
|
101500
|
+
function formatDegrees(value) {
|
|
101501
|
+
return `${Number(value.toFixed(1))}°`;
|
|
101502
|
+
}
|
|
101503
|
+
/** "Turn on" returns to the mode the device last ran when it still accepts it, else the fixed order. */
|
|
101504
|
+
function onModeOf(available, last) {
|
|
101505
|
+
const candidates = available.filter((m) => m !== "off");
|
|
101506
|
+
if (last !== void 0 && candidates.includes(last)) return last;
|
|
101507
|
+
for (const preferred of ON_MODE_PREFERENCE) if (candidates.includes(preferred)) return preferred;
|
|
101508
|
+
return candidates[0] ?? null;
|
|
101509
|
+
}
|
|
101510
|
+
function deriveClimateView(slice) {
|
|
101511
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, slice.tempStep);
|
|
101512
|
+
const level = levelWithin(slice.target, range);
|
|
101513
|
+
return {
|
|
101514
|
+
mode: slice.mode,
|
|
101515
|
+
isOff: slice.mode === "off",
|
|
101516
|
+
modeLabel: MODE_LABEL[slice.mode],
|
|
101517
|
+
target: slice.target,
|
|
101518
|
+
measured: slice.currentTemp,
|
|
101519
|
+
targetRange: slice.targetLow !== null && slice.targetHigh !== null ? {
|
|
101520
|
+
low: slice.targetLow,
|
|
101521
|
+
high: slice.targetHigh
|
|
101522
|
+
} : null,
|
|
101523
|
+
targetHumidity: slice.targetHumidity,
|
|
101524
|
+
humidity: slice.currentHumidity,
|
|
101525
|
+
range,
|
|
101526
|
+
availableModes: slice.availableModes,
|
|
101527
|
+
sceneMode: SCENE_MODE[slice.mode],
|
|
101528
|
+
level,
|
|
101529
|
+
onMode: onModeOf(slice.availableModes, slice.lastActiveMode)
|
|
101530
|
+
};
|
|
101531
|
+
}
|
|
101532
|
+
/** "22° (22.3°)": the setpoint and, in brackets, what is measured. The mode is the headline, not repeated here. */
|
|
101533
|
+
function thermalStatusText(target, measured) {
|
|
101534
|
+
const goal = target === null ? "" : typeof target === "string" ? target : formatDegrees(target);
|
|
101535
|
+
const now = measured === null ? "" : formatDegrees(measured);
|
|
101536
|
+
const temps = goal !== "" && now !== "" ? `${goal} (${now})` : goal !== "" ? goal : now;
|
|
101537
|
+
return temps === "" ? null : t(temps, temps);
|
|
101538
|
+
}
|
|
101539
|
+
function climateStatusText(view) {
|
|
101540
|
+
const range = view.targetRange;
|
|
101541
|
+
return thermalStatusText(view.target !== null ? view.target : range === null ? null : `${Number(range.low.toFixed(1))}–${formatDegrees(range.high)}`, view.measured);
|
|
101542
|
+
}
|
|
101543
|
+
/** The setpoint inside its range, 0..1. */
|
|
101544
|
+
function levelWithin(value, range) {
|
|
101545
|
+
if (value === null || range === null) return null;
|
|
101546
|
+
return Math.min(1, Math.max(0, (value - range.min) / (range.max - range.min)));
|
|
101547
|
+
}
|
|
101548
|
+
function rangeFrom(min, max, step) {
|
|
101549
|
+
if (min === null || min === void 0) return null;
|
|
101550
|
+
if (max === null || max === void 0 || max <= min) return null;
|
|
101551
|
+
return {
|
|
101552
|
+
min,
|
|
101553
|
+
max,
|
|
101554
|
+
step: step ?? 1
|
|
101555
|
+
};
|
|
101556
|
+
}
|
|
101557
|
+
//#endregion
|
|
101558
|
+
//#region src/device/hero/hero-contributions-climate.ts
|
|
101559
|
+
/**
|
|
101560
|
+
* The climate family's contributions to a hero (D1023): `climate-control`,
|
|
101561
|
+
* `water-heater`, `heating-valve`, and the read-only sensors. Capabilities
|
|
101562
|
+
* contribute, types never do (D14). A slice that is absent or does not parse is
|
|
101563
|
+
* "not answered": the state reads unknown, no row is drawn (D315, D393).
|
|
101564
|
+
*/
|
|
101565
|
+
var same = (text) => t(text, text);
|
|
101566
|
+
function tile(en, it, value) {
|
|
101567
|
+
return {
|
|
101568
|
+
label: t(en, it),
|
|
101569
|
+
value: same(value)
|
|
101570
|
+
};
|
|
101571
|
+
}
|
|
101572
|
+
function setpointSlider(id, cap, method, valueArg, value, range) {
|
|
101573
|
+
return {
|
|
101574
|
+
kind: "slider",
|
|
101575
|
+
id,
|
|
101576
|
+
label: t("Target", "Obiettivo"),
|
|
101577
|
+
value,
|
|
101578
|
+
min: range.min,
|
|
101579
|
+
max: range.max,
|
|
101580
|
+
step: range.step,
|
|
101581
|
+
unit: "°",
|
|
101582
|
+
call: {
|
|
101583
|
+
cap,
|
|
101584
|
+
method,
|
|
101585
|
+
args: {}
|
|
101586
|
+
},
|
|
101587
|
+
valueArg
|
|
101588
|
+
};
|
|
101589
|
+
}
|
|
101590
|
+
function setpointRow(status, slider) {
|
|
101591
|
+
return slider === null ? [] : [{
|
|
101592
|
+
id: "setpoint",
|
|
101593
|
+
icon: "thermometer",
|
|
101594
|
+
status,
|
|
101595
|
+
controls: [slider]
|
|
101596
|
+
}];
|
|
101597
|
+
}
|
|
101598
|
+
var climateContribution = contribution("climate-control", ClimateControlStatusSchema, (slice, ctx) => {
|
|
101599
|
+
if (slice === void 0) return { reading: reading("climate-control", "unknown") };
|
|
101600
|
+
const view = deriveClimateView(slice);
|
|
101601
|
+
const status = climateStatusText(view);
|
|
101602
|
+
const facts = [];
|
|
101603
|
+
if (status !== null) facts.push(fact("climate", "thermometer", status));
|
|
101604
|
+
if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
|
|
101605
|
+
if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
|
|
101606
|
+
const left = [];
|
|
101607
|
+
const right = [];
|
|
101608
|
+
if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
|
|
101609
|
+
if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
|
|
101610
|
+
const modeControls = [{
|
|
101611
|
+
kind: "picker",
|
|
101612
|
+
id: "climate.mode",
|
|
101613
|
+
label: t("Mode", "Modalità"),
|
|
101614
|
+
current: view.mode,
|
|
101615
|
+
options: [...view.availableModes],
|
|
101616
|
+
call: {
|
|
101617
|
+
cap: "climate-control",
|
|
101618
|
+
method: "setMode",
|
|
101619
|
+
args: {}
|
|
101620
|
+
},
|
|
101621
|
+
valueArg: "mode"
|
|
101622
|
+
}];
|
|
101623
|
+
if (slice.availablePresets.length > 0) modeControls.push({
|
|
101624
|
+
kind: "picker",
|
|
101625
|
+
id: "climate.preset",
|
|
101626
|
+
label: t("Preset", "Preset"),
|
|
101627
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
101628
|
+
options: [...slice.availablePresets],
|
|
101629
|
+
call: {
|
|
101630
|
+
cap: "climate-control",
|
|
101631
|
+
method: "setPreset",
|
|
101632
|
+
args: {}
|
|
101633
|
+
},
|
|
101634
|
+
valueArg: "preset"
|
|
101635
|
+
});
|
|
101636
|
+
const fanControls = [];
|
|
101637
|
+
if (slice.availableFanModes.length > 0) fanControls.push({
|
|
101638
|
+
kind: "picker",
|
|
101639
|
+
id: "climate.fan",
|
|
101640
|
+
label: t("Fan", "Ventola"),
|
|
101641
|
+
current: slice.fanMode === "" ? null : slice.fanMode,
|
|
101642
|
+
options: [...slice.availableFanModes],
|
|
101643
|
+
call: {
|
|
101644
|
+
cap: "climate-control",
|
|
101645
|
+
method: "setFanMode",
|
|
101646
|
+
args: {}
|
|
101647
|
+
},
|
|
101648
|
+
valueArg: "fanMode"
|
|
101649
|
+
});
|
|
101650
|
+
const swing = (id, en, it, method, on, feature) => ctx.features.includes(feature) ? [{
|
|
101651
|
+
kind: "toggle",
|
|
101652
|
+
id,
|
|
101653
|
+
label: t(en, it),
|
|
101654
|
+
on,
|
|
101655
|
+
turnOn: action(`${id}.on`, t(en, it), "wind", "climate-control", method, { on: true }),
|
|
101656
|
+
turnOff: action(`${id}.off`, t(en, it), "wind", "climate-control", method, { on: false })
|
|
101657
|
+
}] : [];
|
|
101658
|
+
fanControls.push(...swing("climate.swing-vertical", "Swing vertical", "Oscillazione verticale", "setSwingVertical", slice.swingVertical, DeviceFeature.ClimateSwingVertical), ...swing("climate.swing-horizontal", "Swing horizontal", "Oscillazione orizzontale", "setSwingHorizontal", slice.swingHorizontal, DeviceFeature.ClimateSwingHorizontal));
|
|
101659
|
+
const rows = [{
|
|
101660
|
+
id: "climate-mode",
|
|
101661
|
+
icon: "thermometer",
|
|
101662
|
+
status: view.modeLabel,
|
|
101663
|
+
controls: modeControls
|
|
101664
|
+
}];
|
|
101665
|
+
if (fanControls.length > 0) rows.push({
|
|
101666
|
+
id: "climate-fan",
|
|
101667
|
+
icon: "fan",
|
|
101668
|
+
status: slice.fanMode === "" ? null : same(slice.fanMode),
|
|
101669
|
+
controls: fanControls
|
|
101670
|
+
});
|
|
101671
|
+
rows.push(...setpointRow(view.target === null ? null : same(formatDegrees(view.target)), view.range === null || view.target === null ? null : setpointSlider("climate.target", "climate-control", "setTarget", "target", view.target, view.range)));
|
|
101672
|
+
const sceneMode = view.sceneMode;
|
|
101673
|
+
return {
|
|
101674
|
+
reading: reading("climate-control", view.isOff ? "off" : "on"),
|
|
101675
|
+
title: view.modeLabel,
|
|
101676
|
+
facts,
|
|
101677
|
+
...left.length === 0 && right.length === 0 ? {} : { tiles: {
|
|
101678
|
+
left,
|
|
101679
|
+
right
|
|
101680
|
+
} },
|
|
101681
|
+
scene: {
|
|
101682
|
+
...sceneMode === null ? {} : { mode: sceneMode },
|
|
101683
|
+
...view.level === null ? {} : { level: view.level }
|
|
101684
|
+
},
|
|
101685
|
+
...view.onMode === null ? {} : { ownPower: {
|
|
101686
|
+
source: "climate-control",
|
|
101687
|
+
on: !view.isOff,
|
|
101688
|
+
assumed: false,
|
|
101689
|
+
turnOn: action("own-power.on", t("Turn on", "Accendi"), "power", "climate-control", "setMode", { mode: view.onMode }),
|
|
101690
|
+
turnOff: action("own-power.off", t("Turn off", "Spegni"), "power-off", "climate-control", "setMode", { mode: "off" })
|
|
101691
|
+
} },
|
|
101692
|
+
rows
|
|
101693
|
+
};
|
|
101694
|
+
});
|
|
101695
|
+
var WATER_ON_PREFERENCE = [
|
|
101696
|
+
"eco",
|
|
101697
|
+
"electric",
|
|
101698
|
+
"heat_pump",
|
|
101699
|
+
"performance"
|
|
101700
|
+
];
|
|
101701
|
+
function capitalised(word) {
|
|
101702
|
+
return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
|
|
101703
|
+
}
|
|
101704
|
+
var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
|
|
101705
|
+
if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
|
|
101706
|
+
const isOff = slice.operationMode === "off";
|
|
101707
|
+
const label = capitalised(slice.operationMode);
|
|
101708
|
+
const status = thermalStatusText(slice.targetTemp, slice.currentTemp);
|
|
101709
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, 1);
|
|
101710
|
+
const candidates = slice.availableModes.filter((m) => m !== "off");
|
|
101711
|
+
const last = slice.lastActiveMode;
|
|
101712
|
+
const onMode = last !== void 0 && candidates.includes(last) ? last : WATER_ON_PREFERENCE.find((m) => candidates.includes(m)) ?? candidates[0] ?? null;
|
|
101713
|
+
const modeControls = [{
|
|
101714
|
+
kind: "picker",
|
|
101715
|
+
id: "water-heater.mode",
|
|
101716
|
+
label: t("Mode", "Modalità"),
|
|
101717
|
+
current: slice.operationMode,
|
|
101718
|
+
options: [...slice.availableModes],
|
|
101719
|
+
call: {
|
|
101720
|
+
cap: "water-heater",
|
|
101721
|
+
method: "setOperationMode",
|
|
101722
|
+
args: {}
|
|
101723
|
+
},
|
|
101724
|
+
valueArg: "mode"
|
|
101725
|
+
}];
|
|
101726
|
+
if (slice.away !== null) modeControls.push({
|
|
101727
|
+
kind: "toggle",
|
|
101728
|
+
id: "water-heater.away",
|
|
101729
|
+
label: t("Away", "Assente"),
|
|
101730
|
+
on: slice.away,
|
|
101731
|
+
turnOn: action("water-heater.away.on", t("Away", "Assente"), "house", "water-heater", "setAway", { on: true }),
|
|
101732
|
+
turnOff: action("water-heater.away.off", t("Away", "Assente"), "house", "water-heater", "setAway", { on: false })
|
|
101733
|
+
});
|
|
101734
|
+
const rows = [{
|
|
101735
|
+
id: "climate-mode",
|
|
101736
|
+
icon: "flame",
|
|
101737
|
+
status: label,
|
|
101738
|
+
controls: modeControls
|
|
101739
|
+
}, ...setpointRow(slice.targetTemp === null ? null : same(formatDegrees(slice.targetTemp)), range === null || slice.targetTemp === null ? null : setpointSlider("water-heater.target", "water-heater", "setTargetTemp", "temp", slice.targetTemp, range))];
|
|
101740
|
+
const level = levelWithin(slice.targetTemp, range);
|
|
101741
|
+
return {
|
|
101742
|
+
reading: reading("climate-control", isOff ? "off" : "on"),
|
|
101743
|
+
title: label,
|
|
101744
|
+
facts: status === null ? [] : [fact("climate", "flame", status)],
|
|
101745
|
+
...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
|
|
101746
|
+
scene: {
|
|
101747
|
+
...isOff ? {} : { mode: "heat" },
|
|
101748
|
+
...level === null ? {} : { level }
|
|
101749
|
+
},
|
|
101750
|
+
...onMode === null ? {} : { ownPower: {
|
|
101751
|
+
source: "climate-control",
|
|
101752
|
+
on: !isOff,
|
|
101753
|
+
assumed: false,
|
|
101754
|
+
turnOn: action("own-power.on", t("Turn on", "Accendi"), "power", "water-heater", "setOperationMode", { mode: onMode }),
|
|
101755
|
+
turnOff: action("own-power.off", t("Turn off", "Spegni"), "power-off", "water-heater", "setOperationMode", { mode: "off" })
|
|
101756
|
+
} },
|
|
101757
|
+
rows
|
|
101758
|
+
};
|
|
101759
|
+
});
|
|
101760
|
+
var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
|
|
101761
|
+
const position = slice?.position ?? null;
|
|
101762
|
+
if (position === null) return { reading: reading("sensor", "unknown") };
|
|
101763
|
+
const text = same(`${Math.round(position)}%`);
|
|
101764
|
+
return {
|
|
101765
|
+
reading: reading("sensor", position > 0 ? "running" : "idle"),
|
|
101766
|
+
facts: [fact("valve", "gauge", t(`Valve ${text.en}`, `Valvola ${text.it}`))],
|
|
101767
|
+
tiles: { right: [tile("Valve", "Valvola", text.en)] },
|
|
101768
|
+
scene: { level: position / 100 }
|
|
101769
|
+
};
|
|
101770
|
+
});
|
|
101771
|
+
/** One reading fact plus its tile; a value that did not answer says nothing and the state stays unknown. */
|
|
101772
|
+
function sensorFragment(value, id, icon, en, it, text) {
|
|
101773
|
+
if (value === null) return { reading: reading("sensor", "unknown") };
|
|
101774
|
+
return {
|
|
101775
|
+
reading: reading("sensor", "on"),
|
|
101776
|
+
title: same(text),
|
|
101777
|
+
facts: [fact(id, icon, same(text))],
|
|
101778
|
+
tiles: { right: [tile(en, it, text)] }
|
|
101779
|
+
};
|
|
101780
|
+
}
|
|
101781
|
+
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
|
|
101782
|
+
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`));
|
|
101783
|
+
var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
|
|
101784
|
+
var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
|
|
101785
|
+
var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
|
|
101786
|
+
var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
|
|
101787
|
+
if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
|
|
101788
|
+
if (slice.timestamp === true) return { reading: reading("sensor", "on") };
|
|
101789
|
+
return sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value);
|
|
101790
|
+
});
|
|
101791
|
+
/** Index bands: the headline of an air-quality sensor is a word, not a number. */
|
|
101792
|
+
function airQualityWord(aqi) {
|
|
101793
|
+
if (aqi <= 50) return t("Good", "Buona");
|
|
101794
|
+
if (aqi <= 100) return t("Moderate", "Discreta");
|
|
101795
|
+
if (aqi <= 150) return t("Poor", "Scadente");
|
|
101796
|
+
return t("Unhealthy", "Malsana");
|
|
101797
|
+
}
|
|
101798
|
+
/** The climate family, in the order their fragments are merged (a valve's level outranks a setpoint's). */
|
|
101799
|
+
var CLIMATE_FAMILY_CONTRIBUTIONS = {
|
|
101800
|
+
"heating-valve": heatingValveContribution,
|
|
101801
|
+
"climate-control": climateContribution,
|
|
101802
|
+
"water-heater": waterHeaterContribution,
|
|
101803
|
+
"temperature-sensor": temperatureContribution,
|
|
101804
|
+
"humidity-sensor": humidityContribution,
|
|
101805
|
+
"pressure-sensor": pressureContribution,
|
|
101806
|
+
"air-quality-sensor": contribution("air-quality-sensor", AirQualitySensorStatusSchema, (slice) => {
|
|
101807
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
101808
|
+
const parts = [];
|
|
101809
|
+
if (slice.aqi !== void 0) parts.push({
|
|
101810
|
+
label: "AQI",
|
|
101811
|
+
value: String(Math.round(slice.aqi))
|
|
101812
|
+
});
|
|
101813
|
+
if (slice.co2 !== void 0) parts.push({
|
|
101814
|
+
label: "CO₂",
|
|
101815
|
+
value: `${Math.round(slice.co2)} ppm`
|
|
101816
|
+
});
|
|
101817
|
+
if (slice.pm25 !== void 0) parts.push({
|
|
101818
|
+
label: "PM2.5",
|
|
101819
|
+
value: `${Math.round(slice.pm25)} µg/m³`
|
|
101820
|
+
});
|
|
101821
|
+
if (slice.voc !== void 0) parts.push({
|
|
101822
|
+
label: "VOC",
|
|
101823
|
+
value: `${Math.round(slice.voc)} ppb`
|
|
101824
|
+
});
|
|
101825
|
+
if (slice.pm10 !== void 0) parts.push({
|
|
101826
|
+
label: "PM10",
|
|
101827
|
+
value: `${Math.round(slice.pm10)} µg/m³`
|
|
101828
|
+
});
|
|
101829
|
+
if (parts.length === 0) return { reading: reading("sensor", "unknown") };
|
|
101830
|
+
return {
|
|
101831
|
+
reading: reading("sensor", "on"),
|
|
101832
|
+
...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
|
|
101833
|
+
facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
|
|
101834
|
+
tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
|
|
101835
|
+
};
|
|
101836
|
+
}),
|
|
101837
|
+
"carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
|
|
101838
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
101839
|
+
return {
|
|
101840
|
+
reading: reading("sensor", slice.detected ? "alert" : "idle"),
|
|
101841
|
+
title: slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"),
|
|
101842
|
+
facts: [fact("reading", slice.detected ? "triangle-alert" : "shield-check", slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"), slice.detected ? "danger" : "muted")]
|
|
101843
|
+
};
|
|
101844
|
+
}),
|
|
101845
|
+
"ambient-light-sensor": illuminanceContribution,
|
|
101846
|
+
"numeric-sensor": numericContribution,
|
|
101847
|
+
"enum-sensor": enumContribution
|
|
101848
|
+
};
|
|
101849
|
+
//#endregion
|
|
100110
101850
|
//#region src/device/hero/media-player-view.ts
|
|
100111
101851
|
/** The position to show at `nowMs`: the reported one, advanced while playing when it is stamped. */
|
|
100112
101852
|
function projectedPositionMs(status, nowMs) {
|
|
@@ -100181,6 +101921,7 @@ var UNKNOWN_VIEW = {
|
|
|
100181
101921
|
artworkUrl: null,
|
|
100182
101922
|
mute: false,
|
|
100183
101923
|
source: null,
|
|
101924
|
+
channel: null,
|
|
100184
101925
|
shuffle: false,
|
|
100185
101926
|
repeat: false,
|
|
100186
101927
|
shuffleReadOnly: false,
|
|
@@ -100245,6 +101986,13 @@ function derivePowerGatedView(status, features, extras) {
|
|
|
100245
101986
|
runningReading
|
|
100246
101987
|
};
|
|
100247
101988
|
}
|
|
101989
|
+
/** The channel being watched: only a media item the device itself calls a channel. */
|
|
101990
|
+
function channelOf(status) {
|
|
101991
|
+
const media = status.currentMedia;
|
|
101992
|
+
if (media === null || media === void 0 || media.type !== "channel") return null;
|
|
101993
|
+
const title = media.title.trim();
|
|
101994
|
+
return title === "" ? null : title;
|
|
101995
|
+
}
|
|
100248
101996
|
function deriveFromStatus(status, features) {
|
|
100249
101997
|
const has = (f) => features?.includes(f) ?? false;
|
|
100250
101998
|
const canSwitchPower = has(DeviceFeature.MediaPlayerPower);
|
|
@@ -100286,55 +102034,24 @@ function deriveFromStatus(status, features) {
|
|
|
100286
102034
|
options,
|
|
100287
102035
|
selectable: has(DeviceFeature.MediaPlayerSelectSource) && options.length > 1
|
|
100288
102036
|
} : null,
|
|
102037
|
+
channel: has(DeviceFeature.MediaPlayerChannelStep) ? { current: channelOf(status) } : null,
|
|
100289
102038
|
shuffle: has(DeviceFeature.MediaPlayerShuffle) && status.shuffle !== null,
|
|
100290
102039
|
repeat: has(DeviceFeature.MediaPlayerRepeat) && status.repeat !== null
|
|
100291
102040
|
};
|
|
100292
102041
|
}
|
|
100293
102042
|
//#endregion
|
|
100294
102043
|
//#region src/device/hero/hero-contributions.ts
|
|
100295
|
-
/**
|
|
100296
|
-
|
|
100297
|
-
|
|
100298
|
-
|
|
100299
|
-
|
|
100300
|
-
|
|
100301
|
-
|
|
100302
|
-
|
|
100303
|
-
|
|
100304
|
-
|
|
100305
|
-
|
|
100306
|
-
return {
|
|
100307
|
-
id,
|
|
100308
|
-
label,
|
|
100309
|
-
icon,
|
|
100310
|
-
call: {
|
|
100311
|
-
cap,
|
|
100312
|
-
method,
|
|
100313
|
-
args
|
|
100314
|
-
},
|
|
100315
|
-
emphasis,
|
|
100316
|
-
confirm
|
|
100317
|
-
};
|
|
100318
|
-
}
|
|
100319
|
-
var asAction = (a) => ({
|
|
100320
|
-
kind: "action",
|
|
100321
|
-
action: a
|
|
100322
|
-
});
|
|
100323
|
-
function reading(source, state, assumed = false) {
|
|
100324
|
-
return {
|
|
100325
|
-
source,
|
|
100326
|
-
state,
|
|
100327
|
-
assumed
|
|
100328
|
-
};
|
|
100329
|
-
}
|
|
100330
|
-
function fact(id, icon, text, tone = "muted") {
|
|
100331
|
-
return {
|
|
100332
|
-
id,
|
|
100333
|
-
icon,
|
|
100334
|
-
text,
|
|
100335
|
-
tone
|
|
100336
|
-
};
|
|
100337
|
-
}
|
|
102044
|
+
/**
|
|
102045
|
+
* What each capability contributes to a hero (D1023). The map is typed against
|
|
102046
|
+
* the cap's own status schema: a slice is parsed at the boundary, and one that
|
|
102047
|
+
* does not parse reads as "not answered", never as a value.
|
|
102048
|
+
*
|
|
102049
|
+
* Capabilities contribute, device types never do (D14): nothing here looks at a
|
|
102050
|
+
* vendor. A type only chooses which ROWS its layout carries and how it looks.
|
|
102051
|
+
* `HERO_CAP_COVERAGE` (the second file of this directory) says, for every
|
|
102052
|
+
* device cap, whether it contributes and why it does not; the guard
|
|
102053
|
+
* `scripts/check-cap-hero-contributions.ts` keeps it complete.
|
|
102054
|
+
*/
|
|
100338
102055
|
function minutesLeft(seconds) {
|
|
100339
102056
|
const m = Math.ceil(seconds / 60);
|
|
100340
102057
|
return t(`${m} min left`, `${m} min rimanenti`);
|
|
@@ -100692,6 +102409,15 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
100692
102409
|
status: null,
|
|
100693
102410
|
controls: volume
|
|
100694
102411
|
});
|
|
102412
|
+
if (view.channel !== null) {
|
|
102413
|
+
const channel = view.channel.current;
|
|
102414
|
+
rows.push({
|
|
102415
|
+
id: "channel",
|
|
102416
|
+
icon: "tv",
|
|
102417
|
+
status: channel === null ? null : t(channel, channel),
|
|
102418
|
+
controls: [asAction(action("channel.down", t("Channel down", "Canale giù"), "chevron-down", "media-player", "channelDown")), asAction(action("channel.up", t("Channel up", "Canale su"), "chevron-up", "media-player", "channelUp"))]
|
|
102419
|
+
});
|
|
102420
|
+
}
|
|
100695
102421
|
if (view.source !== null) {
|
|
100696
102422
|
const current = view.source.current === "" ? null : view.source.current;
|
|
100697
102423
|
rows.push({
|
|
@@ -100752,7 +102478,13 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
100752
102478
|
powerSourceContribution,
|
|
100753
102479
|
remoteContribution,
|
|
100754
102480
|
consumablesContribution,
|
|
100755
|
-
dishwasherContribution
|
|
102481
|
+
dishwasherContribution,
|
|
102482
|
+
...Object.values(ACCESS_FAMILY_CONTRIBUTIONS),
|
|
102483
|
+
...Object.values(DEVICES_FAMILY_CONTRIBUTIONS),
|
|
102484
|
+
...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
|
|
102485
|
+
...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
|
|
102486
|
+
...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
|
|
102487
|
+
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
|
|
100756
102488
|
];
|
|
100757
102489
|
//#endregion
|
|
100758
102490
|
//#region src/device/hero/hero-layout.ts
|
|
@@ -100773,7 +102505,9 @@ var MEDIA_PLAYER_LAYOUT = { rows: [
|
|
|
100773
102505
|
"now-playing",
|
|
100774
102506
|
"playback",
|
|
100775
102507
|
"volume",
|
|
100776
|
-
"
|
|
102508
|
+
"channel",
|
|
102509
|
+
"source",
|
|
102510
|
+
"do-not-disturb"
|
|
100777
102511
|
] };
|
|
100778
102512
|
var APPLIANCE_LAYOUT = { rows: ["cycle"] };
|
|
100779
102513
|
/** Its Home Connect PowerState is a secondary row action, never the own-power slot. */
|
|
@@ -100782,40 +102516,66 @@ var DISHWASHER_LAYOUT = { rows: [
|
|
|
100782
102516
|
"program",
|
|
100783
102517
|
"appliance-power"
|
|
100784
102518
|
] };
|
|
102519
|
+
var CLIMATE_LAYOUT = { rows: [
|
|
102520
|
+
"climate-mode",
|
|
102521
|
+
"climate-fan",
|
|
102522
|
+
"setpoint"
|
|
102523
|
+
] };
|
|
100785
102524
|
var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
|
|
102525
|
+
var LOCK_LAYOUT = { rows: ["lock"] };
|
|
102526
|
+
var ALARM_LAYOUT = { rows: ["alarm"] };
|
|
102527
|
+
var FAN_LAYOUT = { rows: ["fan"] };
|
|
102528
|
+
var VACUUM_LAYOUT = { rows: ["vacuum"] };
|
|
102529
|
+
var MOWER_LAYOUT = { rows: ["mower"] };
|
|
102530
|
+
var FEEDER_LAYOUT = { rows: ["feeder"] };
|
|
102531
|
+
var FOUNTAIN_LAYOUT = { rows: ["fountain", "pump-cycle"] };
|
|
102532
|
+
var AUTOMATION_LAYOUT = { rows: ["automation"] };
|
|
102533
|
+
var SCRIPT_LAYOUT = { rows: ["script"] };
|
|
102534
|
+
var LIGHT_LAYOUT = { rows: [
|
|
102535
|
+
"brightness",
|
|
102536
|
+
"color",
|
|
102537
|
+
"contact",
|
|
102538
|
+
"motion-trigger"
|
|
102539
|
+
] };
|
|
102540
|
+
var COVER_LAYOUT = { rows: ["cover"] };
|
|
102541
|
+
var VALVE_LAYOUT = { rows: ["valve"] };
|
|
102542
|
+
var HUMIDIFIER_LAYOUT = { rows: ["humidifier"] };
|
|
102543
|
+
var UPDATE_LAYOUT = { rows: ["update"] };
|
|
102544
|
+
var CONTROL_LAYOUT = { rows: ["control"] };
|
|
102545
|
+
var BUTTON_LAYOUT = { rows: ["button"] };
|
|
100786
102546
|
var HERO_LAYOUT_BY_TYPE = {
|
|
100787
102547
|
[DeviceType.Camera]: HERO_LAYOUT_DEFAULT,
|
|
100788
102548
|
[DeviceType.Hub]: HERO_LAYOUT_DEFAULT,
|
|
100789
|
-
[DeviceType.Light]:
|
|
102549
|
+
[DeviceType.Light]: LIGHT_LAYOUT,
|
|
100790
102550
|
[DeviceType.Siren]: HERO_LAYOUT_DEFAULT,
|
|
100791
102551
|
[DeviceType.Switch]: SWITCH_LAYOUT,
|
|
100792
102552
|
[DeviceType.Sensor]: HERO_LAYOUT_DEFAULT,
|
|
100793
|
-
[DeviceType.Thermostat]:
|
|
100794
|
-
[DeviceType.Climate]:
|
|
100795
|
-
[DeviceType.Button]:
|
|
102553
|
+
[DeviceType.Thermostat]: CLIMATE_LAYOUT,
|
|
102554
|
+
[DeviceType.Climate]: CLIMATE_LAYOUT,
|
|
102555
|
+
[DeviceType.Button]: BUTTON_LAYOUT,
|
|
100796
102556
|
[DeviceType.EventEmitter]: HERO_LAYOUT_DEFAULT,
|
|
100797
|
-
[DeviceType.Update]:
|
|
102557
|
+
[DeviceType.Update]: UPDATE_LAYOUT,
|
|
100798
102558
|
[DeviceType.Generic]: HERO_LAYOUT_DEFAULT,
|
|
100799
102559
|
[DeviceType.Notifier]: HERO_LAYOUT_DEFAULT,
|
|
100800
|
-
[DeviceType.Script]:
|
|
100801
|
-
[DeviceType.Automation]:
|
|
100802
|
-
[DeviceType.Lock]:
|
|
100803
|
-
[DeviceType.Cover]:
|
|
100804
|
-
[DeviceType.Valve]:
|
|
100805
|
-
[DeviceType.Humidifier]:
|
|
100806
|
-
[DeviceType.WaterHeater]:
|
|
100807
|
-
[DeviceType.Fan]:
|
|
102560
|
+
[DeviceType.Script]: SCRIPT_LAYOUT,
|
|
102561
|
+
[DeviceType.Automation]: AUTOMATION_LAYOUT,
|
|
102562
|
+
[DeviceType.Lock]: LOCK_LAYOUT,
|
|
102563
|
+
[DeviceType.Cover]: COVER_LAYOUT,
|
|
102564
|
+
[DeviceType.Valve]: VALVE_LAYOUT,
|
|
102565
|
+
[DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
|
|
102566
|
+
[DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
102567
|
+
[DeviceType.Fan]: FAN_LAYOUT,
|
|
100808
102568
|
[DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
100809
|
-
[DeviceType.AlarmPanel]:
|
|
100810
|
-
[DeviceType.Control]:
|
|
102569
|
+
[DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
102570
|
+
[DeviceType.Control]: CONTROL_LAYOUT,
|
|
100811
102571
|
[DeviceType.Presence]: HERO_LAYOUT_DEFAULT,
|
|
100812
102572
|
[DeviceType.Weather]: HERO_LAYOUT_DEFAULT,
|
|
100813
|
-
[DeviceType.Vacuum]:
|
|
100814
|
-
[DeviceType.LawnMower]:
|
|
102573
|
+
[DeviceType.Vacuum]: VACUUM_LAYOUT,
|
|
102574
|
+
[DeviceType.LawnMower]: MOWER_LAYOUT,
|
|
100815
102575
|
[DeviceType.Container]: HERO_LAYOUT_DEFAULT,
|
|
100816
102576
|
[DeviceType.Image]: HERO_LAYOUT_DEFAULT,
|
|
100817
|
-
[DeviceType.PetFeeder]:
|
|
100818
|
-
[DeviceType.PetFountain]:
|
|
102577
|
+
[DeviceType.PetFeeder]: FEEDER_LAYOUT,
|
|
102578
|
+
[DeviceType.PetFountain]: FOUNTAIN_LAYOUT,
|
|
100819
102579
|
[DeviceType.Dishwasher]: DISHWASHER_LAYOUT,
|
|
100820
102580
|
[DeviceType.Washer]: APPLIANCE_LAYOUT,
|
|
100821
102581
|
[DeviceType.Heater]: HEATER_LAYOUT,
|
|
@@ -101004,25 +102764,413 @@ var DISHWASHER_LOOK = lookOf({
|
|
|
101004
102764
|
idle: INFO,
|
|
101005
102765
|
standby: WARN
|
|
101006
102766
|
});
|
|
101007
|
-
|
|
101008
|
-
|
|
102767
|
+
/** A sensor that reads Clear or Detected: calm when clear, an alarm when it trips. */
|
|
102768
|
+
function sensorLook(icon, alertIcon = icon) {
|
|
102769
|
+
return lookOf({
|
|
102770
|
+
icon,
|
|
102771
|
+
on: [
|
|
102772
|
+
"primary",
|
|
102773
|
+
"glow",
|
|
102774
|
+
"halo"
|
|
102775
|
+
],
|
|
102776
|
+
off: MUTED,
|
|
102777
|
+
running: [
|
|
102778
|
+
"primary",
|
|
102779
|
+
"glow",
|
|
102780
|
+
"halo"
|
|
102781
|
+
],
|
|
102782
|
+
idle: [
|
|
102783
|
+
"success",
|
|
102784
|
+
"plain",
|
|
102785
|
+
"none"
|
|
102786
|
+
],
|
|
102787
|
+
standby: WARN,
|
|
102788
|
+
alert: look(alertIcon, "danger", "alert-wash", "pulse")
|
|
102789
|
+
});
|
|
102790
|
+
}
|
|
102791
|
+
var LEAK_LOOK = sensorLook("droplets");
|
|
102792
|
+
var SMOKE_LOOK = sensorLook("flame");
|
|
102793
|
+
var GAS_LOOK = sensorLook("wind");
|
|
102794
|
+
var TAMPER_LOOK = sensorLook("shield-alert");
|
|
102795
|
+
var VIBRATION_LOOK = sensorLook("vibrate");
|
|
102796
|
+
var MOTION_LOOK = sensorLook("radar", "triangle-alert");
|
|
102797
|
+
var DOORBELL_LOOK = sensorLook("bell-ring");
|
|
102798
|
+
/** A camera is a camera: never a power glyph, whatever its motion reads. */
|
|
102799
|
+
var CAMERA_LOOK = sensorLook("video", "triangle-alert");
|
|
102800
|
+
/** A bulb glows while lit. */
|
|
102801
|
+
var LIGHT_LOOK = lookOf({
|
|
102802
|
+
icon: "lightbulb",
|
|
101009
102803
|
on: [
|
|
101010
|
-
"
|
|
102804
|
+
"warning",
|
|
102805
|
+
"glow",
|
|
102806
|
+
"glow"
|
|
102807
|
+
],
|
|
102808
|
+
off: MUTED,
|
|
102809
|
+
running: [
|
|
102810
|
+
"warning",
|
|
102811
|
+
"glow",
|
|
102812
|
+
"glow"
|
|
102813
|
+
],
|
|
102814
|
+
idle: INFO,
|
|
102815
|
+
standby: WARN
|
|
102816
|
+
});
|
|
102817
|
+
/** Closed is a position, not an absence of power: the blind keeps its glyph and goes quiet. */
|
|
102818
|
+
var COVER_LOOK = lookOf({
|
|
102819
|
+
icon: "blinds",
|
|
102820
|
+
on: [
|
|
102821
|
+
"primary",
|
|
102822
|
+
"plain",
|
|
102823
|
+
"none"
|
|
102824
|
+
],
|
|
102825
|
+
off: MUTED,
|
|
102826
|
+
running: [
|
|
102827
|
+
"primary",
|
|
102828
|
+
"plain",
|
|
102829
|
+
"pulse"
|
|
102830
|
+
],
|
|
102831
|
+
idle: INFO,
|
|
102832
|
+
standby: WARN
|
|
102833
|
+
});
|
|
102834
|
+
var VALVE_LOOK = lookOf({
|
|
102835
|
+
icon: "droplet",
|
|
102836
|
+
on: [
|
|
102837
|
+
"primary",
|
|
101011
102838
|
"water",
|
|
101012
102839
|
"wave"
|
|
101013
102840
|
],
|
|
101014
102841
|
off: MUTED,
|
|
101015
102842
|
running: [
|
|
101016
|
-
"
|
|
102843
|
+
"primary",
|
|
101017
102844
|
"water",
|
|
102845
|
+
"pulse"
|
|
102846
|
+
],
|
|
102847
|
+
idle: INFO,
|
|
102848
|
+
standby: WARN
|
|
102849
|
+
});
|
|
102850
|
+
var HUMIDIFIER_LOOK = lookOf({
|
|
102851
|
+
icon: "droplets",
|
|
102852
|
+
on: [
|
|
102853
|
+
"info",
|
|
102854
|
+
"mist",
|
|
102855
|
+
"breathe"
|
|
102856
|
+
],
|
|
102857
|
+
off: MUTED,
|
|
102858
|
+
running: [
|
|
102859
|
+
"info",
|
|
102860
|
+
"mist",
|
|
101018
102861
|
"wave"
|
|
101019
102862
|
],
|
|
101020
102863
|
idle: INFO,
|
|
101021
|
-
standby: WARN
|
|
101022
|
-
alert: look("droplets", "danger", "alert-wash", "pulse")
|
|
102864
|
+
standby: WARN
|
|
101023
102865
|
});
|
|
101024
|
-
var
|
|
101025
|
-
icon: "
|
|
102866
|
+
var CONTROL_LOOK = lookOf({
|
|
102867
|
+
icon: "sliders-horizontal",
|
|
102868
|
+
on: [
|
|
102869
|
+
"primary",
|
|
102870
|
+
"plain",
|
|
102871
|
+
"none"
|
|
102872
|
+
],
|
|
102873
|
+
off: MUTED,
|
|
102874
|
+
running: [
|
|
102875
|
+
"primary",
|
|
102876
|
+
"plain",
|
|
102877
|
+
"pulse"
|
|
102878
|
+
],
|
|
102879
|
+
idle: INFO,
|
|
102880
|
+
standby: WARN
|
|
102881
|
+
});
|
|
102882
|
+
var PRESENCE_LOOK = lookOf({
|
|
102883
|
+
icon: "map-pin",
|
|
102884
|
+
on: [
|
|
102885
|
+
"success",
|
|
102886
|
+
"plain",
|
|
102887
|
+
"none"
|
|
102888
|
+
],
|
|
102889
|
+
off: MUTED,
|
|
102890
|
+
running: [
|
|
102891
|
+
"primary",
|
|
102892
|
+
"plain",
|
|
102893
|
+
"pulse"
|
|
102894
|
+
],
|
|
102895
|
+
idle: INFO,
|
|
102896
|
+
standby: WARN
|
|
102897
|
+
});
|
|
102898
|
+
var WEATHER_LOOK = lookOf({
|
|
102899
|
+
icon: "cloud-sun",
|
|
102900
|
+
on: [
|
|
102901
|
+
"info",
|
|
102902
|
+
"sky",
|
|
102903
|
+
"none"
|
|
102904
|
+
],
|
|
102905
|
+
off: MUTED,
|
|
102906
|
+
running: [
|
|
102907
|
+
"info",
|
|
102908
|
+
"sky",
|
|
102909
|
+
"none"
|
|
102910
|
+
],
|
|
102911
|
+
idle: INFO,
|
|
102912
|
+
standby: WARN
|
|
102913
|
+
});
|
|
102914
|
+
/** An update waits (warning), runs (pulse) or is done (calm). */
|
|
102915
|
+
var UPDATE_LOOK = lookOf({
|
|
102916
|
+
icon: "download",
|
|
102917
|
+
on: [
|
|
102918
|
+
"success",
|
|
102919
|
+
"plain",
|
|
102920
|
+
"none"
|
|
102921
|
+
],
|
|
102922
|
+
off: MUTED,
|
|
102923
|
+
running: [
|
|
102924
|
+
"primary",
|
|
102925
|
+
"plain",
|
|
102926
|
+
"pulse"
|
|
102927
|
+
],
|
|
102928
|
+
idle: [
|
|
102929
|
+
"success",
|
|
102930
|
+
"plain",
|
|
102931
|
+
"none"
|
|
102932
|
+
],
|
|
102933
|
+
standby: [
|
|
102934
|
+
"warning",
|
|
102935
|
+
"plain",
|
|
102936
|
+
"pulse"
|
|
102937
|
+
]
|
|
102938
|
+
});
|
|
102939
|
+
var BUTTON_LOOK = lookOf({
|
|
102940
|
+
icon: "pointer",
|
|
102941
|
+
on: [
|
|
102942
|
+
"primary",
|
|
102943
|
+
"plain",
|
|
102944
|
+
"none"
|
|
102945
|
+
],
|
|
102946
|
+
off: MUTED,
|
|
102947
|
+
running: [
|
|
102948
|
+
"primary",
|
|
102949
|
+
"plain",
|
|
102950
|
+
"pulse"
|
|
102951
|
+
],
|
|
102952
|
+
idle: INFO,
|
|
102953
|
+
standby: WARN
|
|
102954
|
+
});
|
|
102955
|
+
var IMAGE_LOOK = lookOf({
|
|
102956
|
+
icon: "image",
|
|
102957
|
+
on: [
|
|
102958
|
+
"primary",
|
|
102959
|
+
"plain",
|
|
102960
|
+
"none"
|
|
102961
|
+
],
|
|
102962
|
+
off: MUTED,
|
|
102963
|
+
running: [
|
|
102964
|
+
"primary",
|
|
102965
|
+
"plain",
|
|
102966
|
+
"pulse"
|
|
102967
|
+
],
|
|
102968
|
+
idle: INFO,
|
|
102969
|
+
standby: WARN
|
|
102970
|
+
});
|
|
102971
|
+
/** A lock is secure when locked, and says so when it is not. */
|
|
102972
|
+
var LOCK_LOOK = {
|
|
102973
|
+
...lookOf({
|
|
102974
|
+
icon: "lock",
|
|
102975
|
+
on: [
|
|
102976
|
+
"success",
|
|
102977
|
+
"plain",
|
|
102978
|
+
"none"
|
|
102979
|
+
],
|
|
102980
|
+
off: MUTED,
|
|
102981
|
+
running: [
|
|
102982
|
+
"primary",
|
|
102983
|
+
"plain",
|
|
102984
|
+
"pulse"
|
|
102985
|
+
],
|
|
102986
|
+
idle: INFO,
|
|
102987
|
+
standby: WARN
|
|
102988
|
+
}),
|
|
102989
|
+
standby: look("lock-open", "warning", "plain", "none"),
|
|
102990
|
+
off: look("lock-open", "muted", "plain", "none")
|
|
102991
|
+
};
|
|
102992
|
+
/** The shield glows while armed, blinks red in alarm and goes quiet when disarmed. */
|
|
102993
|
+
var ALARM_LOOK = {
|
|
102994
|
+
...lookOf({
|
|
102995
|
+
icon: "shield-check",
|
|
102996
|
+
on: [
|
|
102997
|
+
"success",
|
|
102998
|
+
"glow",
|
|
102999
|
+
"halo"
|
|
103000
|
+
],
|
|
103001
|
+
off: MUTED,
|
|
103002
|
+
running: [
|
|
103003
|
+
"primary",
|
|
103004
|
+
"plain",
|
|
103005
|
+
"pulse"
|
|
103006
|
+
],
|
|
103007
|
+
idle: INFO,
|
|
103008
|
+
standby: WARN
|
|
103009
|
+
}),
|
|
103010
|
+
off: look("shield-off", "muted", "plain", "none"),
|
|
103011
|
+
standby: look("shield", "warning", "plain", "pulse"),
|
|
103012
|
+
alert: look("shield-alert", "danger", "alert-wash", "blink")
|
|
103013
|
+
};
|
|
103014
|
+
/** Blades turn only while air moves. */
|
|
103015
|
+
var FAN_LOOK = lookOf({
|
|
103016
|
+
icon: "fan",
|
|
103017
|
+
on: [
|
|
103018
|
+
"success",
|
|
103019
|
+
"plain",
|
|
103020
|
+
"none"
|
|
103021
|
+
],
|
|
103022
|
+
off: MUTED,
|
|
103023
|
+
running: [
|
|
103024
|
+
"primary",
|
|
103025
|
+
"mist",
|
|
103026
|
+
"spin"
|
|
103027
|
+
],
|
|
103028
|
+
idle: INFO,
|
|
103029
|
+
standby: WARN
|
|
103030
|
+
});
|
|
103031
|
+
var VACUUM_LOOK = lookOf({
|
|
103032
|
+
icon: "bot",
|
|
103033
|
+
on: [
|
|
103034
|
+
"success",
|
|
103035
|
+
"plain",
|
|
103036
|
+
"none"
|
|
103037
|
+
],
|
|
103038
|
+
off: MUTED,
|
|
103039
|
+
running: [
|
|
103040
|
+
"primary",
|
|
103041
|
+
"plain",
|
|
103042
|
+
"pulse"
|
|
103043
|
+
],
|
|
103044
|
+
idle: INFO,
|
|
103045
|
+
standby: WARN
|
|
103046
|
+
});
|
|
103047
|
+
var MOWER_LOOK = lookOf({
|
|
103048
|
+
icon: "sprout",
|
|
103049
|
+
on: [
|
|
103050
|
+
"success",
|
|
103051
|
+
"plain",
|
|
103052
|
+
"none"
|
|
103053
|
+
],
|
|
103054
|
+
off: MUTED,
|
|
103055
|
+
running: [
|
|
103056
|
+
"primary",
|
|
103057
|
+
"plain",
|
|
103058
|
+
"pulse"
|
|
103059
|
+
],
|
|
103060
|
+
idle: INFO,
|
|
103061
|
+
standby: WARN
|
|
103062
|
+
});
|
|
103063
|
+
var FEEDER_LOOK = lookOf({
|
|
103064
|
+
icon: "bone",
|
|
103065
|
+
on: [
|
|
103066
|
+
"success",
|
|
103067
|
+
"plain",
|
|
103068
|
+
"none"
|
|
103069
|
+
],
|
|
103070
|
+
off: MUTED,
|
|
103071
|
+
running: [
|
|
103072
|
+
"primary",
|
|
103073
|
+
"plain",
|
|
103074
|
+
"pulse"
|
|
103075
|
+
],
|
|
103076
|
+
idle: INFO,
|
|
103077
|
+
standby: WARN
|
|
103078
|
+
});
|
|
103079
|
+
var FOUNTAIN_LOOK = lookOf({
|
|
103080
|
+
icon: "droplets",
|
|
103081
|
+
on: [
|
|
103082
|
+
"success",
|
|
103083
|
+
"plain",
|
|
103084
|
+
"none"
|
|
103085
|
+
],
|
|
103086
|
+
off: MUTED,
|
|
103087
|
+
running: [
|
|
103088
|
+
"primary",
|
|
103089
|
+
"water",
|
|
103090
|
+
"wave"
|
|
103091
|
+
],
|
|
103092
|
+
idle: INFO,
|
|
103093
|
+
standby: WARN
|
|
103094
|
+
});
|
|
103095
|
+
var AUTOMATION_LOOK = lookOf({
|
|
103096
|
+
icon: "workflow",
|
|
103097
|
+
on: [
|
|
103098
|
+
"success",
|
|
103099
|
+
"plain",
|
|
103100
|
+
"none"
|
|
103101
|
+
],
|
|
103102
|
+
off: MUTED,
|
|
103103
|
+
running: [
|
|
103104
|
+
"primary",
|
|
103105
|
+
"plain",
|
|
103106
|
+
"pulse"
|
|
103107
|
+
],
|
|
103108
|
+
idle: INFO,
|
|
103109
|
+
standby: WARN
|
|
103110
|
+
});
|
|
103111
|
+
var SCRIPT_LOOK = lookOf({
|
|
103112
|
+
icon: "scroll-text",
|
|
103113
|
+
on: [
|
|
103114
|
+
"success",
|
|
103115
|
+
"plain",
|
|
103116
|
+
"none"
|
|
103117
|
+
],
|
|
103118
|
+
off: MUTED,
|
|
103119
|
+
running: [
|
|
103120
|
+
"primary",
|
|
103121
|
+
"plain",
|
|
103122
|
+
"pulse"
|
|
103123
|
+
],
|
|
103124
|
+
idle: INFO,
|
|
103125
|
+
standby: WARN
|
|
103126
|
+
});
|
|
103127
|
+
var EVENT_EMITTER_LOOK = lookOf({
|
|
103128
|
+
icon: "radio-tower",
|
|
103129
|
+
on: [
|
|
103130
|
+
"success",
|
|
103131
|
+
"plain",
|
|
103132
|
+
"none"
|
|
103133
|
+
],
|
|
103134
|
+
off: MUTED,
|
|
103135
|
+
running: [
|
|
103136
|
+
"primary",
|
|
103137
|
+
"plain",
|
|
103138
|
+
"pulse"
|
|
103139
|
+
],
|
|
103140
|
+
idle: INFO,
|
|
103141
|
+
standby: WARN
|
|
103142
|
+
});
|
|
103143
|
+
/** A reading device: the value is the headline, the look only says what kind of reading it is. */
|
|
103144
|
+
function readingLook(icon, tone) {
|
|
103145
|
+
return lookOf({
|
|
103146
|
+
icon,
|
|
103147
|
+
on: [
|
|
103148
|
+
tone,
|
|
103149
|
+
"plain",
|
|
103150
|
+
"none"
|
|
103151
|
+
],
|
|
103152
|
+
off: MUTED,
|
|
103153
|
+
running: [
|
|
103154
|
+
tone,
|
|
103155
|
+
"plain",
|
|
103156
|
+
"none"
|
|
103157
|
+
],
|
|
103158
|
+
idle: [
|
|
103159
|
+
tone,
|
|
103160
|
+
"plain",
|
|
103161
|
+
"none"
|
|
103162
|
+
],
|
|
103163
|
+
standby: MUTED
|
|
103164
|
+
});
|
|
103165
|
+
}
|
|
103166
|
+
var READING_SENSOR_LOOK = readingLook("gauge", "info");
|
|
103167
|
+
var TEMPERATURE_LOOK = readingLook("thermometer", "info");
|
|
103168
|
+
var HUMIDITY_LOOK = readingLook("droplets", "info");
|
|
103169
|
+
var AIR_QUALITY_LOOK = readingLook("wind", "success");
|
|
103170
|
+
var LIGHT_SENSOR_LOOK = readingLook("sun", "warning");
|
|
103171
|
+
/** Carbon monoxide: calm is a shield, detected is the alarm. */
|
|
103172
|
+
var CO_LOOK = lookOf({
|
|
103173
|
+
icon: "shield-check",
|
|
101026
103174
|
on: [
|
|
101027
103175
|
"danger",
|
|
101028
103176
|
"alert-wash",
|
|
@@ -101034,43 +103182,109 @@ var SMOKE_LOOK = lookOf({
|
|
|
101034
103182
|
"alert-wash",
|
|
101035
103183
|
"pulse"
|
|
101036
103184
|
],
|
|
103185
|
+
idle: [
|
|
103186
|
+
"success",
|
|
103187
|
+
"plain",
|
|
103188
|
+
"none"
|
|
103189
|
+
],
|
|
103190
|
+
standby: MUTED,
|
|
103191
|
+
alert: look("triangle-alert", "danger", "alert-wash", "pulse")
|
|
103192
|
+
});
|
|
103193
|
+
/** Heating and cooling devices: the mode (see {@link HERO_MODE_LOOK}) picks the picture while on. */
|
|
103194
|
+
var THERMOSTAT_LOOK = lookOf({
|
|
103195
|
+
icon: "thermometer",
|
|
103196
|
+
on: [
|
|
103197
|
+
"primary",
|
|
103198
|
+
"plain",
|
|
103199
|
+
"none"
|
|
103200
|
+
],
|
|
103201
|
+
off: MUTED,
|
|
103202
|
+
running: [
|
|
103203
|
+
"warning",
|
|
103204
|
+
"heat-rise",
|
|
103205
|
+
"rise"
|
|
103206
|
+
],
|
|
103207
|
+
idle: INFO,
|
|
103208
|
+
standby: MUTED
|
|
103209
|
+
});
|
|
103210
|
+
var CLIMATE_LOOK = lookOf({
|
|
103211
|
+
icon: "snowflake",
|
|
103212
|
+
on: [
|
|
103213
|
+
"primary",
|
|
103214
|
+
"plain",
|
|
103215
|
+
"none"
|
|
103216
|
+
],
|
|
103217
|
+
off: MUTED,
|
|
103218
|
+
running: [
|
|
103219
|
+
"primary",
|
|
103220
|
+
"plain",
|
|
103221
|
+
"none"
|
|
103222
|
+
],
|
|
103223
|
+
idle: INFO,
|
|
103224
|
+
standby: MUTED
|
|
103225
|
+
});
|
|
103226
|
+
var WATER_HEATER_LOOK = lookOf({
|
|
103227
|
+
icon: "thermometer-sun",
|
|
103228
|
+
on: [
|
|
103229
|
+
"warning",
|
|
103230
|
+
"heat-rise",
|
|
103231
|
+
"rise"
|
|
103232
|
+
],
|
|
103233
|
+
off: MUTED,
|
|
103234
|
+
running: [
|
|
103235
|
+
"warning",
|
|
103236
|
+
"heat-rise",
|
|
103237
|
+
"rise"
|
|
103238
|
+
],
|
|
101037
103239
|
idle: INFO,
|
|
101038
|
-
standby:
|
|
101039
|
-
alert: look("flame", "danger", "alert-wash", "pulse")
|
|
103240
|
+
standby: MUTED
|
|
101040
103241
|
});
|
|
103242
|
+
/** What a climate device draws while it is on, by mode: warm air rises, cold falls, drops dry, the fan spins. */
|
|
103243
|
+
var HERO_MODE_LOOK = {
|
|
103244
|
+
heat: look("flame", "warning", "heat-rise", "rise"),
|
|
103245
|
+
cool: look("snowflake", "info", "cool-fall", "fall"),
|
|
103246
|
+
dry: look("droplets", "info", "water", "wave"),
|
|
103247
|
+
fan: look("fan", "primary", "plain", "spin"),
|
|
103248
|
+
auto: look("thermometer", "success", "glow", "glow"),
|
|
103249
|
+
playing: null,
|
|
103250
|
+
paused: null,
|
|
103251
|
+
open: null,
|
|
103252
|
+
closed: null
|
|
103253
|
+
};
|
|
103254
|
+
var MODE_LOOK_TYPES = [DeviceType.Climate, DeviceType.Thermostat];
|
|
101041
103255
|
var HERO_LOOK_BY_TYPE = {
|
|
101042
|
-
[DeviceType.Camera]:
|
|
103256
|
+
[DeviceType.Camera]: CAMERA_LOOK,
|
|
101043
103257
|
[DeviceType.Hub]: HERO_LOOK_DEFAULT,
|
|
101044
|
-
[DeviceType.Light]:
|
|
103258
|
+
[DeviceType.Light]: LIGHT_LOOK,
|
|
101045
103259
|
[DeviceType.Siren]: HERO_LOOK_DEFAULT,
|
|
101046
103260
|
[DeviceType.Switch]: SWITCH_LOOK,
|
|
101047
|
-
[DeviceType.Sensor]:
|
|
101048
|
-
[DeviceType.Thermostat]:
|
|
101049
|
-
[DeviceType.Climate]:
|
|
101050
|
-
[DeviceType.Button]:
|
|
101051
|
-
[DeviceType.EventEmitter]:
|
|
101052
|
-
[DeviceType.Update]:
|
|
103261
|
+
[DeviceType.Sensor]: READING_SENSOR_LOOK,
|
|
103262
|
+
[DeviceType.Thermostat]: THERMOSTAT_LOOK,
|
|
103263
|
+
[DeviceType.Climate]: CLIMATE_LOOK,
|
|
103264
|
+
[DeviceType.Button]: BUTTON_LOOK,
|
|
103265
|
+
[DeviceType.EventEmitter]: EVENT_EMITTER_LOOK,
|
|
103266
|
+
[DeviceType.Update]: UPDATE_LOOK,
|
|
101053
103267
|
[DeviceType.Generic]: HERO_LOOK_DEFAULT,
|
|
101054
103268
|
[DeviceType.Notifier]: HERO_LOOK_DEFAULT,
|
|
101055
|
-
[DeviceType.Script]:
|
|
101056
|
-
[DeviceType.Automation]:
|
|
101057
|
-
[DeviceType.Lock]:
|
|
101058
|
-
[DeviceType.Cover]:
|
|
101059
|
-
[DeviceType.Valve]:
|
|
101060
|
-
[DeviceType.Humidifier]:
|
|
101061
|
-
[DeviceType.WaterHeater]:
|
|
101062
|
-
[DeviceType.Fan]:
|
|
103269
|
+
[DeviceType.Script]: SCRIPT_LOOK,
|
|
103270
|
+
[DeviceType.Automation]: AUTOMATION_LOOK,
|
|
103271
|
+
[DeviceType.Lock]: LOCK_LOOK,
|
|
103272
|
+
[DeviceType.Cover]: COVER_LOOK,
|
|
103273
|
+
[DeviceType.Valve]: VALVE_LOOK,
|
|
103274
|
+
[DeviceType.Humidifier]: HUMIDIFIER_LOOK,
|
|
103275
|
+
[DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
103276
|
+
[DeviceType.Fan]: FAN_LOOK,
|
|
101063
103277
|
[DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
101064
|
-
[DeviceType.AlarmPanel]:
|
|
101065
|
-
[DeviceType.Control]:
|
|
101066
|
-
[DeviceType.Presence]:
|
|
101067
|
-
[DeviceType.Weather]:
|
|
101068
|
-
[DeviceType.Vacuum]:
|
|
101069
|
-
[DeviceType.LawnMower]:
|
|
103278
|
+
[DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
103279
|
+
[DeviceType.Control]: CONTROL_LOOK,
|
|
103280
|
+
[DeviceType.Presence]: PRESENCE_LOOK,
|
|
103281
|
+
[DeviceType.Weather]: WEATHER_LOOK,
|
|
103282
|
+
[DeviceType.Vacuum]: VACUUM_LOOK,
|
|
103283
|
+
[DeviceType.LawnMower]: MOWER_LOOK,
|
|
101070
103284
|
[DeviceType.Container]: HERO_LOOK_DEFAULT,
|
|
101071
|
-
[DeviceType.Image]:
|
|
101072
|
-
[DeviceType.PetFeeder]:
|
|
101073
|
-
[DeviceType.PetFountain]:
|
|
103285
|
+
[DeviceType.Image]: IMAGE_LOOK,
|
|
103286
|
+
[DeviceType.PetFeeder]: FEEDER_LOOK,
|
|
103287
|
+
[DeviceType.PetFountain]: FOUNTAIN_LOOK,
|
|
101074
103288
|
[DeviceType.Dishwasher]: DISHWASHER_LOOK,
|
|
101075
103289
|
[DeviceType.Washer]: WASHER_LOOK,
|
|
101076
103290
|
[DeviceType.Heater]: HEATER_LOOK,
|
|
@@ -101082,12 +103296,12 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101082
103296
|
[DeviceRole.Siren]: "inherit",
|
|
101083
103297
|
[DeviceRole.Floodlight]: "inherit",
|
|
101084
103298
|
[DeviceRole.Spotlight]: "inherit",
|
|
101085
|
-
[DeviceRole.PirSensor]:
|
|
103299
|
+
[DeviceRole.PirSensor]: MOTION_LOOK,
|
|
101086
103300
|
[DeviceRole.Chime]: "inherit",
|
|
101087
103301
|
[DeviceRole.Autotrack]: "inherit",
|
|
101088
103302
|
[DeviceRole.Nightvision]: "inherit",
|
|
101089
103303
|
[DeviceRole.PrivacyMask]: "inherit",
|
|
101090
|
-
[DeviceRole.Doorbell]:
|
|
103304
|
+
[DeviceRole.Doorbell]: DOORBELL_LOOK,
|
|
101091
103305
|
[DeviceRole.CoverBlind]: "inherit",
|
|
101092
103306
|
[DeviceRole.CoverShutter]: "inherit",
|
|
101093
103307
|
[DeviceRole.CoverAwning]: "inherit",
|
|
@@ -101098,21 +103312,21 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101098
103312
|
[DeviceRole.CoverWindow]: "inherit",
|
|
101099
103313
|
[DeviceRole.BinaryHelper]: "inherit",
|
|
101100
103314
|
[DeviceRole.Outlet]: "inherit",
|
|
101101
|
-
[DeviceRole.MotionSensor]:
|
|
103315
|
+
[DeviceRole.MotionSensor]: MOTION_LOOK,
|
|
101102
103316
|
[DeviceRole.ContactSensor]: "inherit",
|
|
101103
103317
|
[DeviceRole.LeakSensor]: LEAK_LOOK,
|
|
101104
103318
|
[DeviceRole.SmokeSensor]: SMOKE_LOOK,
|
|
101105
|
-
[DeviceRole.COSensor]:
|
|
101106
|
-
[DeviceRole.GasSensor]:
|
|
101107
|
-
[DeviceRole.TamperSensor]:
|
|
101108
|
-
[DeviceRole.VibrationSensor]:
|
|
103319
|
+
[DeviceRole.COSensor]: CO_LOOK,
|
|
103320
|
+
[DeviceRole.GasSensor]: GAS_LOOK,
|
|
103321
|
+
[DeviceRole.TamperSensor]: TAMPER_LOOK,
|
|
103322
|
+
[DeviceRole.VibrationSensor]: VIBRATION_LOOK,
|
|
101109
103323
|
[DeviceRole.ConnectivitySensor]: "inherit",
|
|
101110
103324
|
[DeviceRole.SoundSensor]: "inherit",
|
|
101111
103325
|
[DeviceRole.BinarySensor]: "inherit",
|
|
101112
|
-
[DeviceRole.TemperatureSensor]:
|
|
101113
|
-
[DeviceRole.HumiditySensor]:
|
|
101114
|
-
[DeviceRole.AmbientLightSensor]:
|
|
101115
|
-
[DeviceRole.PressureSensor]:
|
|
103326
|
+
[DeviceRole.TemperatureSensor]: TEMPERATURE_LOOK,
|
|
103327
|
+
[DeviceRole.HumiditySensor]: HUMIDITY_LOOK,
|
|
103328
|
+
[DeviceRole.AmbientLightSensor]: LIGHT_SENSOR_LOOK,
|
|
103329
|
+
[DeviceRole.PressureSensor]: READING_SENSOR_LOOK,
|
|
101116
103330
|
[DeviceRole.WindSensor]: "inherit",
|
|
101117
103331
|
[DeviceRole.RainSensor]: "inherit",
|
|
101118
103332
|
[DeviceRole.UvSensor]: "inherit",
|
|
@@ -101122,7 +103336,7 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101122
103336
|
[DeviceRole.EnergySensor]: "inherit",
|
|
101123
103337
|
[DeviceRole.VoltageSensor]: "inherit",
|
|
101124
103338
|
[DeviceRole.CurrentSensor]: "inherit",
|
|
101125
|
-
[DeviceRole.AirQualitySensor]:
|
|
103339
|
+
[DeviceRole.AirQualitySensor]: AIR_QUALITY_LOOK,
|
|
101126
103340
|
[DeviceRole.BatterySensor]: "inherit",
|
|
101127
103341
|
[DeviceRole.NumericSensor]: "inherit",
|
|
101128
103342
|
[DeviceRole.EnumSensor]: "inherit",
|
|
@@ -101144,10 +103358,17 @@ function isDeviceType(type) {
|
|
|
101144
103358
|
function isDeviceRole(role) {
|
|
101145
103359
|
return Object.values(DeviceRole).includes(role);
|
|
101146
103360
|
}
|
|
101147
|
-
/**
|
|
101148
|
-
|
|
103361
|
+
/**
|
|
103362
|
+
* The look of a (role, type) pair, for a state. Role beats type beats the generic default.
|
|
103363
|
+
* A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
|
|
103364
|
+
*/
|
|
103365
|
+
function resolveHeroLook(role, type, state, mode = null) {
|
|
101149
103366
|
const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
101150
103367
|
if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
|
|
103368
|
+
if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
|
|
103369
|
+
const byMode = HERO_MODE_LOOK[mode];
|
|
103370
|
+
if (byMode !== null) return byMode;
|
|
103371
|
+
}
|
|
101151
103372
|
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
101152
103373
|
}
|
|
101153
103374
|
/** Every look the model declares, for the exhaustiveness guard and its spec. */
|
|
@@ -101161,7 +103382,11 @@ function allHeroLooks() {
|
|
|
101161
103382
|
//#endregion
|
|
101162
103383
|
//#region src/device/hero/own-power.ts
|
|
101163
103384
|
/** The media player's offer outranks a bound switch: the player's own state is the device's. */
|
|
101164
|
-
var OWN_POWER_SOURCE_ORDER = [
|
|
103385
|
+
var OWN_POWER_SOURCE_ORDER = [
|
|
103386
|
+
"media-player",
|
|
103387
|
+
"climate-control",
|
|
103388
|
+
"switch"
|
|
103389
|
+
];
|
|
101165
103390
|
function resolveOwnPower(offers) {
|
|
101166
103391
|
for (const source of OWN_POWER_SOURCE_ORDER) {
|
|
101167
103392
|
const offer = offers.find((o) => o.source === source);
|
|
@@ -101185,9 +103410,41 @@ function resolveOwnPower(offers) {
|
|
|
101185
103410
|
var STATE_SOURCE_ORDER = [
|
|
101186
103411
|
"media-player",
|
|
101187
103412
|
"dishwasher",
|
|
103413
|
+
"lock-control",
|
|
103414
|
+
"alarm-panel",
|
|
103415
|
+
"vacuum-control",
|
|
103416
|
+
"lawn-mower-control",
|
|
103417
|
+
"fan-control",
|
|
103418
|
+
"pet-feeder",
|
|
103419
|
+
"pet-fountain",
|
|
103420
|
+
"automation-control",
|
|
103421
|
+
"script-runner",
|
|
103422
|
+
"event-emitter",
|
|
101188
103423
|
"running-state",
|
|
101189
103424
|
"switch",
|
|
101190
|
-
"contact"
|
|
103425
|
+
"contact",
|
|
103426
|
+
"group-active",
|
|
103427
|
+
"cover",
|
|
103428
|
+
"valve",
|
|
103429
|
+
"humidifier",
|
|
103430
|
+
"brightness",
|
|
103431
|
+
"smoke",
|
|
103432
|
+
"flood",
|
|
103433
|
+
"gas",
|
|
103434
|
+
"tamper",
|
|
103435
|
+
"vibration",
|
|
103436
|
+
"doorbell",
|
|
103437
|
+
"motion",
|
|
103438
|
+
"presence",
|
|
103439
|
+
"update",
|
|
103440
|
+
"weather",
|
|
103441
|
+
"image",
|
|
103442
|
+
"control",
|
|
103443
|
+
"meter",
|
|
103444
|
+
"binary",
|
|
103445
|
+
"button",
|
|
103446
|
+
"climate-control",
|
|
103447
|
+
"sensor"
|
|
101191
103448
|
];
|
|
101192
103449
|
var STATE_TEXT = {
|
|
101193
103450
|
on: t("On", "Acceso"),
|
|
@@ -101200,6 +103457,10 @@ var STATE_TEXT = {
|
|
|
101200
103457
|
unknown: t("Unknown", "Sconosciuto")
|
|
101201
103458
|
};
|
|
101202
103459
|
function pickReading(readings) {
|
|
103460
|
+
for (const source of STATE_SOURCE_ORDER) {
|
|
103461
|
+
const alarm = readings.find((r) => r.source === source && r.state === "alert");
|
|
103462
|
+
if (alarm !== void 0) return alarm;
|
|
103463
|
+
}
|
|
101203
103464
|
for (const source of STATE_SOURCE_ORDER) {
|
|
101204
103465
|
const found = readings.find((r) => r.source === source && r.state !== "unknown");
|
|
101205
103466
|
if (found !== void 0) return found;
|
|
@@ -101214,21 +103475,25 @@ function runningOf(input) {
|
|
|
101214
103475
|
function stateOf(input, readings) {
|
|
101215
103476
|
if (!input.device.online) return {
|
|
101216
103477
|
state: "offline",
|
|
101217
|
-
assumed: false
|
|
103478
|
+
assumed: false,
|
|
103479
|
+
title: STATE_TEXT.offline
|
|
101218
103480
|
};
|
|
101219
103481
|
const picked = pickReading(readings);
|
|
101220
103482
|
if (picked === null) return {
|
|
101221
103483
|
state: "unknown",
|
|
101222
|
-
assumed: false
|
|
103484
|
+
assumed: false,
|
|
103485
|
+
title: STATE_TEXT.unknown
|
|
101223
103486
|
};
|
|
101224
103487
|
const switchOff = readings.some((r) => r.source === "switch" && r.state === "off");
|
|
101225
103488
|
if (picked.source === "running-state" && picked.state === "idle" && switchOff) return {
|
|
101226
103489
|
state: "off",
|
|
101227
|
-
assumed: false
|
|
103490
|
+
assumed: false,
|
|
103491
|
+
title: STATE_TEXT.off
|
|
101228
103492
|
};
|
|
101229
103493
|
return {
|
|
101230
103494
|
state: picked.state,
|
|
101231
|
-
assumed: picked.assumed
|
|
103495
|
+
assumed: picked.assumed,
|
|
103496
|
+
title: picked.title ?? STATE_TEXT[picked.state]
|
|
101232
103497
|
};
|
|
101233
103498
|
}
|
|
101234
103499
|
function provenanceOf(cap, fragment) {
|
|
@@ -101277,15 +103542,17 @@ function buildHeroModel(input) {
|
|
|
101277
103542
|
features: input.features,
|
|
101278
103543
|
now: input.now,
|
|
101279
103544
|
running: runningOf(input),
|
|
101280
|
-
remoteCommands: input.remoteCommands
|
|
103545
|
+
remoteCommands: input.remoteCommands,
|
|
103546
|
+
caps: input.caps
|
|
101281
103547
|
};
|
|
101282
103548
|
const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
|
|
101283
103549
|
cap: c.cap,
|
|
101284
103550
|
fragment: c.contribute(input.slices[c.cap], ctx)
|
|
101285
103551
|
}));
|
|
101286
103552
|
const fragments = contributed.map((c) => c.fragment);
|
|
101287
|
-
const { state, assumed } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
101288
|
-
const
|
|
103553
|
+
const { state, assumed, title } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
103554
|
+
const scene = sceneOf(device.role, device.type, fragments);
|
|
103555
|
+
const look = resolveHeroLook(device.role, device.type, state, scene.mode);
|
|
101289
103556
|
const artworkUrl = fragments.find((f) => f.artworkUrl !== void 0)?.artworkUrl;
|
|
101290
103557
|
const background = artworkUrl === void 0 || state === "offline" ? {
|
|
101291
103558
|
kind: "state",
|
|
@@ -101309,7 +103576,8 @@ function buildHeroModel(input) {
|
|
|
101309
103576
|
const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
|
|
101310
103577
|
const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
|
|
101311
103578
|
const badges = fragments.flatMap((f) => f.badges ?? []);
|
|
101312
|
-
const
|
|
103579
|
+
const headline = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.title !== void 0)?.title;
|
|
103580
|
+
const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en);
|
|
101313
103581
|
const sideTiles = {
|
|
101314
103582
|
left: tilesOf(fragments, "left"),
|
|
101315
103583
|
right: tilesOf(fragments, "right")
|
|
@@ -101331,10 +103599,10 @@ function buildHeroModel(input) {
|
|
|
101331
103599
|
stateAssumed: assumed,
|
|
101332
103600
|
look,
|
|
101333
103601
|
background,
|
|
101334
|
-
scene
|
|
103602
|
+
scene,
|
|
101335
103603
|
facts,
|
|
101336
103604
|
sideTiles,
|
|
101337
|
-
title:
|
|
103605
|
+
title: headline ?? title,
|
|
101338
103606
|
badges,
|
|
101339
103607
|
remote,
|
|
101340
103608
|
consumables: fragments.find((f) => f.consumables !== void 0)?.consumables ?? null,
|
|
@@ -101362,28 +103630,28 @@ var LATER_PHASE = "a hero fact, contributed when its type migrates to the templa
|
|
|
101362
103630
|
var NOT_A_HERO_FACT = "plumbing or configuration; reachable from the device page tabs";
|
|
101363
103631
|
var HERO_CAP_COVERAGE = {
|
|
101364
103632
|
accessories: { none: NOT_A_HERO_FACT },
|
|
101365
|
-
"air-quality-sensor":
|
|
101366
|
-
"alarm-panel":
|
|
101367
|
-
"ambient-light-sensor":
|
|
103633
|
+
"air-quality-sensor": "contributes",
|
|
103634
|
+
"alarm-panel": "contributes",
|
|
103635
|
+
"ambient-light-sensor": "contributes",
|
|
101368
103636
|
"audio-analysis": { none: NOT_A_HERO_FACT },
|
|
101369
103637
|
"audio-metrics": { none: NOT_A_HERO_FACT },
|
|
101370
|
-
"automation-control":
|
|
103638
|
+
"automation-control": "contributes",
|
|
101371
103639
|
battery: "contributes",
|
|
101372
|
-
binary:
|
|
101373
|
-
brightness:
|
|
101374
|
-
button:
|
|
103640
|
+
binary: "contributes",
|
|
103641
|
+
brightness: "contributes",
|
|
103642
|
+
button: "contributes",
|
|
101375
103643
|
"camera-credentials": { none: NOT_A_HERO_FACT },
|
|
101376
103644
|
"camera-grid-layout": { none: NOT_A_HERO_FACT },
|
|
101377
103645
|
"camera-pipeline-config": { none: NOT_A_HERO_FACT },
|
|
101378
103646
|
"camera-streams": { none: NOT_A_HERO_FACT },
|
|
101379
|
-
"carbon-monoxide":
|
|
101380
|
-
"climate-control":
|
|
101381
|
-
color:
|
|
103647
|
+
"carbon-monoxide": "contributes",
|
|
103648
|
+
"climate-control": "contributes",
|
|
103649
|
+
color: "contributes",
|
|
101382
103650
|
connectivity: { none: NOT_A_HERO_FACT },
|
|
101383
103651
|
consumables: "contributes",
|
|
101384
103652
|
contact: "contributes",
|
|
101385
|
-
control:
|
|
101386
|
-
cover:
|
|
103653
|
+
control: "contributes",
|
|
103654
|
+
cover: "contributes",
|
|
101387
103655
|
"day-night": { none: NOT_A_HERO_FACT },
|
|
101388
103656
|
"detection-pipeline": { none: NOT_A_HERO_FACT },
|
|
101389
103657
|
"device-admin-link": { none: NOT_A_HERO_FACT },
|
|
@@ -101394,29 +103662,29 @@ var HERO_CAP_COVERAGE = {
|
|
|
101394
103662
|
"device-transitions": { none: "audit log of what changed and who asked; reachable from the device page history" },
|
|
101395
103663
|
"device-status": { none: NOT_A_HERO_FACT },
|
|
101396
103664
|
dishwasher: "contributes",
|
|
101397
|
-
"do-not-disturb":
|
|
101398
|
-
doorbell:
|
|
101399
|
-
"enum-sensor":
|
|
101400
|
-
"event-emitter":
|
|
101401
|
-
"fan-control":
|
|
103665
|
+
"do-not-disturb": "contributes",
|
|
103666
|
+
doorbell: "contributes",
|
|
103667
|
+
"enum-sensor": "contributes",
|
|
103668
|
+
"event-emitter": "contributes",
|
|
103669
|
+
"fan-control": "contributes",
|
|
101402
103670
|
"feature-probe": { none: NOT_A_HERO_FACT },
|
|
101403
|
-
flood:
|
|
101404
|
-
gas:
|
|
101405
|
-
"group-active":
|
|
101406
|
-
"group-commands":
|
|
101407
|
-
"group-status":
|
|
101408
|
-
"heating-valve":
|
|
101409
|
-
humidifier:
|
|
101410
|
-
"humidity-sensor":
|
|
101411
|
-
image:
|
|
103671
|
+
flood: "contributes",
|
|
103672
|
+
gas: "contributes",
|
|
103673
|
+
"group-active": "contributes",
|
|
103674
|
+
"group-commands": "contributes",
|
|
103675
|
+
"group-status": "contributes",
|
|
103676
|
+
"heating-valve": "contributes",
|
|
103677
|
+
humidifier: "contributes",
|
|
103678
|
+
"humidity-sensor": "contributes",
|
|
103679
|
+
image: "contributes",
|
|
101412
103680
|
"image-settings": { none: NOT_A_HERO_FACT },
|
|
101413
103681
|
intercom: { none: NOT_A_HERO_FACT },
|
|
101414
|
-
"ir-transmitter": { none:
|
|
101415
|
-
"lawn-mower-control":
|
|
101416
|
-
"lock-control":
|
|
103682
|
+
"ir-transmitter": { none: "a transport on a board: it sends raw timings for a remote and reports no state (D957); the appliance it drives shows its own state and the remote button" },
|
|
103683
|
+
"lawn-mower-control": "contributes",
|
|
103684
|
+
"lock-control": "contributes",
|
|
101417
103685
|
"media-player": "contributes",
|
|
101418
|
-
meter:
|
|
101419
|
-
motion:
|
|
103686
|
+
meter: "contributes",
|
|
103687
|
+
motion: "contributes",
|
|
101420
103688
|
"motion-detection": { none: NOT_A_HERO_FACT },
|
|
101421
103689
|
"motion-trigger": "contributes",
|
|
101422
103690
|
"motion-zones": { none: NOT_A_HERO_FACT },
|
|
@@ -101424,19 +103692,19 @@ var HERO_CAP_COVERAGE = {
|
|
|
101424
103692
|
navigation: { none: NOT_A_HERO_FACT },
|
|
101425
103693
|
"network-link": "contributes",
|
|
101426
103694
|
notifier: { none: NOT_A_HERO_FACT },
|
|
101427
|
-
"numeric-sensor":
|
|
103695
|
+
"numeric-sensor": "contributes",
|
|
101428
103696
|
osd: { none: NOT_A_HERO_FACT },
|
|
101429
|
-
"pet-feeder":
|
|
101430
|
-
"pet-fountain":
|
|
103697
|
+
"pet-feeder": "contributes",
|
|
103698
|
+
"pet-fountain": "contributes",
|
|
101431
103699
|
"pipeline-analytics": { none: NOT_A_HERO_FACT },
|
|
101432
103700
|
"power-meter": "contributes",
|
|
101433
103701
|
"power-source": "contributes",
|
|
101434
|
-
presence:
|
|
101435
|
-
"pressure-sensor":
|
|
103702
|
+
presence: "contributes",
|
|
103703
|
+
"pressure-sensor": "contributes",
|
|
101436
103704
|
"privacy-mask": { none: NOT_A_HERO_FACT },
|
|
101437
103705
|
ptz: { none: NOT_A_HERO_FACT },
|
|
101438
103706
|
"ptz-autotrack": { none: NOT_A_HERO_FACT },
|
|
101439
|
-
"pump-cycle":
|
|
103707
|
+
"pump-cycle": "contributes",
|
|
101440
103708
|
reboot: { none: NOT_A_HERO_FACT },
|
|
101441
103709
|
recording: { none: NOT_A_HERO_FACT },
|
|
101442
103710
|
"recording-onboard": { none: NOT_A_HERO_FACT },
|
|
@@ -101444,23 +103712,23 @@ var HERO_CAP_COVERAGE = {
|
|
|
101444
103712
|
remote: "contributes",
|
|
101445
103713
|
"running-state": "contributes",
|
|
101446
103714
|
"scene-monitor": { none: NOT_A_HERO_FACT },
|
|
101447
|
-
"script-runner":
|
|
101448
|
-
smoke:
|
|
103715
|
+
"script-runner": "contributes",
|
|
103716
|
+
smoke: "contributes",
|
|
101449
103717
|
snapshot: { none: NOT_A_HERO_FACT },
|
|
101450
103718
|
"stream-catalog": { none: NOT_A_HERO_FACT },
|
|
101451
103719
|
"stream-params": { none: NOT_A_HERO_FACT },
|
|
101452
103720
|
"stream-signals": { none: NOT_A_HERO_FACT },
|
|
101453
103721
|
switch: "contributes",
|
|
101454
|
-
tamper:
|
|
101455
|
-
"temperature-sensor":
|
|
103722
|
+
tamper: "contributes",
|
|
103723
|
+
"temperature-sensor": "contributes",
|
|
101456
103724
|
"timed-run": "contributes",
|
|
101457
|
-
update:
|
|
101458
|
-
"vacuum-control":
|
|
101459
|
-
valve:
|
|
101460
|
-
vibration:
|
|
103725
|
+
update: "contributes",
|
|
103726
|
+
"vacuum-control": "contributes",
|
|
103727
|
+
valve: "contributes",
|
|
103728
|
+
vibration: "contributes",
|
|
101461
103729
|
videoclips: { none: NOT_A_HERO_FACT },
|
|
101462
|
-
"water-heater":
|
|
101463
|
-
weather:
|
|
103730
|
+
"water-heater": "contributes",
|
|
103731
|
+
weather: "contributes",
|
|
101464
103732
|
"webrtc-session": { none: NOT_A_HERO_FACT },
|
|
101465
103733
|
"zone-analytics": { none: NOT_A_HERO_FACT },
|
|
101466
103734
|
"zone-rules": { none: NOT_A_HERO_FACT },
|
|
@@ -117391,7 +119659,7 @@ function getCapsByProviderKind(kind) {
|
|
|
117391
119659
|
//#region src/generated/runtime-state-durability.ts
|
|
117392
119660
|
/**
|
|
117393
119661
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
117394
|
-
* `runtimeState`. 81 caps:
|
|
119662
|
+
* `runtimeState`. 81 caps: 41 `restored`, 40 `session`.
|
|
117395
119663
|
*
|
|
117396
119664
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
117397
119665
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -117438,8 +119706,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117438
119706
|
volatileFields: ["lastChangedAt"]
|
|
117439
119707
|
},
|
|
117440
119708
|
"climate-control": {
|
|
117441
|
-
durability: "
|
|
117442
|
-
volatileFields: []
|
|
119709
|
+
durability: "restored",
|
|
119710
|
+
volatileFields: [],
|
|
119711
|
+
restoredFields: ["lastActiveMode"]
|
|
117443
119712
|
},
|
|
117444
119713
|
"color": {
|
|
117445
119714
|
durability: "session",
|
|
@@ -117491,7 +119760,7 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117491
119760
|
},
|
|
117492
119761
|
"enum-sensor": {
|
|
117493
119762
|
durability: "restored",
|
|
117494
|
-
volatileFields: ["lastFetchedAt"]
|
|
119763
|
+
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
117495
119764
|
},
|
|
117496
119765
|
"event-emitter": {
|
|
117497
119766
|
durability: "session",
|
|
@@ -117702,8 +119971,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117702
119971
|
volatileFields: ["lastChangedAt"]
|
|
117703
119972
|
},
|
|
117704
119973
|
"water-heater": {
|
|
117705
|
-
durability: "
|
|
117706
|
-
volatileFields: []
|
|
119974
|
+
durability: "restored",
|
|
119975
|
+
volatileFields: [],
|
|
119976
|
+
restoredFields: ["lastActiveMode"]
|
|
117707
119977
|
},
|
|
117708
119978
|
"weather": {
|
|
117709
119979
|
durability: "session",
|
|
@@ -117749,6 +120019,7 @@ var RESTORED_CAP_NAMES = [
|
|
|
117749
120019
|
"battery",
|
|
117750
120020
|
"binary",
|
|
117751
120021
|
"carbon-monoxide",
|
|
120022
|
+
"climate-control",
|
|
117752
120023
|
"connectivity",
|
|
117753
120024
|
"consumables",
|
|
117754
120025
|
"contact",
|
|
@@ -117780,6 +120051,7 @@ var RESTORED_CAP_NAMES = [
|
|
|
117780
120051
|
"tamper",
|
|
117781
120052
|
"temperature-sensor",
|
|
117782
120053
|
"vibration",
|
|
120054
|
+
"water-heater",
|
|
117783
120055
|
"zone-rules",
|
|
117784
120056
|
"zones"
|
|
117785
120057
|
];
|