@camstack/types 1.2.557 → 1.2.559
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 +15 -0
- package/dist/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/automation/action-target.d.ts +8 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +289 -0
- package/dist/client.mjs +288 -1
- package/dist/{composed-stable-id-CDNLq7Y8.js → composed-stable-id-BmJ_5GiE.js} +5 -0
- package/dist/{composed-stable-id-CPp3votu.mjs → composed-stable-id-iddnCQ51.mjs} +5 -0
- package/dist/composition/composition.d.ts +8 -0
- package/dist/composition/helpers/index.d.ts +1 -1
- package/dist/composition/helpers/save.d.ts +2 -0
- package/dist/composition/helpers/source-pick.d.ts +11 -5
- package/dist/composition/validate-composition.d.ts +2 -0
- package/dist/device/device-icon.d.ts +136 -0
- package/dist/device/device-kind.d.ts +36 -0
- package/dist/device/device-type.d.ts +5 -0
- package/dist/device/hero/hero-look.d.ts +6 -0
- package/dist/device/hero/hero-measurement.d.ts +7 -0
- package/dist/device/hero/hero-scene.d.ts +1 -0
- package/dist/device/hero/hero-text.d.ts +8 -0
- package/dist/device/hero/index.d.ts +2 -2
- package/dist/device/index.d.ts +3 -1
- package/dist/{implemented-methods-5YMDeE3f.mjs → implemented-methods-CSTk6zYK.mjs} +147 -2
- package/dist/{implemented-methods-Cj65uy2F.js → implemented-methods-CfaRR_ki.js} +212 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +529 -284
- package/dist/index.mjs +507 -278
- package/dist/node.js +2 -2
- package/dist/node.mjs +2 -2
- package/dist/{sleep-DyIxjZZt.mjs → sleep-BvVGLl30.mjs} +8 -1
- package/dist/{sleep-1RkA30Y1.js → sleep-CyWfD1LJ.js} +8 -1
- package/package.json +1 -1
package/dist/client.mjs
CHANGED
|
@@ -1217,6 +1217,144 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
1217
1217
|
DeviceType["HeatPump"] = "heat-pump";
|
|
1218
1218
|
return DeviceType;
|
|
1219
1219
|
}({});
|
|
1220
|
+
/**
|
|
1221
|
+
* Semantic role a device plays within its parent. Populated by driver
|
|
1222
|
+
* addons when creating accessory devices (Reolink siren/floodlight/
|
|
1223
|
+
* PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
|
|
1224
|
+
* admin UI to pick icons, labels, and widgets — a `Switch` with
|
|
1225
|
+
* `role: Floodlight` renders as a bulb with a brightness slider,
|
|
1226
|
+
* whereas a `Switch` with `role: Siren` renders as a klaxon.
|
|
1227
|
+
*
|
|
1228
|
+
* Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
|
|
1229
|
+
* sqlite as a nullable TEXT column — old rows keep working unchanged.
|
|
1230
|
+
*/
|
|
1231
|
+
var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
1232
|
+
DeviceRole["Siren"] = "siren";
|
|
1233
|
+
DeviceRole["Floodlight"] = "floodlight";
|
|
1234
|
+
DeviceRole["Spotlight"] = "spotlight";
|
|
1235
|
+
DeviceRole["PirSensor"] = "pir-sensor";
|
|
1236
|
+
DeviceRole["Chime"] = "chime";
|
|
1237
|
+
DeviceRole["Autotrack"] = "autotrack";
|
|
1238
|
+
DeviceRole["Nightvision"] = "nightvision";
|
|
1239
|
+
DeviceRole["PrivacyMask"] = "privacy-mask";
|
|
1240
|
+
DeviceRole["Doorbell"] = "doorbell";
|
|
1241
|
+
/** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
|
|
1242
|
+
DeviceRole["CoverBlind"] = "cover-blind";
|
|
1243
|
+
/** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
|
|
1244
|
+
DeviceRole["CoverShutter"] = "cover-shutter";
|
|
1245
|
+
/** Exterior awning. HA `device_class: awning`. */
|
|
1246
|
+
DeviceRole["CoverAwning"] = "cover-awning";
|
|
1247
|
+
/** Curtain / drape. HA `device_class: curtain`. */
|
|
1248
|
+
DeviceRole["CoverCurtain"] = "cover-curtain";
|
|
1249
|
+
/** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
|
|
1250
|
+
DeviceRole["CoverGarage"] = "cover-garage";
|
|
1251
|
+
/** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
|
|
1252
|
+
DeviceRole["CoverGate"] = "cover-gate";
|
|
1253
|
+
/** Door. HA `device_class: door`. A security actuator: exports gate it. */
|
|
1254
|
+
DeviceRole["CoverDoor"] = "cover-door";
|
|
1255
|
+
/** Window. HA `device_class: window`. */
|
|
1256
|
+
DeviceRole["CoverWindow"] = "cover-window";
|
|
1257
|
+
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
1258
|
+
* real Switch device for UI rendering / export adapters. */
|
|
1259
|
+
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
1260
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1261
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1262
|
+
DeviceRole["Outlet"] = "outlet";
|
|
1263
|
+
/** A dumb plug-in stove or heater behind a switch: it runs only while the
|
|
1264
|
+
* switch is on. Offered `timed-run`, which switches it off again after a
|
|
1265
|
+
* chosen time. */
|
|
1266
|
+
DeviceRole["SwitchHeater"] = "switch-heater";
|
|
1267
|
+
/** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
|
|
1268
|
+
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1269
|
+
* device also has a fan cap (D1033). */
|
|
1270
|
+
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1271
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
1272
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
1273
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
1274
|
+
* or colour this relay lacks. */
|
|
1275
|
+
DeviceRole["SwitchLight"] = "switch-light";
|
|
1276
|
+
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1277
|
+
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1278
|
+
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
1279
|
+
DeviceRole["ClimateThermostat"] = "climate-thermostat";
|
|
1280
|
+
/** Floor-heating zone actuator. */
|
|
1281
|
+
DeviceRole["ClimateFloor"] = "climate-floor";
|
|
1282
|
+
/** Radiator valve (thermostatic radiator head). */
|
|
1283
|
+
DeviceRole["ClimateRadiator"] = "climate-radiator";
|
|
1284
|
+
/** A heater with its own thermostat (stove, convector). */
|
|
1285
|
+
DeviceRole["ClimateHeater"] = "climate-heater";
|
|
1286
|
+
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
1287
|
+
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
1288
|
+
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
1289
|
+
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1290
|
+
* the camera accessory PirSensor role: that one is a camera child;
|
|
1291
|
+
* this is a standalone HA / 3rd-party motion sensor. */
|
|
1292
|
+
DeviceRole["MotionSensor"] = "motion-sensor";
|
|
1293
|
+
DeviceRole["ContactSensor"] = "contact-sensor";
|
|
1294
|
+
DeviceRole["LeakSensor"] = "leak-sensor";
|
|
1295
|
+
DeviceRole["SmokeSensor"] = "smoke-sensor";
|
|
1296
|
+
DeviceRole["COSensor"] = "co-sensor";
|
|
1297
|
+
DeviceRole["GasSensor"] = "gas-sensor";
|
|
1298
|
+
DeviceRole["TamperSensor"] = "tamper-sensor";
|
|
1299
|
+
DeviceRole["VibrationSensor"] = "vibration-sensor";
|
|
1300
|
+
DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
|
|
1301
|
+
DeviceRole["SoundSensor"] = "sound-sensor";
|
|
1302
|
+
/** Fallback for `binary_sensor` without a known `device_class`. */
|
|
1303
|
+
DeviceRole["BinarySensor"] = "binary-sensor";
|
|
1304
|
+
DeviceRole["TemperatureSensor"] = "temperature-sensor";
|
|
1305
|
+
DeviceRole["HumiditySensor"] = "humidity-sensor";
|
|
1306
|
+
DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
|
|
1307
|
+
DeviceRole["PressureSensor"] = "pressure-sensor";
|
|
1308
|
+
/** Wind speed or direction (weather-station `wind-sensor` cap). */
|
|
1309
|
+
DeviceRole["WindSensor"] = "wind-sensor";
|
|
1310
|
+
/** Rain accumulation or rate (weather-station `rain-sensor` cap). */
|
|
1311
|
+
DeviceRole["RainSensor"] = "rain-sensor";
|
|
1312
|
+
/** UV index (weather-station `uv-sensor` cap). */
|
|
1313
|
+
DeviceRole["UvSensor"] = "uv-sensor";
|
|
1314
|
+
/** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
|
|
1315
|
+
* Distinct from AmbientLightSensor (lux). */
|
|
1316
|
+
DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
|
|
1317
|
+
/** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
|
|
1318
|
+
DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
|
|
1319
|
+
DeviceRole["PowerSensor"] = "power-sensor";
|
|
1320
|
+
DeviceRole["EnergySensor"] = "energy-sensor";
|
|
1321
|
+
DeviceRole["VoltageSensor"] = "voltage-sensor";
|
|
1322
|
+
DeviceRole["CurrentSensor"] = "current-sensor";
|
|
1323
|
+
DeviceRole["AirQualitySensor"] = "air-quality-sensor";
|
|
1324
|
+
/** Battery level (numeric % via `sensor` OR low-bool via
|
|
1325
|
+
* `binary_sensor` — the cap distinguishes via the value type). */
|
|
1326
|
+
DeviceRole["BatterySensor"] = "battery-sensor";
|
|
1327
|
+
/** Fallback for `sensor` numeric without a known `device_class`. */
|
|
1328
|
+
DeviceRole["NumericSensor"] = "numeric-sensor";
|
|
1329
|
+
/** String / enum state (HA `sensor` with `state_class: enum` or
|
|
1330
|
+
* `attributes.options`). */
|
|
1331
|
+
DeviceRole["EnumSensor"] = "enum-sensor";
|
|
1332
|
+
/** Date / timestamp state (HA `sensor` with `device_class: timestamp`
|
|
1333
|
+
* or `date`). The slice carries the raw ISO string verbatim (hosted on
|
|
1334
|
+
* the `enum-sensor` cap); the UI renders it locale-formatted. */
|
|
1335
|
+
DeviceRole["DateTimeSensor"] = "datetime-sensor";
|
|
1336
|
+
/** Last-resort fallback when nothing else matches. */
|
|
1337
|
+
DeviceRole["GenericSensor"] = "generic-sensor";
|
|
1338
|
+
DeviceRole["NumericControl"] = "numeric-control";
|
|
1339
|
+
DeviceRole["SelectControl"] = "select-control";
|
|
1340
|
+
DeviceRole["TextControl"] = "text-control";
|
|
1341
|
+
DeviceRole["DateTimeControl"] = "datetime-control";
|
|
1342
|
+
/** Mobile push notifier (HA `notify.mobile_app_*`) — supports
|
|
1343
|
+
* rich features (image, priority, channel routing). */
|
|
1344
|
+
DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
|
|
1345
|
+
/** Chat / messaging service (HA `notify.telegram_*`,
|
|
1346
|
+
* `notify.discord_*`, etc.). */
|
|
1347
|
+
DeviceRole["MessagingNotifier"] = "messaging-notifier";
|
|
1348
|
+
/** Email-based delivery (HA `notify.smtp`, etc.). */
|
|
1349
|
+
DeviceRole["EmailNotifier"] = "email-notifier";
|
|
1350
|
+
/** Fallback when the notifier service name doesn't match a known
|
|
1351
|
+
* pattern. */
|
|
1352
|
+
DeviceRole["GenericNotifier"] = "generic-notifier";
|
|
1353
|
+
/** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
|
|
1354
|
+
* cap. A `DeviceType.Generic` device. */
|
|
1355
|
+
DeviceRole["IrTransmitter"] = "ir-transmitter";
|
|
1356
|
+
return DeviceRole;
|
|
1357
|
+
}({});
|
|
1220
1358
|
z.enum(["new-session", "step-up"]);
|
|
1221
1359
|
z.enum(["en", "it"]);
|
|
1222
1360
|
/** How a native app starts one login method (D858), as `auth.listLoginMethods` reports it. */
|
|
@@ -26969,6 +27107,155 @@ function isSource(x) {
|
|
|
26969
27107
|
return typeof x.read === "function" && typeof x.watch === "function";
|
|
26970
27108
|
}
|
|
26971
27109
|
//#endregion
|
|
27110
|
+
//#region src/device/device-icon.ts
|
|
27111
|
+
/**
|
|
27112
|
+
* device-icon — THE icon of a device, from what it IS: its {@link DeviceType},
|
|
27113
|
+
* refined by its {@link DeviceRole}. One table for every surface: the admin's
|
|
27114
|
+
* rows, cards, page header, lists and pickers draw it through ui-library's
|
|
27115
|
+
* glyph table, the viewer through its catalog nodes. The value is a key of the
|
|
27116
|
+
* icon catalog (D854), never a glyph.
|
|
27117
|
+
*
|
|
27118
|
+
* Exhaustive over both enums (`satisfies Record<…>`): a new type or role fails
|
|
27119
|
+
* the build until it has an icon. Nothing here reads a name, a provider or a
|
|
27120
|
+
* capability — an icon picked from those would be invented.
|
|
27121
|
+
*
|
|
27122
|
+
* Precedence: a known role → its icon; otherwise the type's icon; a type this
|
|
27123
|
+
* build does not know → the generic type's icon. An operator's per-device or
|
|
27124
|
+
* per-role display override is the caller's level above this one.
|
|
27125
|
+
*/
|
|
27126
|
+
/** The icon of each device type. */
|
|
27127
|
+
var DEVICE_TYPE_ICON = {
|
|
27128
|
+
[DeviceType.Camera]: "camera",
|
|
27129
|
+
[DeviceType.Hub]: "network",
|
|
27130
|
+
[DeviceType.Light]: "lightbulb",
|
|
27131
|
+
[DeviceType.Siren]: "siren",
|
|
27132
|
+
[DeviceType.Switch]: "toggle-left",
|
|
27133
|
+
[DeviceType.Sensor]: "activity",
|
|
27134
|
+
[DeviceType.Climate]: "thermometer",
|
|
27135
|
+
[DeviceType.HeatPump]: "flame",
|
|
27136
|
+
[DeviceType.Button]: "circle-dot",
|
|
27137
|
+
[DeviceType.EventEmitter]: "zap",
|
|
27138
|
+
[DeviceType.Update]: "refresh-cw",
|
|
27139
|
+
[DeviceType.Generic]: "box",
|
|
27140
|
+
[DeviceType.Notifier]: "bell",
|
|
27141
|
+
[DeviceType.Script]: "scroll-text",
|
|
27142
|
+
[DeviceType.Automation]: "workflow",
|
|
27143
|
+
[DeviceType.Lock]: "lock",
|
|
27144
|
+
[DeviceType.Cover]: "blinds",
|
|
27145
|
+
[DeviceType.Valve]: "pipette",
|
|
27146
|
+
[DeviceType.Humidifier]: "waves",
|
|
27147
|
+
[DeviceType.WaterHeater]: "bath",
|
|
27148
|
+
[DeviceType.Fan]: "fan",
|
|
27149
|
+
[DeviceType.MediaPlayer]: "monitor-play",
|
|
27150
|
+
[DeviceType.AlarmPanel]: "shield-alert",
|
|
27151
|
+
[DeviceType.Control]: "sliders-horizontal",
|
|
27152
|
+
[DeviceType.Presence]: "map-pin",
|
|
27153
|
+
[DeviceType.Weather]: "cloud-sun",
|
|
27154
|
+
[DeviceType.Vacuum]: "bot",
|
|
27155
|
+
[DeviceType.LawnMower]: "tractor",
|
|
27156
|
+
[DeviceType.Container]: "box",
|
|
27157
|
+
[DeviceType.Image]: "image",
|
|
27158
|
+
[DeviceType.PetFeeder]: "bone",
|
|
27159
|
+
[DeviceType.PetFountain]: "droplets",
|
|
27160
|
+
[DeviceType.Dishwasher]: "waves",
|
|
27161
|
+
[DeviceType.Washer]: "washing-machine",
|
|
27162
|
+
[DeviceType.Dryer]: "wind",
|
|
27163
|
+
[DeviceType.Gateway]: "router"
|
|
27164
|
+
};
|
|
27165
|
+
/** The icon of each role: what the device is FOR, which reads better than its type. */
|
|
27166
|
+
var DEVICE_ROLE_ICON = {
|
|
27167
|
+
[DeviceRole.Siren]: "siren",
|
|
27168
|
+
[DeviceRole.Floodlight]: "lightbulb",
|
|
27169
|
+
[DeviceRole.Spotlight]: "flashlight",
|
|
27170
|
+
[DeviceRole.PirSensor]: "radar",
|
|
27171
|
+
[DeviceRole.Chime]: "bell",
|
|
27172
|
+
[DeviceRole.Autotrack]: "crosshair",
|
|
27173
|
+
[DeviceRole.Nightvision]: "moon",
|
|
27174
|
+
[DeviceRole.PrivacyMask]: "eye-off",
|
|
27175
|
+
[DeviceRole.Doorbell]: "door-closed",
|
|
27176
|
+
[DeviceRole.CoverBlind]: "blinds",
|
|
27177
|
+
[DeviceRole.CoverShutter]: "blinds",
|
|
27178
|
+
[DeviceRole.CoverAwning]: "blinds",
|
|
27179
|
+
[DeviceRole.CoverCurtain]: "blinds",
|
|
27180
|
+
[DeviceRole.CoverGarage]: "door-closed",
|
|
27181
|
+
[DeviceRole.CoverGate]: "door-closed",
|
|
27182
|
+
[DeviceRole.CoverDoor]: "door-open",
|
|
27183
|
+
[DeviceRole.CoverWindow]: "blinds",
|
|
27184
|
+
[DeviceRole.BinaryHelper]: "toggle-left",
|
|
27185
|
+
[DeviceRole.Outlet]: "plug",
|
|
27186
|
+
[DeviceRole.SwitchHeater]: "flame",
|
|
27187
|
+
[DeviceRole.SwitchFan]: "fan",
|
|
27188
|
+
[DeviceRole.SwitchLight]: "lightbulb",
|
|
27189
|
+
[DeviceRole.ClimateAc]: "air-vent",
|
|
27190
|
+
[DeviceRole.ClimateThermostat]: "thermometer",
|
|
27191
|
+
[DeviceRole.ClimateFloor]: "waves",
|
|
27192
|
+
[DeviceRole.ClimateRadiator]: "heater",
|
|
27193
|
+
[DeviceRole.ClimateHeater]: "flame",
|
|
27194
|
+
[DeviceRole.ClimateHeatPumpCircuit]: "refresh-cw",
|
|
27195
|
+
[DeviceRole.MotionSensor]: "footprints",
|
|
27196
|
+
[DeviceRole.ContactSensor]: "door-open",
|
|
27197
|
+
[DeviceRole.LeakSensor]: "droplet",
|
|
27198
|
+
[DeviceRole.SmokeSensor]: "alarm-smoke",
|
|
27199
|
+
[DeviceRole.COSensor]: "wind",
|
|
27200
|
+
[DeviceRole.GasSensor]: "flame",
|
|
27201
|
+
[DeviceRole.TamperSensor]: "shield-alert",
|
|
27202
|
+
[DeviceRole.VibrationSensor]: "vibrate",
|
|
27203
|
+
[DeviceRole.ConnectivitySensor]: "wifi",
|
|
27204
|
+
[DeviceRole.SoundSensor]: "volume-2",
|
|
27205
|
+
[DeviceRole.BinarySensor]: "toggle-left",
|
|
27206
|
+
[DeviceRole.TemperatureSensor]: "thermometer",
|
|
27207
|
+
[DeviceRole.HumiditySensor]: "droplets",
|
|
27208
|
+
[DeviceRole.AmbientLightSensor]: "sun",
|
|
27209
|
+
[DeviceRole.PressureSensor]: "gauge",
|
|
27210
|
+
[DeviceRole.WindSensor]: "wind",
|
|
27211
|
+
[DeviceRole.RainSensor]: "cloud-rain",
|
|
27212
|
+
[DeviceRole.UvSensor]: "sun-medium",
|
|
27213
|
+
[DeviceRole.SolarRadiationSensor]: "sunrise",
|
|
27214
|
+
[DeviceRole.SoilMoistureSensor]: "sprout",
|
|
27215
|
+
[DeviceRole.PowerSensor]: "zap",
|
|
27216
|
+
[DeviceRole.EnergySensor]: "zap",
|
|
27217
|
+
[DeviceRole.VoltageSensor]: "zap",
|
|
27218
|
+
[DeviceRole.CurrentSensor]: "zap",
|
|
27219
|
+
[DeviceRole.AirQualitySensor]: "wind",
|
|
27220
|
+
[DeviceRole.BatterySensor]: "gauge",
|
|
27221
|
+
[DeviceRole.NumericSensor]: "hash",
|
|
27222
|
+
[DeviceRole.EnumSensor]: "list",
|
|
27223
|
+
[DeviceRole.DateTimeSensor]: "clock",
|
|
27224
|
+
[DeviceRole.GenericSensor]: "gauge",
|
|
27225
|
+
[DeviceRole.NumericControl]: "sliders-horizontal",
|
|
27226
|
+
[DeviceRole.SelectControl]: "list-checks",
|
|
27227
|
+
[DeviceRole.TextControl]: "type",
|
|
27228
|
+
[DeviceRole.DateTimeControl]: "clock",
|
|
27229
|
+
[DeviceRole.MobilePushNotifier]: "smartphone",
|
|
27230
|
+
[DeviceRole.MessagingNotifier]: "message-square",
|
|
27231
|
+
[DeviceRole.EmailNotifier]: "mail",
|
|
27232
|
+
[DeviceRole.GenericNotifier]: "bell",
|
|
27233
|
+
[DeviceRole.IrTransmitter]: "radio-tower"
|
|
27234
|
+
};
|
|
27235
|
+
var TYPE_VALUES = new Set(Object.values(DeviceType));
|
|
27236
|
+
var ROLE_VALUES = new Set(Object.values(DeviceRole));
|
|
27237
|
+
function isDeviceType(value) {
|
|
27238
|
+
return TYPE_VALUES.has(value);
|
|
27239
|
+
}
|
|
27240
|
+
function isDeviceRole(value) {
|
|
27241
|
+
return ROLE_VALUES.has(value);
|
|
27242
|
+
}
|
|
27243
|
+
/** The icon of a device type alone; a type this build does not know draws the generic one. */
|
|
27244
|
+
function deviceTypeIconKey(type) {
|
|
27245
|
+
return isDeviceType(type) ? DEVICE_TYPE_ICON[type] : DEVICE_TYPE_ICON[DeviceType.Generic];
|
|
27246
|
+
}
|
|
27247
|
+
/** The icon of a role alone, or `null` for a role this build does not know. */
|
|
27248
|
+
function deviceRoleIconKey(role) {
|
|
27249
|
+
return isDeviceRole(role) ? DEVICE_ROLE_ICON[role] : null;
|
|
27250
|
+
}
|
|
27251
|
+
/**
|
|
27252
|
+
* The icon of a device: its role's when the role is known, else its type's.
|
|
27253
|
+
* An unknown role never borrows another role's icon — it is drawn as its type.
|
|
27254
|
+
*/
|
|
27255
|
+
function deviceIconKey(type, role) {
|
|
27256
|
+
return (role === null || role === void 0 ? null : deviceRoleIconKey(role)) ?? deviceTypeIconKey(type);
|
|
27257
|
+
}
|
|
27258
|
+
//#endregion
|
|
26972
27259
|
//#region src/helpers/addon-slice-handle.ts
|
|
26973
27260
|
/** Structural bridge: every `AddonApi` client carries `deviceState` (+ optional `live`). */
|
|
26974
27261
|
function addonSliceHandleApi(api) {
|
|
@@ -33158,4 +33445,4 @@ var TimelapseRuleSchema = TimelapseRuleInputSchema.extend({
|
|
|
33158
33445
|
updatedAt: z.number()
|
|
33159
33446
|
});
|
|
33160
33447
|
//#endregion
|
|
33161
|
-
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CONTAINER_PRIMARY_CHILD_RULES, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceRefusalFromMessage, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, primaryChildPreferenceOf, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, stepActuatesAlarmPanel, stepPullsAlarmTrigger, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
|
|
33448
|
+
export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CONTAINER_PRIMARY_CHILD_RULES, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceIconKey, deviceRefusalFromMessage, deviceTypeIconKey, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, primaryChildPreferenceOf, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, stepActuatesAlarmPanel, stepPullsAlarmTrigger, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
|
|
@@ -357,6 +357,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
357
357
|
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
358
358
|
* device also has a fan cap (D1033). */
|
|
359
359
|
DeviceRole["SwitchFan"] = "switch-fan";
|
|
360
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
361
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
362
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
363
|
+
* or colour this relay lacks. */
|
|
364
|
+
DeviceRole["SwitchLight"] = "switch-light";
|
|
360
365
|
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
361
366
|
DeviceRole["ClimateAc"] = "climate-ac";
|
|
362
367
|
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
@@ -357,6 +357,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
357
357
|
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
358
358
|
* device also has a fan cap (D1033). */
|
|
359
359
|
DeviceRole["SwitchFan"] = "switch-fan";
|
|
360
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
361
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
362
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
363
|
+
* or colour this relay lacks. */
|
|
364
|
+
DeviceRole["SwitchLight"] = "switch-light";
|
|
360
365
|
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
361
366
|
DeviceRole["ClimateAc"] = "climate-ac";
|
|
362
367
|
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
@@ -831,6 +831,14 @@ export declare const CompositionNewTargetSchema: z.ZodObject<{
|
|
|
831
831
|
role: z.ZodOptional<z.ZodEnum<typeof DeviceRole>>;
|
|
832
832
|
}, z.core.$strip>;
|
|
833
833
|
export type CompositionNewTarget = z.infer<typeof CompositionNewTargetSchema>;
|
|
834
|
+
/**
|
|
835
|
+
* A STORED block, read back: the `new` target of its composition may name a
|
|
836
|
+
* device type D1033 retired (`thermostat`). {@link CompositionNewTargetSchema}
|
|
837
|
+
* stays a strict enum on the wire, so the store rewrites the retired name to
|
|
838
|
+
* its canonical type (`source.composition.target.type`) before it parses the
|
|
839
|
+
* row. Anything else is returned untouched, for the schema to judge.
|
|
840
|
+
*/
|
|
841
|
+
export declare function canonicalStoredBlockTarget(block: unknown): unknown;
|
|
834
842
|
/** Customize an EXISTING device: each feature adds a capability or replaces fields of a native one (D663). */
|
|
835
843
|
export declare const CompositionExistingTargetSchema: z.ZodObject<{
|
|
836
844
|
kind: z.ZodLiteral<"existing">;
|
|
@@ -9,5 +9,5 @@ export { KWH_PER_WATT_MS, wattMillisecondsToKwh } from './energy.js';
|
|
|
9
9
|
export { type HistoryValue, type IntegralScale, type SeriesBefore, type SeriesKind, type SeriesPoint, type SeriesRead, STATISTIC_STATS, SERIES_KINDS, evaluateDerivative, evaluateStatistic, integrateReading, } from './history-math.js';
|
|
10
10
|
export { type CalendarPeriod, type CalendarWindow, type HistoryRetention, type HistoryTier, type HistoryTierPlan, type OpenRange, type ResetPeriod, type RollingSpan, type RollingWindow, type StatisticWindow, CALENDAR_PERIODS, CalendarWindowSchema, DAY_MS, DEFAULT_HISTORY_RETENTION, historyRetentionFromSettings, HISTORY_FAST_MS, HISTORY_SLOW_MS, HISTORY_TIERS, HOUR_MS, MINUTE_MS, MIN_CUSTOM_MINUTES, RESET_PERIODS, ROLLING_SPANS, RollingWindowSchema, StatisticWindowSchema, integralCadenceMs, maxDurationMs, nextLocalMidnight, openReset, openStatistic, planResetTier, planStatisticTier, rollingDurationMs, statisticCadenceMs, } from './history-window.js';
|
|
11
11
|
export { type HelperMemberFact, helperSaveProblems, } from './save.js';
|
|
12
|
-
export { type SourcePick, type SourcePickAccept, type SourcePickFieldChoice, type SourcePickHistory, type SourcePickRequest, type MathSourceKind, sourcePickForHistory, sourcePickForMath, sourcePickForTemplate, } from './source-pick.js';
|
|
12
|
+
export { type SourcePick, type SourcePickAccept, type SourcePickFieldChoice, type SourcePickHistory, type SourcePickRequest, type MathSourceKind, sourcePickForHistory, sourcePickForMath, sourcePickAcceptsDevice, sourcePickForTemplate, } from './source-pick.js';
|
|
13
13
|
export { ACTIVE_CRITERIA, AGGREGATE_REDUCERS, ActiveCriterionSchema, AggregateReducerSchema, BINARY_AGGREGATES, GROUP_TEMPLATE_IDS, ARITHMETIC_OPS, ArithmeticHelperSpecSchema, DERIVATIVE_UNITS, DerivativeHelperSpecSchema, EXPRESSION_OUTPUTS, ExpressionHelperSpecSchema, ThresholdHelperSpecSchema, GroupHelperSpecSchema, GroupTemplateIdSchema, HelperMemberSchema, HelperSpecSchema, INTEGRAL_OUTPUTS, IntegralHelperSpecSchema, MAX_HELPER_MEMBERS, helperMembers, isHistoryHelper, NUMERIC_AGGREGATES, StatisticHelperSpecSchema, type ActiveCriterion, type AggregateReducer, type BinaryAggregate, type ArithmeticHelperSpec, type ArithmeticOp, type DerivativeHelperSpec, type DerivativeUnit, type ExpressionHelperSpec, type ExpressionInput, type ExpressionOutput, type ThresholdHelperSpec, type GroupHelperSpec, type GroupTemplateId, type HelperMember, type HelperSpec, type HistoryHelperSpec, type IntegralHelperSpec, type IntegralOutput, type NumericAggregate, type StatisticHelperSpec, type StatisticStat, } from './spec.js';
|
|
@@ -9,6 +9,8 @@ import type { CompositionProblem } from '../composition-report.js';
|
|
|
9
9
|
/** What a save learned about one member device. Absent keys were not read. */
|
|
10
10
|
export interface HelperMemberFact {
|
|
11
11
|
readonly deviceType?: DeviceType;
|
|
12
|
+
/** The member's role, when read: a `switch-light` relay is a light member. */
|
|
13
|
+
readonly role?: string | null;
|
|
12
14
|
readonly quantity?: ReadingQuantity;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The request the common source selector (#236) accepts for a helper (D944 §5).
|
|
3
|
-
* The selector's layout is not specified here. Groups ask for one device type
|
|
4
|
-
* and the catalog field; they do not opt into incompatible fields.
|
|
5
|
-
*/
|
|
6
1
|
import { DeviceType } from '../../device/device-type.js';
|
|
7
2
|
import type { CompositionSourceRef } from '../source-ref.js';
|
|
8
3
|
import type { GroupTemplate } from './catalog.js';
|
|
@@ -43,6 +38,17 @@ export interface SourcePick {
|
|
|
43
38
|
readonly compatibility: 'direct' | 'convert' | 'incompatible';
|
|
44
39
|
readonly history: 'recorded' | 'absent' | 'unknown';
|
|
45
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Does a device of this type and role answer the request's device types?
|
|
43
|
+
*
|
|
44
|
+
* The one gate both the member picker and the save use. No types = any device.
|
|
45
|
+
* A relay driving a lamp (`switch-light`) is a switch AND a light member: it
|
|
46
|
+
* joins a light group with its on/off only, and a command it cannot do
|
|
47
|
+
* (brightness, colour) skips it like any member that lacks the cap.
|
|
48
|
+
*/
|
|
49
|
+
export declare function sourcePickAcceptsDevice(request: Pick<SourcePickRequest, 'deviceTypes'>, deviceType: string, role: string | null | undefined): boolean;
|
|
50
|
+
/** `sourcePickAcceptsDevice` over a bare list of member types. */
|
|
51
|
+
export declare function memberKindAccepted(allowed: readonly DeviceType[], deviceType: string, role: string | null | undefined): boolean;
|
|
46
52
|
/** What the member step asks the selector for this template. */
|
|
47
53
|
export declare function sourcePickForTemplate(template: GroupTemplate): SourcePickRequest;
|
|
48
54
|
/** A statistic or integral reads one field that declares history. */
|
|
@@ -26,6 +26,8 @@ export interface CompositionSourceFound {
|
|
|
26
26
|
readonly caps: ReadonlySet<string>;
|
|
27
27
|
/** Present when the row was read. A helper group requires this one type. */
|
|
28
28
|
readonly deviceType?: DeviceType;
|
|
29
|
+
/** The row's role, when read: a `switch-light` relay joins a light group. */
|
|
30
|
+
readonly role?: string | null;
|
|
29
31
|
/** Present when the device declares one. Mixed quantities are refused. */
|
|
30
32
|
readonly quantity?: ReadingQuantity;
|
|
31
33
|
/**
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* device-icon — THE icon of a device, from what it IS: its {@link DeviceType},
|
|
3
|
+
* refined by its {@link DeviceRole}. One table for every surface: the admin's
|
|
4
|
+
* rows, cards, page header, lists and pickers draw it through ui-library's
|
|
5
|
+
* glyph table, the viewer through its catalog nodes. The value is a key of the
|
|
6
|
+
* icon catalog (D854), never a glyph.
|
|
7
|
+
*
|
|
8
|
+
* Exhaustive over both enums (`satisfies Record<…>`): a new type or role fails
|
|
9
|
+
* the build until it has an icon. Nothing here reads a name, a provider or a
|
|
10
|
+
* capability — an icon picked from those would be invented.
|
|
11
|
+
*
|
|
12
|
+
* Precedence: a known role → its icon; otherwise the type's icon; a type this
|
|
13
|
+
* build does not know → the generic type's icon. An operator's per-device or
|
|
14
|
+
* per-role display override is the caller's level above this one.
|
|
15
|
+
*/
|
|
16
|
+
import { DeviceRole, DeviceType } from './device-type.js';
|
|
17
|
+
/** The icon of each device type. */
|
|
18
|
+
export declare const DEVICE_TYPE_ICON: {
|
|
19
|
+
readonly camera: 'camera';
|
|
20
|
+
readonly hub: 'network';
|
|
21
|
+
readonly light: 'lightbulb';
|
|
22
|
+
readonly siren: 'siren';
|
|
23
|
+
readonly switch: 'toggle-left';
|
|
24
|
+
readonly sensor: 'activity';
|
|
25
|
+
readonly climate: 'thermometer';
|
|
26
|
+
readonly "heat-pump": 'flame';
|
|
27
|
+
readonly button: 'circle-dot';
|
|
28
|
+
readonly "event-emitter": 'zap';
|
|
29
|
+
readonly update: 'refresh-cw';
|
|
30
|
+
readonly generic: 'box';
|
|
31
|
+
readonly notifier: 'bell';
|
|
32
|
+
readonly script: 'scroll-text';
|
|
33
|
+
readonly automation: 'workflow';
|
|
34
|
+
readonly lock: 'lock';
|
|
35
|
+
readonly cover: 'blinds';
|
|
36
|
+
readonly valve: 'pipette';
|
|
37
|
+
readonly humidifier: 'waves';
|
|
38
|
+
readonly "water-heater": 'bath';
|
|
39
|
+
readonly fan: 'fan';
|
|
40
|
+
readonly "media-player": 'monitor-play';
|
|
41
|
+
readonly "alarm-panel": 'shield-alert';
|
|
42
|
+
readonly control: 'sliders-horizontal';
|
|
43
|
+
readonly presence: 'map-pin';
|
|
44
|
+
readonly weather: 'cloud-sun';
|
|
45
|
+
readonly vacuum: 'bot';
|
|
46
|
+
readonly "lawn-mower": 'tractor';
|
|
47
|
+
readonly container: 'box';
|
|
48
|
+
readonly image: 'image';
|
|
49
|
+
readonly "pet-feeder": 'bone';
|
|
50
|
+
readonly "pet-fountain": 'droplets';
|
|
51
|
+
readonly dishwasher: 'waves';
|
|
52
|
+
readonly washer: 'washing-machine';
|
|
53
|
+
readonly dryer: 'wind';
|
|
54
|
+
readonly gateway: 'router';
|
|
55
|
+
};
|
|
56
|
+
/** The icon of each role: what the device is FOR, which reads better than its type. */
|
|
57
|
+
export declare const DEVICE_ROLE_ICON: {
|
|
58
|
+
readonly siren: 'siren';
|
|
59
|
+
readonly floodlight: 'lightbulb';
|
|
60
|
+
readonly spotlight: 'flashlight';
|
|
61
|
+
readonly "pir-sensor": 'radar';
|
|
62
|
+
readonly chime: 'bell';
|
|
63
|
+
readonly autotrack: 'crosshair';
|
|
64
|
+
readonly nightvision: 'moon';
|
|
65
|
+
readonly "privacy-mask": 'eye-off';
|
|
66
|
+
readonly doorbell: 'door-closed';
|
|
67
|
+
readonly "cover-blind": 'blinds';
|
|
68
|
+
readonly "cover-shutter": 'blinds';
|
|
69
|
+
readonly "cover-awning": 'blinds';
|
|
70
|
+
readonly "cover-curtain": 'blinds';
|
|
71
|
+
readonly "cover-garage": 'door-closed';
|
|
72
|
+
readonly "cover-gate": 'door-closed';
|
|
73
|
+
readonly "cover-door": 'door-open';
|
|
74
|
+
readonly "cover-window": 'blinds';
|
|
75
|
+
readonly "binary-helper": 'toggle-left';
|
|
76
|
+
readonly outlet: 'plug';
|
|
77
|
+
readonly "switch-heater": 'flame';
|
|
78
|
+
readonly "switch-fan": 'fan';
|
|
79
|
+
readonly "switch-light": 'lightbulb';
|
|
80
|
+
readonly "climate-ac": 'air-vent';
|
|
81
|
+
readonly "climate-thermostat": 'thermometer';
|
|
82
|
+
readonly "climate-floor": 'waves';
|
|
83
|
+
readonly "climate-radiator": 'heater';
|
|
84
|
+
readonly "climate-heater": 'flame';
|
|
85
|
+
readonly "climate-heat-pump-circuit": 'refresh-cw';
|
|
86
|
+
readonly "motion-sensor": 'footprints';
|
|
87
|
+
readonly "contact-sensor": 'door-open';
|
|
88
|
+
readonly "leak-sensor": 'droplet';
|
|
89
|
+
readonly "smoke-sensor": 'alarm-smoke';
|
|
90
|
+
readonly "co-sensor": 'wind';
|
|
91
|
+
readonly "gas-sensor": 'flame';
|
|
92
|
+
readonly "tamper-sensor": 'shield-alert';
|
|
93
|
+
readonly "vibration-sensor": 'vibrate';
|
|
94
|
+
readonly "connectivity-sensor": 'wifi';
|
|
95
|
+
readonly "sound-sensor": 'volume-2';
|
|
96
|
+
readonly "binary-sensor": 'toggle-left';
|
|
97
|
+
readonly "temperature-sensor": 'thermometer';
|
|
98
|
+
readonly "humidity-sensor": 'droplets';
|
|
99
|
+
readonly "ambient-light-sensor": 'sun';
|
|
100
|
+
readonly "pressure-sensor": 'gauge';
|
|
101
|
+
readonly "wind-sensor": 'wind';
|
|
102
|
+
readonly "rain-sensor": 'cloud-rain';
|
|
103
|
+
readonly "uv-sensor": 'sun-medium';
|
|
104
|
+
readonly "solar-radiation-sensor": 'sunrise';
|
|
105
|
+
readonly "soil-moisture-sensor": 'sprout';
|
|
106
|
+
readonly "power-sensor": 'zap';
|
|
107
|
+
readonly "energy-sensor": 'zap';
|
|
108
|
+
readonly "voltage-sensor": 'zap';
|
|
109
|
+
readonly "current-sensor": 'zap';
|
|
110
|
+
readonly "air-quality-sensor": 'wind';
|
|
111
|
+
readonly "battery-sensor": 'gauge';
|
|
112
|
+
readonly "numeric-sensor": 'hash';
|
|
113
|
+
readonly "enum-sensor": 'list';
|
|
114
|
+
readonly "datetime-sensor": 'clock';
|
|
115
|
+
readonly "generic-sensor": 'gauge';
|
|
116
|
+
readonly "numeric-control": 'sliders-horizontal';
|
|
117
|
+
readonly "select-control": 'list-checks';
|
|
118
|
+
readonly "text-control": 'type';
|
|
119
|
+
readonly "datetime-control": 'clock';
|
|
120
|
+
readonly "mobile-push-notifier": 'smartphone';
|
|
121
|
+
readonly "messaging-notifier": 'message-square';
|
|
122
|
+
readonly "email-notifier": 'mail';
|
|
123
|
+
readonly "generic-notifier": 'bell';
|
|
124
|
+
readonly "ir-transmitter": 'radio-tower';
|
|
125
|
+
};
|
|
126
|
+
/** Every icon a device can be drawn with — a subset of the catalog the glyph tables must cover. */
|
|
127
|
+
export type DeviceIconKey = (typeof DEVICE_TYPE_ICON)[DeviceType] | (typeof DEVICE_ROLE_ICON)[DeviceRole];
|
|
128
|
+
/** The icon of a device type alone; a type this build does not know draws the generic one. */
|
|
129
|
+
export declare function deviceTypeIconKey(type: string): DeviceIconKey;
|
|
130
|
+
/** The icon of a role alone, or `null` for a role this build does not know. */
|
|
131
|
+
export declare function deviceRoleIconKey(role: string): DeviceIconKey | null;
|
|
132
|
+
/**
|
|
133
|
+
* The icon of a device: its role's when the role is known, else its type's.
|
|
134
|
+
* An unknown role never borrows another role's icon — it is drawn as its type.
|
|
135
|
+
*/
|
|
136
|
+
export declare function deviceIconKey(type: string, role?: string | null): DeviceIconKey;
|
|
@@ -5,9 +5,23 @@
|
|
|
5
5
|
* `switch-heater`; an air conditioner and a radiator valve are both `climate`,
|
|
6
6
|
* told apart by their `climate-*` role.
|
|
7
7
|
*/
|
|
8
|
+
import { z } from 'zod';
|
|
8
9
|
import { DeviceRole, DeviceType } from './device-type.js';
|
|
9
10
|
/** The live type a stored `type` value stands for (itself unless retired). */
|
|
10
11
|
export declare function canonicalStoredDeviceType(stored: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* The schema for a device type read back from STORAGE — a device config, a
|
|
14
|
+
* container's `entities[]`, a persisted identity. A retired type is read as its
|
|
15
|
+
* live type before the enum check, so a type retired after the record was
|
|
16
|
+
* written never fails the parse and never drops the device (D1033).
|
|
17
|
+
*
|
|
18
|
+
* Never on a schema that is also a WIRE input: a preprocess makes its input
|
|
19
|
+
* type `unknown`, which loosens the generated client. A store whose row schema
|
|
20
|
+
* is a wire schema (a grant, an action, a composition, a notification rule)
|
|
21
|
+
* keeps it strict and rewrites the row with {@link canonicalStoredDeviceType}
|
|
22
|
+
* where it reads the row back.
|
|
23
|
+
*/
|
|
24
|
+
export declare const StoredDeviceTypeSchema: z.ZodPreprocess<z.ZodEnum<typeof DeviceType>>;
|
|
11
25
|
/** The `climate-*` roles, in the order the role picker lists them. */
|
|
12
26
|
export declare const CLIMATE_ROLES: readonly DeviceRole[];
|
|
13
27
|
export type ClimateRole = DeviceRole.ClimateThermostat | DeviceRole.ClimateAc | DeviceRole.ClimateRadiator | DeviceRole.ClimateFloor | DeviceRole.ClimateHeater | DeviceRole.ClimateHeatPumpCircuit;
|
|
@@ -19,6 +33,28 @@ export type ClimateRole = DeviceRole.ClimateThermostat | DeviceRole.ClimateAc |
|
|
|
19
33
|
export declare function climateRoleOf(role: string | null | undefined): ClimateRole;
|
|
20
34
|
/** An air conditioner: exports present it as an AC unit, not a thermostat. */
|
|
21
35
|
export declare function isAirConditioner(type: string, role: string | null | undefined): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
|
|
38
|
+
* drawn and exported as a light, with the switch's power only. The one place
|
|
39
|
+
* that reads the role for it — a consumer asks this, never the role string.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isSwitchLight(type: string, role: string | null | undefined): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A smart plug (a `switch` with role `outlet`, D875): exported as a plug /
|
|
44
|
+
* outlet. Exports ask this, never the role string.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isOutlet(type: string, role: string | null | undefined): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* A plain fan behind a switch (a `switch` with role `switch-fan`): exported as
|
|
49
|
+
* a fan with the switch's on/off only — no speed it does not have.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isSwitchFan(type: string, role: string | null | undefined): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A plug-in heater behind a switch (a `switch` with role `switch-heater`): it
|
|
54
|
+
* has power only, no setpoint and no room temperature, so an export never
|
|
55
|
+
* presents it as a thermostat.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isSwitchHeater(type: string, role: string | null | undefined): boolean;
|
|
22
58
|
/** The part of a capability definition that says which devices it is offered on. */
|
|
23
59
|
export interface DeviceKindGate {
|
|
24
60
|
readonly deviceTypes?: readonly DeviceType[];
|
|
@@ -339,6 +339,11 @@ export declare enum DeviceRole {
|
|
|
339
339
|
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
340
340
|
* device also has a fan cap (D1033). */
|
|
341
341
|
SwitchFan = "switch-fan",
|
|
342
|
+
/** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
|
|
343
|
+
* slider), presented to the exports as a light with power only. Not a
|
|
344
|
+
* `light` type: the provider owns the type, and a light implies brightness
|
|
345
|
+
* or colour this relay lacks. */
|
|
346
|
+
SwitchLight = "switch-light",
|
|
342
347
|
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
343
348
|
ClimateAc = "climate-ac",
|
|
344
349
|
/** Room thermostat: a setpoint and a room temperature. The default. */
|