@mega-yfue/eufy-sdk 0.6.0-beta.43 → 0.6.0-beta.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3462,7 +3462,7 @@ function propertiesOf(members, ctx) {
3462
3462
  // stored value is that payload — see `PropertySpec.raw`.
3463
3463
  raw: m.decode ? true : void 0,
3464
3464
  readAliases: aliases?.slice(promoted ? 1 : 0).map(({ paramType, invert }) => ({ paramType, invert })),
3465
- writable: m.write !== void 0 || m.writtenElsewhere === true,
3465
+ writable: m.write !== void 0 && !(ctx && m.unverifiedFor?.(ctx)) || m.writtenElsewhere === true,
3466
3466
  reported: ctx?.paramIds ? wasReported(m, borrowedBy(m, members), { ...ctx, paramIds: ctx.paramIds }) : void 0,
3467
3467
  description: m.description
3468
3468
  }
@@ -3635,7 +3635,7 @@ function bindMembers(members, deps) {
3635
3635
  const get = decode ? () => decode(raw(), rawDp2, ctx) : () => narrow(m.type, read, prop, domain);
3636
3636
  Object.defineProperty(out, name, { get, enumerable: true, configurable: true });
3637
3637
  }
3638
- if (!m.write || m.unverified || !installs(m, ctx) || !writeRoutable(m, ctx))
3638
+ if (!m.write || m.unverified || m.unverifiedFor?.(ctx) || !installs(m, ctx) || !writeRoutable(m, ctx))
3639
3639
  continue;
3640
3640
  if (m.writeOnly)
3641
3641
  unobservable.push(name);
@@ -6865,25 +6865,12 @@ var LIGHT_SWITCH_INT_STRING_TYPES = /* @__PURE__ */ new Set([
6865
6865
  DeviceType.CAMERA3C,
6866
6866
  DeviceType.PROFESSIONAL_247
6867
6867
  ]);
6868
- function switchCommand(on, ctx) {
6869
- switch (lightSwitchWire(ctx)) {
6870
- case "json":
6871
- return setJson(LIGHT_CMD.FLOODLIGHT_SWITCH, { time: 0, type: 2, value: on ? 1 : 0 }, ctx);
6872
- case "int-string":
6873
- return setScalar(LIGHT_CMD.FLOODLIGHT_SWITCH, on ? 1 : 0, ctx, "int-string");
6874
- default:
6875
- return void 0;
6876
- }
6868
+ function switchCommand(on, wire, ctx) {
6869
+ return wire === "json" ? setJson(LIGHT_CMD.FLOODLIGHT_SWITCH, { time: 0, type: 2, value: on ? 1 : 0 }, ctx) : setScalar(LIGHT_CMD.FLOODLIGHT_SWITCH, on ? 1 : 0, ctx, "int-string");
6877
6870
  }
6878
6871
  function directBinary(param, value, ctx) {
6879
6872
  return setScalar(param, value, ctx, "direct-binary");
6880
6873
  }
6881
- function switchFrame(on, ctx) {
6882
- const cmd = switchCommand(on, ctx);
6883
- if (!cmd)
6884
- throw new Error(`light: unknown spotlight switch wire format \u2014 confirm it [${describeDevice(ctx)}]`);
6885
- return cmd;
6886
- }
6887
6874
  var LIGHT_MEMBERS = {
6888
6875
  /**
6889
6876
  * Whether the lamp is lit RIGHT NOW — the momentary switch, not a setting. Measured on a T8170: 1400
@@ -6894,9 +6881,8 @@ var LIGHT_MEMBERS = {
6894
6881
  * So it reads on whenever any client is watching. The setting a user changes and expects to persist
6895
6882
  * is {@link spotlightEnabled}.
6896
6883
  *
6897
- * The switch refuses for a reason a value check cannot give — this model's frame SHAPE is unconfirmed —
6898
- * so `switchFrame` throws that reason and `bindMembers` turns it into the rejection, rather than
6899
- * letting the generated "not a valid value" blame a boolean that was never the problem.
6884
+ * The switch frame SHAPE is per family ({@link lightSwitchWire}), and the write is `unverifiedFor` the
6885
+ * families it has no shape for.
6900
6886
  */
6901
6887
  isOn: {
6902
6888
  param: LIGHT_CMD.FLOODLIGHT_SWITCH,
@@ -6905,7 +6891,11 @@ var LIGHT_MEMBERS = {
6905
6891
  kind: "boolean",
6906
6892
  provenance: "verified",
6907
6893
  description: "Light on/off (1400) \u2014 lit right now, not a setting: it follows whichever client is streaming. Verified via P2P state readback (3/3); session-scoped behaviour measured live on a T8170.",
6908
- write: (v, ctx) => switchFrame(asBool(v), ctx),
6894
+ write: (v, ctx) => {
6895
+ const wire = lightSwitchWire(ctx);
6896
+ return wire && switchCommand(asBool(v), wire, ctx);
6897
+ },
6898
+ unverifiedFor: (ctx) => lightSwitchWire(ctx) === void 0,
6909
6899
  writeAs: "set",
6910
6900
  aliases: { on: true, off: false }
6911
6901
  },
@@ -6986,14 +6976,15 @@ var LIGHT = {
6986
6976
  * Only what the member table cannot express: `on`/`off` as no-argument verbs over the same wire as the
6987
6977
  * derived `set`, and the write-only auto-spotlight composite. The verbs stay UNDESCRIBED on purpose —
6988
6978
  * `set` is the method that takes the value, and describing all three would offer one state as three
6989
- * controls. `async` is what turns `switchFrame`'s throw into the rejection a `Promise<void>`
6990
- * caller expects, the same shape the derived setter gets from `bindMembers`.
6979
+ * controls. Like `set`, the verbs are absent on a model whose switch shape is unverified.
6991
6980
  */
6992
6981
  actions({ ctx, sink }) {
6993
- const dispatchSwitch = async (on) => sink.dispatch(switchFrame(on, ctx));
6982
+ const wire = lightSwitchWire(ctx);
6994
6983
  return {
6995
- on: () => dispatchSwitch(true),
6996
- off: () => dispatchSwitch(false),
6984
+ ...wire && {
6985
+ on: () => sink.dispatch(switchCommand(true, wire, ctx)),
6986
+ off: () => sink.dispatch(switchCommand(false, wire, ctx))
6987
+ },
6997
6988
  setAutoSpotlight: (on, opts) => sink.dispatch(autoSpotlightCommand(asBool(on), ctx, opts))
6998
6989
  };
6999
6990
  }
@@ -11862,8 +11853,8 @@ function memberCommand(m, action, value, ctx) {
11862
11853
  const claims = action === property2 || member.intentNames?.includes(action) === true;
11863
11854
  if (!claims && aliased === void 0)
11864
11855
  continue;
11865
- if (member.unverified) {
11866
- throw new Error(`${m.capability}: ${name} write wire unverified \u2014 confirm it on a device before sending`);
11856
+ if (member.unverified || member.unverifiedFor?.(ctx)) {
11857
+ throw new Error(`${m.capability}: ${name} write wire unverified \u2014 confirm it on a device before sending [${describeDevice(ctx)}]`);
11867
11858
  }
11868
11859
  if (!member.write || !installs(member, ctx))
11869
11860
  continue;