homematic-manager 3.0.0-beta.6 → 3.0.0-beta.7

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.
@@ -183,7 +183,14 @@ export async function startForTest(options = {}) {
183
183
  }
184
184
  }
185
185
  const ports = simulator
186
- ? { 'BidCos-RF': simulator.ports.rfd, 'HmIP-RF': simulator.ports.hmip }
186
+ ? {
187
+ 'BidCos-RF': simulator.ports.rfd,
188
+ 'HmIP-RF': simulator.ports.hmip,
189
+ // only when the simulator was given a `virtualListenPort` (the CCU's group process)
190
+ ...(typeof simulator.ports.virtual === 'number'
191
+ ? { VirtualDevices: simulator.ports.virtual }
192
+ : {}),
193
+ }
187
194
  : {};
188
195
  const host = await createWebHost({
189
196
  port: 0,
@@ -206,7 +213,7 @@ export async function startForTest(options = {}) {
206
213
  if (simulator && host.backend) {
207
214
  const connection = {
208
215
  host: '127.0.0.1',
209
- interfaces: ['BidCos-RF', 'HmIP-RF'],
216
+ interfaces: ['BidCos-RF', 'HmIP-RF', ...(ports['VirtualDevices'] === undefined ? [] : ['VirtualDevices'])],
210
217
  autoDetect: false,
211
218
  extraInterfaces: [],
212
219
  tls: false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homematic-manager/backend",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "type": "module",
5
5
  "description": "Homematic Manager backend: XML-RPC/BIN-RPC clients and callback servers, caches, optional ReGa",
6
6
  "license": "AGPL-3.0-or-later",
@@ -72,6 +72,13 @@ export declare const RX_MODES: {
72
72
  * by itself and one that does not (task 6).
73
73
  */
74
74
  export declare function decodeRxMode(rxMode: number | undefined): string[];
75
+ /**
76
+ * Is roaming on for this device? rfd reports `ROAMING` as `1`/`0` over BIN-RPC and as a boolean
77
+ * over XML-RPC, so both spellings mean yes.
78
+ */
79
+ export declare function isRoaming(device: {
80
+ readonly ROAMING?: boolean | number | undefined;
81
+ }): boolean;
75
82
  /** `DIRECTION` of a channel. */
76
83
  export declare const DIRECTIONS: readonly ["NONE", "SENDER", "RECEIVER"];
77
84
  /** Decodes `DIRECTION`; anything unexpected is `NONE`, as the 2.x grid did. */
@@ -55,6 +55,13 @@ export function decodeRxMode(rxMode) {
55
55
  }
56
56
  return names;
57
57
  }
58
+ /**
59
+ * Is roaming on for this device? rfd reports `ROAMING` as `1`/`0` over BIN-RPC and as a boolean
60
+ * over XML-RPC, so both spellings mean yes.
61
+ */
62
+ export function isRoaming(device) {
63
+ return device.ROAMING === true || device.ROAMING === 1;
64
+ }
58
65
  /** `DIRECTION` of a channel. */
59
66
  export const DIRECTIONS = ['NONE', 'SENDER', 'RECEIVER'];
60
67
  /** Decodes `DIRECTION`; anything unexpected is `NONE`, as the 2.x grid did. */
@@ -7,6 +7,7 @@
7
7
  * as events and sit in every device's `<device>:0` VALUES paramset - the same thing 2.x does in
8
8
  * main.js (:404-432 for the events, :800-822 for the paramset read).
9
9
  */
10
+ import type { BidcosInterfaceInfo } from '../api/types.js';
10
11
  import type { Paramset, ParamsetValue } from '../rpc/values.js';
11
12
  /** What an interface process sends instead of a value it does not have. */
12
13
  export declare const RSSI_UNKNOWN = 65536;
@@ -41,6 +42,24 @@ export declare function rssiClass(dbm: number | undefined): RssiClass;
41
42
  * `undefined` for a value there is none for - the cell stays empty, as it did.
42
43
  */
43
44
  export declare function rssiColor(dbm: number | undefined): string | undefined;
45
+ /** The two fields of a `listBidcosInterfaces` entry that name it. */
46
+ export type BidcosInterfaceName = Pick<BidcosInterfaceInfo, 'ADDRESS' | 'DESCRIPTION'>;
47
+ /**
48
+ * How a BidCos interface is named for a person: the `DESCRIPTION` the CCU carries for it - the
49
+ * name a LAN gateway was given in the WebUI, `CCU2-Coprocessor` for the built-in module - and the
50
+ * serial when there is none. The 2.x Funk grid put the serial over the interface's columns with
51
+ * the description in small print under it; a gateway without a description shows its serial alone.
52
+ */
53
+ export declare function bidcosInterfaceLabel(gateway: BidcosInterfaceName): string;
54
+ /**
55
+ * The receiver a BidCos-RF device is routed through, for the device grid (BUGS.md B-2): the
56
+ * label of the gateway whose serial the description's `INTERFACE` names, the serial itself when
57
+ * `listBidcosInterfaces` does not know it or has not been read yet, and nothing for a device
58
+ * without one - HmIP and Wired have no receivers.
59
+ */
60
+ export declare function receiverLabel(device: {
61
+ readonly INTERFACE?: string | undefined;
62
+ }, gateways: readonly BidcosInterfaceName[]): string;
44
63
  /** The HmIP datapoints the matrix is built from. */
45
64
  export declare const RSSI_DATAPOINTS: readonly string[];
46
65
  export interface RssiStoreOptions {
@@ -59,6 +59,30 @@ export function rssiColor(dbm) {
59
59
  const green = channel((256 * (value - RSSI_BAD)) / (RSSI_MEDIUM - RSSI_BAD));
60
60
  return `#${hex(red)}${hex(green)}00`;
61
61
  }
62
+ /**
63
+ * How a BidCos interface is named for a person: the `DESCRIPTION` the CCU carries for it - the
64
+ * name a LAN gateway was given in the WebUI, `CCU2-Coprocessor` for the built-in module - and the
65
+ * serial when there is none. The 2.x Funk grid put the serial over the interface's columns with
66
+ * the description in small print under it; a gateway without a description shows its serial alone.
67
+ */
68
+ export function bidcosInterfaceLabel(gateway) {
69
+ const description = gateway.DESCRIPTION?.trim() ?? '';
70
+ return description === '' ? gateway.ADDRESS : description;
71
+ }
72
+ /**
73
+ * The receiver a BidCos-RF device is routed through, for the device grid (BUGS.md B-2): the
74
+ * label of the gateway whose serial the description's `INTERFACE` names, the serial itself when
75
+ * `listBidcosInterfaces` does not know it or has not been read yet, and nothing for a device
76
+ * without one - HmIP and Wired have no receivers.
77
+ */
78
+ export function receiverLabel(device, gateways) {
79
+ const serial = device.INTERFACE ?? '';
80
+ if (serial === '') {
81
+ return '';
82
+ }
83
+ const gateway = gateways.find((candidate) => candidate.ADDRESS === serial);
84
+ return gateway ? bidcosInterfaceLabel(gateway) : serial;
85
+ }
62
86
  /** The HmIP datapoints the matrix is built from. */
63
87
  export const RSSI_DATAPOINTS = ['RSSI_DEVICE', 'RSSI_PEER'];
64
88
  /** The RSSI matrix of one interface. */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homematic-manager/core",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "type": "module",
5
5
  "description": "Pure domain logic of the Homematic Manager: no I/O, no DOM",
6
6
  "license": "AGPL-3.0-or-later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homematic-manager",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "type": "module",
5
5
  "description": "Configure and administer Homematic and HomematicIP devices - devices and channels, direct links, paramsets, RSSI, service messages, events and an RPC console - from a local HTTP/WebSocket server that also serves the web UI",
6
6
  "keywords": [
@@ -67,8 +67,8 @@
67
67
  "hm-simulator": "^1.0.0"
68
68
  },
69
69
  "dependencies": {
70
- "@homematic-manager/backend": "3.0.0-beta.6",
71
- "@homematic-manager/core": "3.0.0-beta.6",
70
+ "@homematic-manager/backend": "3.0.0-beta.7",
71
+ "@homematic-manager/core": "3.0.0-beta.7",
72
72
  "binrpc": "^4.2.0",
73
73
  "homematic-rega": "^2.0.0",
74
74
  "homematic-xmlrpc": "^2.0.0",