iobroker.zigbee 2.0.1 → 2.0.3

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/README.md CHANGED
@@ -9,19 +9,15 @@
9
9
  [![Translation status](https://weblate.iobroker.net/widgets/adapters/-/zigbee/svg-badge.svg)](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)
10
10
  [![Downloads](https://img.shields.io/npm/dm/iobroker.zigbee.svg)](https://www.npmjs.com/package/iobroker.zigbee)
11
11
 
12
- ## ioBroker adapter for Zigbee devices via TI cc26x2r/cc2538/cc26x2px and deCONZ ConBee/RaspBee.
13
- ### cc2531/cc2530 are obsolet
12
+ ## ioBroker adapter for Zigbee devices via Zigbee coordinator hardware.
14
13
 
15
- With the Zigbee-coordinator based on Texas Instruments SoC, deCONZ ConBee/RaspBee modules, Silicon Labs EZSP v8 or ZIGate USB-TTL it creates its own zigbee-network, into which zigbee-devices are connected.
14
+ Using specialized Zigbee-coordinator hardware, the adapter creates and manages a Zigbee Network which can control and connect a large number of Zigbee Devices. The list of compatible devices inlcudes > 4000 devices from > 450 different vendors. The number of devices in the network depends on the available coordinator hardware. Common coordinator hardware are USB sticks with Texas Instruments CC26xx, Silicon Labs EZSP or ZIGate chipsetz. Some branded USB devices (Sonoff ZB-Dongle, Dresden Electronic Conbee) can also be used. There are also network-based hubs from various manufacturers.
16
15
 
17
-
18
-
19
- By working directly with the coordinator, the driver allows you to manage devices without additional application / gateways / bridge from device manufacturers (Xiaomi / TRADFRI / Hue / Tuya). About the device Zigbee-network can be read [here (in English)](https://www.zigbee2mqtt.io/information/zigbee_network.html).
16
+ By working directly with the coordinator, the driver allows you to manage devices without additional application / gateways / bridge from device manufacturers (Xiaomi / TRADFRI / Hue / Tuya). More information about the Zigbee-network can be read [here (in English)](https://www.zigbee2mqtt.io/information/zigbee_network.html).
20
17
 
21
18
  ## Hardware
22
19
 
23
-
24
- One coordinator device is required for each zigbee Adapter instance. The device must be flashed with the respective coordinator firmware. A list of supported coordinators, the necessary equipment for the firmware and the device preparation process for different coordinator devices are described [here in English](https://www.zigbee2mqtt.io/guide/adapters/) or [smarthomescene.com ](https://smarthomescene.com/blog/best-zigbee-dongles-for-home-assistant-2023/) or [here in Russian](https://myzigbee.ru/books/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B8/page/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B0-cc2531cc2530)
20
+ One coordinator device is required for each Zigbee Adapter instance. The device must be flashed with the respective coordinator firmware. A list of supported coordinators, the necessary equipment for the firmware and the device preparation process for different coordinator devices are described [here in English](https://www.zigbee2mqtt.io/guide/adapters/) or [smarthomescene.com ](https://smarthomescene.com/blog/best-zigbee-dongles-for-home-assistant-2023/) or [here in Russian](https://myzigbee.ru/books/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B8/page/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B0-cc2531cc2530)
25
21
 
26
22
 
27
23
  ### Texas Instruments SoC
@@ -36,7 +32,6 @@ Current firmware files for these devices can be found [on GitHub](https://github
36
32
  <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/CC2538_CC2592_PA.PNG" width="100"></span>
37
33
  <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/cc26x2r.PNG" width="100"></span>
38
34
 
39
- tutorial/zigbee.png
40
35
  ### Dresden Elektronik SoC
41
36
  <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/en/img/deconz.png" width="180"></span>
42
37
 
@@ -63,62 +58,82 @@ Support for [Silicon Lab Zigbee](https://www.silabs.com/wireless/zigbee) based a
63
58
  Support for [ZiGate](https://zigate.fr) based adapters is experimental. The initial support for ZiGate is still not yet considered stable, and the project is in need of more developers volunteering to help with this integration. Please refer to the respective documentation on [this page](https://www.zigbee2mqtt.io/guide/adapters/) and [ongoing development discussion](https://github.com/Koenkk/zigbee-herdsman/issues/242) with regards to the state of ZiGate adapter implementation into the zigbee-herdsman and zigbee-herdsman-converters libraries which it depends on.
64
59
 
65
60
 
66
- ## Work with adapter
61
+ ## Getting started
62
+
63
+ The adapter should **always** be installed from within the ioBroker Admin. Direct npm and GitHub installations are **not recommended**.
64
+
65
+ At first start, it is vital to set up the adapter settings. These include:
66
+ - the communication to the zigbee Coordinator (COM Port). This can be a device identifier or a network address for Network-based coordinators
67
+ - the required firmware-Type
68
+ - the network parameters PanID (a number between 0 and 65565), extended PanID (a 16 digit HEX number) and the zigbee Channel **important: Do not run the adapter without changing the values for PanID (6754) and Extended PanID (DDDDDDDDDDDDDDDD) to unique values for your Zigbee Installation.**
69
+
70
+
71
+ ![](docs/de/img/Zigbee_config_de.png)
72
+ Please refer to the [in depth documentation](docs/en/readme.md) ([german version](docs/de/readme.md), [russian version](docs/ru/readme.md)) for a detailed explanation on how to configure the adapter.
73
+
74
+ Once the adapter is up and running, the desired devices need to be integrated into the network. This requires for both the adapter and the device to be in pairing mode. Most new devices will be in pairing-mode when they are powered up for the first time, but some will require a special procedure for this. Please refer to the device manual for information on this.
75
+
76
+ The adapter is placed in pairing mode by pressing the pairing button:
77
+ ![](docs/de/img/Bild12.png)
67
78
 
68
- ![](docs/tutorial/zigbee.png)
79
+ A dialog showing a pairing countdown appears. When a new device is discovered, interviewed and paired with the network, messages will be shown in this dialog, and the device will show up in the grid of active devices. Any known device should show up with an image and the correct device name, as well as a number of changable settings. Any unknown device will show up with a device name and a ? as icon, while devices which failed the pairing will show up as 'unknown' with the same ? icon. These should be removed from the network to be paired again. Please refer to the documentation linked above for more details.
69
80
 
70
- To start the driver, you must specify the name of the port on which the Zigbee module (stick) is connected. Usually this is the port `/dev/ttyACM0` or `/dev/ttyUSB0` for the UART-connection. Or you can find with `ls -l /dev/serial/by-id` the device direct.
81
+ ## Advanced options
71
82
 
72
- open the settings and change port
73
- ![](docs/tutorial/settings.png)
83
+ ### Groups
74
84
 
85
+ The adapter allows for the creation of groups via the 'add group' button. Once a group has been formed, devices can be added to and removed from the group from the device card. Removal is also possible from the group card.
86
+ Groups have the advantage that a single command is sent to control all group members. This is especially helpful when changing the groups brightness and/or color settings.
87
+ Note that not all devices may be added to groups - the device itself needs to support this feature.
75
88
 
76
- For Windows, this will be the COM port number.
89
+ Group configuration is available from the device grid.
77
90
 
78
- Starting from version 1.0.0, you can also use *tcp connection* for cases using esp8266 (or other microcontrollers) as serial-bridge. For example `tcp://192.168.1.46:8880`. Read more info here https://www.zigbee2mqtt.io/information/connecting_cc2530#via-an-esp8266
91
+ ### Bindings
79
92
 
80
- To connect devices, you need to switch the Zigbee coordinator to pairing mode by pressing the green button. The countdown will begin (60 seconds) until the device connectivity is available.
81
- To connect Zigbee devices in most cases, just press the pairing button on the device itself. But there are features for some devices. More information about pairing with devices can be found [here (in English)](https://www.zigbee2mqtt.io/getting_started/pairing_devices.html)
93
+ Bindings can be used to link a remote control directly to a device, like it is e.g. done for the ikea devices. This binding has the advantage that bound devices will continue to work together even if the Zigbee Coordinator is unavailable.
94
+ Note that not all devices may be part of a binding - the devices themselves need to support this feature.
82
95
 
83
- After successful pairing, the device appears in the configuration panel. If the device appears in the configuration panel but has the type "undefined", then this is an unknown device and cannot be worked with it. If the device is in the list of available devices, but added as "undefined", then try to remove the device and add it again.
96
+ The binding configuration is only available from the zigbee tab
84
97
 
85
- The devices connected to the Zigbee-network and inform the coordinator of their status and events (button presses, motion detection, temperature change). This information is reflected in the ioBroker object-states. Some ioBroker states have feedback and send commands to the zigbee-device when the value changes (switching the state of the outlet or lamp, changing the scene or the brightness of the lamp).
98
+ ### Network Map
86
99
 
87
- ### Device Groups
88
- You may create groups of devices.
100
+ The adapter has the ability to generate a map of the mesh network. This usually takes a few minutes and provides a momentary glimpse into how the devices are meshed with each other.
89
101
 
90
- ![](docs/tutorial/groups-1.png)
102
+ The network map is only available the zigbee tab.
91
103
 
92
- It is a Zigbee feature, intended for example to switch bulbs synchronized. Assign groups via device tabs edit button. A group will show as own "device" in Objects.
104
+ ### Debug information
93
105
 
94
- ![](docs/tutorial/groups-2.png)
106
+ The Adapter offers to collect debug information for specific devices in order to identify problems in device operation and integration. This needs to be enabled on the desired devices from the device grid.
95
107
 
96
- Note: Not all devices support groups (not supported by end devices like sensors).
108
+ The debug information is only available from the zigbee tab.
97
109
 
110
+ ### Local overrides
98
111
 
99
- ### Binding
112
+ Device integration can be modified on a *per Model* basis, allowing the user to customise the states associated with the device. Note that before version 2.1.0, this is limited to choosing between the default *expose based* integration and the previous *legacy* integration. More options for customisation are under development.
100
113
 
101
- https://www.zigbee2mqtt.io/information/binding
114
+ The local overrides are only available from the instance configuration
115
+
116
+ ### Developer Mode
117
+
118
+ The developer mode offers the ability to communicate with any paired device solely based on the details of the Zigbee communication rules. Use of this requires an insight into Zigbee Clusters, Attributes and messaging structure. It can be used to control devices which are not currently supported. An in depth desctiption of the developer Tab is available in the documentation.
119
+
120
+ The developer tab is only available from the instance configuration
102
121
 
103
- ### Developer Tab
104
122
 
105
- This is a tool for advanced users to test currently unsupported devices or enhance this adapter's functionality. More instructions can be found on the tab.
106
- ![](docs/tutorial/tab-dev-1.png)
107
123
 
108
124
  ## Additional info
109
125
 
110
- There is a [friendly project](https://github.com/koenkk/zigbee2mqtt) with similar functionality on the same technologies, where you can work with the same devices using the MQTT protocol. Therefore, if any improvements or support for new zigbee-devices occur in the Zigbee2MQTT project, we can transfer and add the same functionality to this adapter. If you notice this, then write the issue - we'll postpone it.
126
+ There is a [friendly project](https://github.com/koenkk/zigbee2mqtt) with similar functionality which is based on the same technology. It uses the same base libraries for hardware communication and device integration. Any device listed as compatible in this project is likely to be compatible with the ioBroker.zigbee Adapter. Note that there is a delay between device integration into zigbee2mqtt.io and the Zigbee-Adapter, as compatibility with the hardware libraries requires verification before the adapter can move to the latest version.
111
127
 
112
128
  There are knowledge bases that can be useful for working with Zigbee-devices and equipment:
113
- * in English https://www.zigbee2mqtt.io/
129
+ * in English https://www.zigbee2mqtt.io/ or https://zigbee.blakadder.com
114
130
  * in Russian https://myzigbee.ru/
115
131
 
116
132
  ## Supported devices
117
133
 
118
- [Works with devices from this list](https://github.com/ioBroker/ioBroker.zigbee/wiki/Supported-devices)
119
-
134
+ Pleae refer to [this list](https://www.zigbee2mqtt.io/supported-devices/) to check compatibility. Once a device is listed as compatible there, it is either already compatible with the Zigbee Adapter or can be made compatible using an external converter.
120
135
 
121
- ## More Information
136
+ ## In Depth Documentation
122
137
 
123
138
  [in Deutsch](https://github.com/ioBroker/ioBroker.zigbee/blob/master/docs/de/readme.md)
124
139
 
@@ -137,6 +152,32 @@ You can thank the authors by these links:
137
152
 
138
153
  -----------------------------------------------------------------------------------------------------
139
154
  ## Changelog
155
+ ### 2.0.3 (2025-03-07)
156
+ * fix configured info
157
+ * fix battery voltage (V -> mV)
158
+ * enable debug interface v1.0
159
+ * Push Zigbee-Herdsman to 3.5.7
160
+ * Push Zigbee-Herdsman-Converters to 23.1.1
161
+ * fix configure on message
162
+ * remove extra warning messages
163
+ * fix Adapter-Checker notes
164
+ * improve base64 image detection
165
+ * removed unused adaptert objects (info.groups, excludes) from adapter config
166
+ *
167
+
168
+ ### 2.0.2 (2025-03-02)
169
+ * fix expose generation with expose function requiring a device. (Issue #1842)
170
+ * fix failure to configure for devices needing multiple configurations (Issue #2375)
171
+ * fix hold/release and press/release action handling (Issue #2387)
172
+ * fix lib/legacy requirement for external converters (Issue #2376)
173
+ * improved external converter handling
174
+ * fix OTA bug
175
+ * improved message handling for devices which report values outside their defined ranges
176
+ * preparation for ZHC 22.x (model definition loaded on demand
177
+ * fix legacy definition for devices
178
+ * added action state for remotes.
179
+ *
180
+
140
181
  ### 2.0.1 (2025-02-25)
141
182
  * BREAKING CHANGES
142
183
  *
package/admin/admin.js CHANGED
@@ -1,5 +1,4 @@
1
1
  /*global $, M, _, sendTo, systemLang, translateWord, translateAll, showMessage, socket, document, instance, vis, Option*/
2
-
3
2
  /*
4
3
  * you must run 'iobroker upload zigbee' if you edited this file to make changes visible
5
4
  */
@@ -31,7 +30,10 @@ let devices = [],
31
30
  },
32
31
  cidList,
33
32
  shuffleInstance,
34
- errorData = [];
33
+ errorData = [],
34
+ debugMessages = {};
35
+ const dbgMsgfilter = new Set();
36
+ const dbgMsghide = new Set();
35
37
  const updateCardInterval = setInterval(updateCardTimer, 6000);
36
38
 
37
39
  const networkOptions = {
@@ -240,7 +242,6 @@ function getCard(dev) {
240
242
  rooms.push(dev.rooms[r]);
241
243
  }
242
244
  }
243
- console.warn('debug for ' + ieee + ' is ' + isDebug);
244
245
  const room = rooms.join(',') || '&nbsp';
245
246
  const paired = (dev.paired) ? '' : '<i class="material-icons right">leak_remove</i>';
246
247
  const rid = id.split('.').join('_');
@@ -400,7 +401,7 @@ function EndPointIDfromEndPoint(ep) {
400
401
  }
401
402
 
402
403
  function editName(id, name) {
403
- console.log('editName called with ' + name);
404
+ console.warn('editName called with ' + id + ' and ' + name);
404
405
  const dev = devices.find((d) => d._id == id);
405
406
  $('#modaledit').find('input[id=\'d_name\']').val(name);
406
407
  const groupables = [];
@@ -830,7 +831,6 @@ async function selectImageOverride(id) {
830
831
  sendTo(namespace, 'getLocalImages', {}, function(msg) {
831
832
  if (msg && msg.imageData) {
832
833
  const imagedata = msg.imageData;
833
- console.warn(JSON.stringify(dev.common));
834
834
  const default_icon = (dev.common.type === 'group' ? dev.common.modelIcon : `img/${dev.common.type.replace(/\//g, '-')}.png`);
835
835
  if (dev.legacyIcon) imagedata.unshift( { file:dev.legacyIcon, name:'legacy', data:dev.legacyIcon});
836
836
  imagedata.unshift( { file:'none', name:'default', data:default_icon});
@@ -844,10 +844,10 @@ async function selectImageOverride(id) {
844
844
  return image.file;
845
845
  },
846
846
  function (key, image) {
847
- if (image.file.length < 50) {
848
- return `data-icon="${image.data}"`;
849
- } else {
847
+ if (image.isBase64) {
850
848
  return `data-icon="data:image/png; base64, ${image.data}"`;
849
+ } else {
850
+ return `data-icon="${image.data}"`;
851
851
  }
852
852
  },
853
853
  );
@@ -857,7 +857,6 @@ async function selectImageOverride(id) {
857
857
  const image = $('#chooseimage').find('#images option:selected').val();
858
858
  const global = $('#chooseimage').find('#globaloverride').prop('checked');
859
859
  const name = $('#chooseimage').find('input[id=\'d_name\']').val();
860
- console.warn(`update device image : ${id} : ${image} : ${global} : ${name} : ${dev.common.name}`);
861
860
  const data = {};
862
861
  if (image != 'current') data.icon= image;
863
862
  if (name != dev.common.name) data.name = name;
@@ -869,6 +868,197 @@ async function selectImageOverride(id) {
869
868
  });
870
869
  }
871
870
 
871
+
872
+ function safestring(val) {
873
+ const t = typeof val;
874
+ if (t==='object') return JSON.stringify(val).replaceAll(',',', ');
875
+ if (t==='string') return val.replaceAll(',',', ');
876
+ if (t==='function') return 'function';
877
+ return val;
878
+ }
879
+
880
+ function fne(item) {
881
+ const rv = [];
882
+ if (item.flags) {
883
+ if (item.flags.includes('SUCCESS')) rv.push('SUCCESS');
884
+ else rv.push(...item.flags);
885
+ }
886
+ if (item.errors && item.errors.length > 0) {
887
+ if (item.errors.length > 1) rv.push('errors: '+item.errors.join(','));
888
+ else rv.push('error: '+item.errors[0]);
889
+ }
890
+ return rv.join(', ');
891
+ }
892
+
893
+ function HtmlFromInDebugMessages(messages, devID, filter) {
894
+ const Html = [];
895
+ const filterSet = new Set();
896
+ let isodd = true;
897
+ if (dbgMsghide.has('i_'+devID)) {
898
+ console.warn('in all filtered out')
899
+ Html.push('&nbsp;')
900
+ } else for (const item of messages) {
901
+ if (item.states.length > 0) {
902
+ const rowspan = item.states.length > 1 ? ` rowspan="${item.states.length}"` : '';
903
+ let idx = item.states.length;
904
+ const IHtml = [];
905
+ let fs = '';
906
+ for (const state of item.states) {
907
+ fs = fs+state.id+'.'+fne(item);
908
+ const redText = (item.errors && item.errors.length > 0 ? ' id="dbgred"' : '');
909
+ idx--;
910
+ const LHtml = [(`<tr id="${isodd ? 'dbgrowodd' : 'dbgroweven'}">`)];
911
+ if (idx==0)
912
+ LHtml.push(`<td${rowspan}>${item.dataID.toString(16).slice(-4)}</td><td${rowspan}>${safestring(item.payload)}</td>`);
913
+ LHtml.push(`<td></td><td${redText}>${safestring(state.payload)}</td><td${redText}>${state.id}</td><td${redText}>${state.value}</td><td${redText}>${fne(item)}</td></tr>`);
914
+ IHtml.unshift(...LHtml)
915
+ }
916
+ if (filter)
917
+ if (filterSet.has(fs)) continue; else filterSet.add(fs);
918
+ Html.unshift(...IHtml);
919
+ isodd=!isodd;
920
+ }
921
+ }
922
+ const ifbutton = `<a id="i_${devID}" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsgfilter.has('i_'+devID) ? 'filter_list' : 'format_align_justify' }</i></a>`
923
+ const ofbutton = `<a id="hi_${devID}" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsghide.has('i_'+devID) ? 'unfold_more' : 'unfold_less' }</i></a>`
924
+ const dataHide = dbgMsgfilter.has('hi_'+devID) ? 'Data hidden' : '&nbsp;';
925
+ return `<thead id="dbgtable"><tr><td>&nbsp</td><td>Incoming messages</td><td>&nbsp;</td><td>&nbsp;</td><td>${dataHide}</td><td>${ifbutton}</td><td>${ofbutton}</td></tr><tr><td>ID</td><td>Zigbee Payload</td><td>&nbsp;</td><td>State Payload</td><td>ID</td><td>value</td><td>Flags</td></tr></thead><tbody>${Html.join('')}</tbody>`;
926
+ }
927
+
928
+
929
+ function HtmlFromOutDebugMessages(messages, devID, filter) {
930
+ const Html = [];
931
+ const filterSet = new Set();
932
+ let isodd=true;
933
+ if (dbgMsghide.has('o_'+devID)) {
934
+ console.warn('out all filtered out')
935
+ Html.push('&nbsp;')
936
+ }
937
+ else for (const item of messages) {
938
+ if (item.states.length > 0) {
939
+ const rowspan = item.states.length > 1 ? ` rowspan="${item.states.length}"` : '';
940
+ let idx = item.states.length;
941
+ let fs = '';
942
+ const IHtml = [];
943
+ for (const state of item.states) {
944
+ fs = fs+state.id+'.'+fne(item);
945
+ const redText = (item.errors && item.errors.length > 0 ? ' id="dbgred"' : '');
946
+ const LHtml = [(`<tr id="${isodd ? 'dbgrowodd' : 'dbgroweven'}">`)];
947
+ idx--;
948
+ if (idx==0)
949
+ LHtml.push(`<td${rowspan}>${item.dataID.toString(16).slice(-4)}</td><td${rowspan}>${safestring(item.payload)}</td>`);
950
+ LHtml.push(`<td${redText}>${state.ep ? state.ep : ''}</td><td${redText}>${state.id}</td><td${redText}>${safestring(state.value)}</td><td${redText}>${safestring(state.payload)}</td><td${redText}>${fne(item)}</td></tr>`);
951
+ IHtml.unshift(...LHtml);
952
+
953
+ }
954
+ if (filter)
955
+ if (filterSet.has(fs)) continue; else filterSet.add(fs);
956
+ Html.unshift(...IHtml);
957
+ isodd=!isodd;
958
+ }
959
+ }
960
+ const ifbutton = `<a id="o_${devID}" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsgfilter.has('o_'+devID) ? 'filter_list' : 'format_align_justify' }</i></a>`
961
+ const ofbutton = `<a id="ho_${devID}" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsghide.has('o_'+devID) ? 'unfold_more' : 'unfold_less'}</i></a>`
962
+ const dataHide = dbgMsgfilter.has('ho_'+devID) ? 'Data hidden' : '&nbsp;';
963
+ return `<thead id="dbgtable"><tr><td>&nbsp</td><td>Outgoing messages</td><td>&nbsp;</td><td>&nbsp;</td><td>${dataHide}</td><td>${ifbutton}</td><td>${ofbutton}</td></tr><tr><td>ID</td><td>Zigbee Payload</td><td>EP</td><td>ID</td><td>value</td><td>State Payload</td><td>Flags</td></tr></thead><tbody>${Html.join('')}</tbody>`;
964
+ }
965
+
966
+
967
+ function displayDebugMessages(msg) {
968
+ const buttonNames = [];
969
+ if (msg.byId) {
970
+ const dbgData = msg.byId;
971
+ const keys = Object.keys(dbgData);
972
+ const keylength = keys.length;
973
+ const Html = [];
974
+ const button = `<a id="e_all" class="btn-floating waves-effect waves-light green tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">sync_problem</i></a>`;
975
+ const fbutton = `<a id="f_all" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsgfilter.size != 0 ? 'filter_list' : 'format_align_justify' }</i></a>`;
976
+ const hbutton = `<a id="h_all" class="btn-floating waves-effect waves-light blue tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">${dbgMsghide.size != 0 ? 'unfold_more' : 'unfold_less'}</i></a>`;
977
+ Html.push(`<li><table><thead id="dbgtable"><tr><td colspan="4">Debug information by device</td><td>${fbutton}</td><td>${hbutton}</td><td>${button}</td></tr></thead><tbody>`);
978
+ if (!keylength) {
979
+ Html.push('<tr><td></td><td>No debug data loaded - press reload to refresh</td><td></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></li>')
980
+ $('#dbg_data_list').html(Html.join(''));
981
+ }
982
+ else {
983
+ Html.push('</tbody></table></li>')
984
+ for (const devID of Object.keys(dbgData)) {
985
+ const dev = devices.find((d) => d._id.endsWith(devID.slice(-16)));
986
+ const type_url = (dev && dev.common && dev.common.type ? sanitizeModelParameter(dev.common.type) : 'unknown');
987
+ const image = `<img src="${dev.common.icon || dev.icon}" width="40px" onerror="this.onerror=null;this.src='img/unavailable.png';">`
988
+ const modelUrl = (type_url === 'unknown') ? 'unknown' : `<a href="https://www.zigbee2mqtt.io/devices/${type_url}.html" target="_blank" rel="noopener noreferrer">${image}</a>`;
989
+ const devName = (dev && dev.common && dev.common.name) ? dev.common.name : 'unnamed';
990
+ const button = `<a id="e_${devID}" class="btn-floating waves-effect waves-light green tooltipped center-align hoverable translateT" title="Update debug messages"><i class="material-icons large">sync_problem</i></a>`
991
+ buttonNames.push(devID);
992
+ Html.push(`<li><table><thead id="dbgtable"><tr><td colspan="4">${devName} (ID: ${devID} Model: ${dev && dev.common ? dev.common.name : 'unknown'})</td><td>${modelUrl}</td><td>&nbsp;</td><td>${button}</td></tr></thead><tbody>`);
993
+ if (dbgData[devID].IN.length > 0) {
994
+ Html.push(`${HtmlFromInDebugMessages(dbgData[devID].IN, devID, dbgMsgfilter.has('i_'+devID))}`);
995
+ }
996
+ if (dbgData[devID].OUT.length > 0) {
997
+ Html.push(`${HtmlFromOutDebugMessages(dbgData[devID].OUT, devID, dbgMsgfilter.has('o_'+devID))}`);
998
+ }
999
+ Html.push('</tbody></table></li>');
1000
+ }
1001
+ $('#dbg_data_list').html(Html.join(''));
1002
+ }
1003
+ $(`#e_all`).click(function () {
1004
+ getDebugMessages();
1005
+ });
1006
+ $(`#f_all`).click(function () {
1007
+ if (dbgMsgfilter.size > 0) {
1008
+ dbgMsgfilter.clear();
1009
+ }
1010
+ else {
1011
+ for (const item of Object.keys(msg.byId)) {
1012
+ dbgMsgfilter.add(`o_${item}`)
1013
+ dbgMsgfilter.add(`i_${item}`)
1014
+ }
1015
+ }
1016
+ displayDebugMessages(debugMessages);
1017
+ });
1018
+ $(`#h_all`).click(function () {
1019
+ if (dbgMsghide.size > 0) {
1020
+ dbgMsghide.clear();
1021
+ }
1022
+ else {
1023
+ for (const item of Object.keys(msg.byId)) {
1024
+ dbgMsghide.add(`o_${item}`)
1025
+ dbgMsghide.add(`i_${item}`)
1026
+ }
1027
+ }
1028
+ displayDebugMessages(debugMessages);
1029
+ });
1030
+ for (const b of buttonNames) {
1031
+ $(`#e_${b}`).click(function () {
1032
+ getDebugMessages();
1033
+ });
1034
+ $(`#o_${b}`).click(function () {
1035
+ if (dbgMsgfilter.has(`o_${b}`)) dbgMsgfilter.delete(`o_${b}`); else dbgMsgfilter.add(`o_${b}`);
1036
+ displayDebugMessages(debugMessages);
1037
+ });
1038
+ $(`#i_${b}`).click(function () {
1039
+ if (dbgMsgfilter.has(`i_${b}`)) dbgMsgfilter.delete(`i_${b}`); else dbgMsgfilter.add(`i_${b}`);
1040
+ displayDebugMessages(debugMessages);
1041
+ });
1042
+ $(`#ho_${b}`).click(function () {
1043
+ if (dbgMsghide.has(`o_${b}`)) dbgMsghide.delete(`o_${b}`); else dbgMsghide.add(`o_${b}`);
1044
+ displayDebugMessages(debugMessages);
1045
+ });
1046
+ $(`#hi_${b}`).click(function () {
1047
+ if (dbgMsghide.has(`i_${b}`)) dbgMsghide.delete(`i_${b}`); else dbgMsghide.add(`i_${b}`);
1048
+ displayDebugMessages(debugMessages);
1049
+ });
1050
+ }
1051
+ }
1052
+ }
1053
+
1054
+ function getDebugMessages() {
1055
+ sendTo(namespace, 'getDebugMessages', {}, function(msg) {
1056
+ debugMessages = msg;
1057
+ if (msg) displayDebugMessages(debugMessages)
1058
+ })
1059
+ }
1060
+
1061
+
872
1062
  function getDevices() {
873
1063
  getCoordinatorInfo();
874
1064
  sendTo(namespace, 'getDeviceCleanupRequired', {}, function(msg) {
@@ -899,6 +1089,7 @@ function getDevices() {
899
1089
  } else {
900
1090
  devices = msg;
901
1091
  showDevices();
1092
+ getDebugMessages();
902
1093
  getExclude();
903
1094
  getBinding();
904
1095
  }
@@ -1009,6 +1200,7 @@ function load(settings, onChange) {
1009
1200
  //dialog = new MatDialog({EndingTop: '50%'});
1010
1201
  getDevices();
1011
1202
  getNamedColors();
1203
+ //getDebugMessages();
1012
1204
  //getMap();
1013
1205
  //addCard();
1014
1206
 
@@ -1200,8 +1392,13 @@ socket.on('stateChange', function (id, state) {
1200
1392
  $('#progress_line').css('width', `${percent}%`);
1201
1393
  }
1202
1394
  } else if (id.match(/\.info\.pairingMessage$/)) {
1203
- messages.push(state.val);
1204
- showMessages();
1395
+ if (state.val == 'NewDebugMessage') {
1396
+ getDebugMessages();
1397
+ }
1398
+ else {
1399
+ messages.push(state.val);
1400
+ showMessages();
1401
+ }
1205
1402
  } else {
1206
1403
  const devId = getDevId(id);
1207
1404
  putEventToNode(devId);
@@ -1226,6 +1423,7 @@ socket.on('stateChange', function (id, state) {
1226
1423
  }
1227
1424
  });
1228
1425
 
1426
+
1229
1427
  socket.on('objectChange', function (id, obj) {
1230
1428
  if (id.substring(0, namespaceLen) !== namespace) return;
1231
1429
  //console.log('objectChange', id, obj);
@@ -1486,7 +1684,6 @@ function showNetworkMap(devices, map) {
1486
1684
  const options = data.edges._data.get(id);
1487
1685
  if (select) {
1488
1686
  options.font.size = 15;
1489
- console.warn(JSON.stringify(options.font));
1490
1687
  } else {
1491
1688
  options.font.size = 0;
1492
1689
  }
@@ -2065,7 +2262,6 @@ function editGroup(id, name) {
2065
2262
  removeMembers.push({id:member.ieee.replace('0x',''), ep:member.epid})
2066
2263
  }
2067
2264
  }
2068
- console.warn(`ID: ${Id} name: ${newName} removeMembers: ${JSON.stringify(removeMembers)}`)
2069
2265
  updateGroup(Id, newName, (removeMembers.length > 0 ? removeMembers: undefined));
2070
2266
  // showGroups();
2071
2267
  getDevices();
@@ -2625,7 +2821,7 @@ function genDevInfo(device) {
2625
2821
  ${genRow('date code', dev._dateCode)}
2626
2822
  ${genRow('build', dev._softwareBuildID)}
2627
2823
  ${genRow('interviewed', dev._interviewCompleted)}
2628
- ${genRow('configured', (dev.meta.configured === 1), true)}
2824
+ ${genRow('configured', (device.isConfigured), true)}
2629
2825
  </ul>
2630
2826
  </div>
2631
2827
  </div>
@@ -2817,16 +3013,12 @@ function addExcludeDialog() {
2817
3013
  $('#excludemodaledit a.btn[name=\'save\']').unbind('click');
2818
3014
  $('#excludemodaledit a.btn[name=\'save\']').click(() => {
2819
3015
  const exclude_id = $('#excludemodaledit').find('#exclude_target option:selected').val();
2820
-
2821
3016
  const ids = devices.map(el => el._id);
2822
3017
  const idx = ids.indexOf(exclude_id);
2823
3018
  const exclude_model = devices[idx];
2824
- console.warn('calling addExclude mit model ' + exclude_model)
2825
-
2826
3019
  addExclude(exclude_model);
2827
3020
  });
2828
3021
  prepareExcludeDialog();
2829
- console.warn('opening dialog');
2830
3022
  $('#excludemodaledit').modal('open');
2831
3023
  Materialize.updateTextFields();
2832
3024
  }
@@ -2855,7 +3047,7 @@ function getExclude() {
2855
3047
  excludes = msg.legacy;
2856
3048
  showExclude();
2857
3049
  }
2858
- } else console.warn('getExclude without msg')
3050
+ }
2859
3051
  });
2860
3052
  }
2861
3053
 
File without changes
package/admin/tab_m.html CHANGED
@@ -9,7 +9,6 @@
9
9
  <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js"></script>
10
10
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.css"/> -->
11
11
  <script type="text/javascript" src="vis-network.min.js"></script>
12
- <script type="text/javascript" src="webcolors.js"></script>
13
12
  <link rel="stylesheet" type="text/css" href="vis-network.min.css"/>
14
13
 
15
14
  <!-- these files always have to be included -->
@@ -231,16 +230,18 @@
231
230
  color: blue;
232
231
  }
233
232
  .m.react-blue div.bg_red {
234
- background-color: #400000;
235
- color: DimGray;
236
- }
237
- .m div.bg_red {
238
- background-color: LightGray;
239
- color: DimGray;
233
+ background-color: #400000;
234
+ color: DimGray;
240
235
  }
241
236
  .m.react-dark div.bg_red {
242
- background-color: #400000;
237
+ background-color: #400000;
238
+ color: DimGray;
243
239
  }
240
+ #dbgroweven { background-color: #404040; color: #c0c0c0 !important; }
241
+ #dbgrowodd { background-color: #c0c0c0; color: #404040 !important; }
242
+ #dbgtable { background-color: #3090c0; color: #404040 !important; }
243
+ #dbgred { color: #C00000 !important;}
244
+
244
245
  .m.react-dark i.icon-blue {
245
246
  color: rgb(100, 181, 246)!important;
246
247
  }
@@ -911,6 +912,10 @@
911
912
  <div id="exclude" class="row">
912
913
  </div>
913
914
  </div>
915
+ <div id="tab-debug" class="col s12 page">
916
+ <ul id="dbg_data_list">
917
+ </ul>
918
+ </div>
914
919
  </div>
915
920
  </div>
916
921