Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.11 #2363

Closed
wants to merge 23 commits into from
Closed

1.11 #2363

Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ You can thank the authors by these links:

-----------------------------------------------------------------------------------------------------
## Changelog
### 1.11.1 (2025-01-02)
* (asgothian) Fix Pairing
* (asgothian) change ping
* (asgothian) delay map generation until refresh is activated
* (asgothian) remove bindings tab from zigbee tab
* (asgothian) reorder tabs in configuration
* (asgothian) remove binding tab from configuration
* (asgothian) remove map from configuration
* (asgothian) add debug to zigbee tab (work in progress)
* (asgothian) Herdsman 3.2.0, Converters 21.11.0

### 1.10.14 (2025-01-01)
* (arteck) Herdsman 2.1.9, Converters 20.58.0
* (asgothian) Fix: Aqara T1M (CL-L02D)
Expand Down
78 changes: 60 additions & 18 deletions admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace = 'zigbee.' + instance,
namespaceLen = namespace.length;
let devices = [],
debugDevices = [],
messages = [],
map = {},
mapEdges = null,
Expand Down Expand Up @@ -94,7 +95,7 @@
if (value < 20) return 'icon-red';
if (value < 50) return 'icon-orange';
}
return '';
return 'icon-green';
}


Expand Down Expand Up @@ -173,7 +174,7 @@
info = info.concat(` </ul>
</div>`);
const image = `<img src="img/group_${memberCount}.png" width="80px" onerror="this.onerror=null;this.src='img/unavailable.png';">`;
const dashCard = getDashCard(dev, `img/group_${memberCount}.png`);
const dashCard = getDashCard(dev, `img/group_${memberCount}.png`, memberCount > 0);
const card = `<div id="${id}" class="device group">
<div class="card hoverable flipable">
<div class="front face">${dashCard}</div>
Expand Down Expand Up @@ -220,14 +221,17 @@
img_src = dev.icon || dev.common.icon,
rooms = [],
isActive = (dev.common.deactivated ? false : true),
lang = systemLang || 'en';
lang = systemLang || 'en',
ieee = id.replace(namespace + '.', ''),
isDebug = checkDebugDevice(ieee);
for (const r in dev.rooms) {
if (dev.rooms[r].hasOwnProperty(lang)) {
rooms.push(dev.rooms[r][lang]);
} else {
rooms.push(dev.rooms[r]);
}
}
console.warn('debug for ' + ieee + ' is ' + isDebug);
const room = rooms.join(',') || '&nbsp';
const paired = (dev.paired) ? '' : '<i class="material-icons right">leak_remove</i>';
const rid = id.split('.').join('_');
Expand All @@ -237,18 +241,19 @@
battery_cls = (isActive ? getBatteryCls(dev.battery) : ''),
lqi_cls = getLQICls(dev.link_quality),
battery = (dev.battery && isActive) ? `<div class="col tool"><i id="${rid}_battery_icon" class="material-icons ${battery_cls}">battery_std</i><div id="${rid}_battery" class="center" style="font-size:0.7em">${dev.battery}</div></div>` : '',
lq = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i id="${rid}_link_quality_icon" class="material-icons ${lqi_cls}">network_check</i><div id="${rid}_link_quality" class="center" style="font-size:0.7em">${dev.link_quality}</div></div>` : '',
status = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i class="material-icons icon-green">check_circle</i></div>` : (isActive ? `<div class="col tool"><i class="material-icons icon-black">leak_remove</i></div>` : ''),
lq = (dev.link_quality > 0) ? `<div class="col tool"><i id="${rid}_link_quality_icon" class="material-icons ${lqi_cls}">network_check</i><div id="${rid}_link_quality" class="center" style="font-size:0.7em">${dev.link_quality}</div></div>`

Check failure on line 244 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
: `<div class="col tool"><i class="material-icons icon-black">leak_remove</i></div>`,

Check failure on line 245 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 12 spaces but found 36
status = (isActive ? lq : `<div class="col tool"><i class="material-icons icon-red">cancel</i></div>`),
info = `<div style="min-height:88px; font-size: 0.8em" class="truncate">
<ul>
<li><span class="labelinfo">ieee:</span><span>0x${id.replace(namespace + '.', '')}</span></li>
<li><span class="labelinfo">ieee:</span><span>0x${ieee}</span></li>
<li><span class="labelinfo">nwk:</span><span>${(nwk) ? nwk.toString() + ' (0x' + nwk.toString(16) + ')' : ''}</span></li>
<li><span class="labelinfo">model:</span><span>${modelUrl}</span></li>
<li><span class="labelinfo">groups:</span><span>${dev.groupNames || ''}</span></li>
</ul>
</div>`,
permitJoinBtn = (dev.info && dev.info.device._type == 'Router') ? '<button name="join" class="btn-floating btn-small waves-effect waves-light right hoverable green"><i class="material-icons tiny">leak_add</i></button>' : '',
deactBtn = `<button name="swapactive" class="right btn-flat btn-small tooltipped" title="${(isActive ? 'Deactivate' : 'Activate')}"><i class="material-icons icon-${(isActive ? 'red' : 'green')}">power_settings_new</i></button>`,
debugBtn = `<button name="swapdebug" class="right btn-flat btn-small tooltipped" title="${(isDebug > -1 ? (isDebug > 0) ?'Automatic by '+debugDevices[isDebug-1]: 'Disable Debug' : 'Enable Debug')}"><i class="material-icons icon-${(isDebug > -1 ? (isDebug > 0 ? 'orange' : 'green') : 'gray')}">bug_report</i></button>`,
infoBtn = (nwk) ? `<button name="info" class="left btn-flat btn-small"><i class="material-icons icon-blue">info</i></button>` : '';
const dashCard = getDashCard(dev);
const card = `<div id="${id}" class="device">
Expand All @@ -259,7 +264,7 @@
<div class="flip" style="cursor: pointer">
<span class="top right small" style="border-radius: 50%">
${battery}
${lq}
<!--${lq}-->
${status}
</span>
<!--/a--!>
Expand All @@ -274,17 +279,17 @@
${infoBtn}
<span class="left" style="padding-top:8px">${room}</span>
<span class="left fw_info"></span>
<button name="delete" class="right btn-flat btn-small">
<button name="delete" class="right btn-flat btn-small tooltipped" title="Delete">
<i class="material-icons icon-black">delete</i>
</button>
<button name="edit" class="right btn-flat btn-small">
<button name="edit" class="right btn-flat btn-small tooltipped" title="Edit">
<i class="material-icons icon-green">edit</i>
</button>
<button name="reconfigure" class="right btn-flat btn-small tooltipped" title="Reconfigure">
<i class="material-icons icon-red">sync</i>
</button>
${deactBtn}
${permitJoinBtn}
${debugBtn}
</div>
</div>
</div>
Expand Down Expand Up @@ -589,7 +594,7 @@
$('.card.flipable').toggleClass('flipped');
});

shuffleInstance = new Shuffle($('#devices'), {

Check warning on line 597 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'Shuffle' is not defined
itemSelector: '.device',
sizer: '.js-shuffle-sizer',
});
Expand All @@ -616,6 +621,12 @@
const name = getDevName(dev_block);
editName(id, name);
});
$('.card-reveal-buttons button[name=\'swapdebug\']').click(function () {
const dev_block = $(this).parents('div.device');
const id = getDevId(dev_block);
const name = getDevName(dev_block);
toggleDebugDevice(id, name);
Fixed Show fixed Hide fixed

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous argument passed to
function toggleDebugDevice
.
});
$('.card-reveal-buttons button[name=\'editgrp\']').click(function () {
const dev_block = $(this).parents('div.device');
const id = dev_block.attr('id').replace(namespace + '.group_', '');
Expand Down Expand Up @@ -751,9 +762,39 @@
}
});
}
function checkDebugDevice(id) {
if (debugDevices.indexOf(id) > -1) return 0
for (const addressPart of debugDevices) {
if (typeof id === 'string' && id.includes(addressPart)) {
return debugDevices.indexOf(addressPart)+1;
}
}
return -1;
}
async function toggleDebugDevice(id) {
console.warn('toggleDebugDevices with id ' + id);
sendTo(namespace, 'setDeviceDebug', {id:id}, function (msg) {
sendTo(namespace, 'getDebugDevices', {}, function(msg) {
if (msg && typeof (msg.debugDevices == 'array')) {

Check warning

Code scanning / CodeQL

Useless conditional Warning

This expression always evaluates to true.
debugDevices = msg.debugDevices;

Check failure on line 779 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
}
else

Check failure on line 781 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
debugDevices = [];
});

Check failure on line 783 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 8 spaces but found 12
console.warn('toggleDebugDevices.result ' + JSON.stringify(debugDevices));
showDevices();
});
}

function getDevices() {
getCoordinatorInfo();
sendTo(namespace, 'getDebugDevices', {}, function(msg) {
if (msg && typeof (msg.debugDevices == 'array')) {

Check warning

Code scanning / CodeQL

Useless conditional Warning

This expression always evaluates to true.
debugDevices = msg.debugDevices;

Check failure on line 793 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
}
else

Check failure on line 795 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Trailing spaces not allowed
debugDevices = [];
});

Check failure on line 797 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 4 spaces but found 8
sendTo(namespace, 'getDevices', {}, function (msg) {
if (msg) {
if (msg.error) {
Expand Down Expand Up @@ -848,7 +889,7 @@

//dialog = new MatDialog({EndingTop: '50%'});
getDevices();
getMap();
//getMap();
//addCard();

// Signal to admin, that no changes yet
Expand Down Expand Up @@ -2827,7 +2868,7 @@
return element.querySelector('.card-title').textContent.toLowerCase().trim();
}

function getDashCard(dev, groupImage) {
function getDashCard(dev, groupImage, groupstatus) {
const title = dev.common.name,
id = dev._id,
type = dev.common.type,
Expand All @@ -2842,12 +2883,14 @@
nwk = (dev.info && dev.info.device) ? dev.info.device._networkAddress : undefined,
battery_cls = getBatteryCls(dev.battery),
lqi_cls = getLQICls(dev.link_quality),
unconnected_icon = (groupImage ? (groupstatus ? '<div class="col tool"><i class="material-icons icon-green">check_circle</i></div>' : '<div class="col tool"><i class="material-icons icon-red">cancel</i></div>') :'<div class="col tool"><i class="material-icons icon-red">leak_remove</i></div>')
battery = (dev.battery && isActive) ? `<div class="col tool"><i id="${rid}_battery_icon" class="material-icons ${battery_cls}">battery_std</i><div id="${rid}_battery" class="center" style="font-size:0.7em">${dev.battery}</div></div>` : '',

Check failure on line 2887 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 4 spaces but found 8

Check warning on line 2887 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'battery' is not defined
lq = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i id="${rid}_link_quality_icon" class="material-icons ${lqi_cls}">network_check</i><div id="${rid}_link_quality" class="center" style="font-size:0.7em">${dev.link_quality}</div></div>` : (isActive ? '<div class="col tool"><i class="material-icons icon-green">check_circle</i></div>' : ''),
status = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i class="material-icons icon-green">check_circle</i></div>` : (groupImage || !isActive ? '' : `<div class="col tool"><i class="material-icons icon-black">leak_remove</i></div>`),
permitJoinBtn = (isActive && dev.info && dev.info.device._type === 'Router') ? '<button name="join" class="btn-floating btn-small waves-effect waves-light right hoverable green"><i class="material-icons tiny">leak_add</i></button>' : '',
infoBtn = (nwk) ? `<button name="info" class="left btn-flat btn-small"><i class="material-icons icon-blue">info</i></button>` : '',
lq = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i id="${rid}_link_quality_icon" class="material-icons ${lqi_cls}">network_check</i><div id="${rid}_link_quality" class="center" style="font-size:0.7em">${dev.link_quality}</div></div>`

Check failure on line 2888 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 4 spaces but found 8

Check warning on line 2888 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'lq' is not defined

Check warning

Code scanning / CodeQL

Missing variable declaration Warning

Variable lq is used like a local variable, but is missing a declaration.
: (isActive ? unconnected_icon : ''),
//status = (dev.link_quality > 0 && isActive) ? `<div class="col tool"><i class="material-icons icon-green">check_circle</i></div>` : (groupImage || !isActive ? '' : `<div class="col tool"><i class="material-icons icon-black">leak_remove</i></div>`),
//permitJoinBtn = (isActive && dev.info && dev.info.device._type === 'Router') ? '<button name="join" class="btn-floating btn-small waves-effect waves-light right hoverable green"><i class="material-icons tiny">leak_add</i></button>' : '',
//infoBtn = (nwk) ? `<button name="info" class="left btn-flat btn-small"><i class="material-icons icon-blue">info</i></button>` : '',
idleTime = (dev.link_quality_lc > 0 && isActive) ? `<div class="col tool"><i id="${rid}_link_quality_lc_icon" class="material-icons idletime">access_time</i><div id="${rid}_link_quality_lc" class="center" style="font-size:0.7em">${getIdleTime(dev.link_quality_lc)}</div></div>` : '';

Check warning on line 2893 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'idleTime' is not defined
const info = (dev.statesDef) ? dev.statesDef.map((stateDef) => {
const id = stateDef.id;
const sid = id.split('.').join('_');
Expand Down Expand Up @@ -2885,10 +2928,9 @@
<div class="card-content zcard ${isActive ? '' : 'bg_red'}">
<div class="flip" style="cursor: pointer">
<span class="top right small" style="border-radius: 50%">
${idleTime}

Check warning on line 2931 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'idleTime' is not defined
${battery}

Check warning on line 2932 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'battery' is not defined
${lq}

Check warning on line 2933 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'lq' is not defined
${status}
</span>
<span class="card-title truncate">${title}</span>
</div>
Expand Down Expand Up @@ -2953,7 +2995,7 @@
}

function getIdleTime(value) {
return (value) ? moment(new Date(value)).fromNow(true) : '';

Check warning on line 2998 in admin/admin.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'moment' is not defined
}

function updateCardTimer() {
Expand Down
Binary file added admin/img/PTM 215Z.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/img/ZY-M100-24GV3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,11 @@ <h5 class="translate">Zigbee adapter</h5>
</div>
<div class="nav-content">
<ul class="tabs tabs-transparent">
<li class="tab col s2"><a href="#tab-main" id="devs" class="translate tooltipped">Devices</a></li>
<li class="tab col s2"><a href="#tab-map" id="tabmap" class="translate tooltipped">Network map</a>
</li>
<li class="tab col s1"><a href="#tab-binding" class="translate tooltipped">Binding</a></li>
<li class="tab col s2"><a href="#tab-sett" id="settings" class="translate tooltipped">Settings</a></li>
<!--<li class="tab col s2"><a href="#tab-map" id="tabmap" class="translate tooltipped">Network map</a></li> -->
<!--<li class="tab col s1"><a href="#tab-binding" class="translate tooltipped">Binding</a></li> -->
<li class="tab col s2"><a href="#tab-exclude" class="translate tooltipped">Excludes</a></li>
<li class="tab col s2"><a href="#tab-sett" id="settings" class="translate tooltipped">Settings</a>
</li>
<li class="tab col s2"><a href="#tab-main" id="devs" class="translate tooltipped">Devices</a></li>
<li class="tab col s2"><a href="#tab-dev" id="develop" class="translate tooltipped">Developer</a>
</li>
</ul>
Expand Down
5 changes: 3 additions & 2 deletions admin/tab_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,9 @@ <h5 class="translate">Zigbee adapter</h5>
<li class="tab col s2"><a href="#tab-main" id="devs" class="translate">Devices</a></li>
<li class="tab col s2"><a href="#tab-map" id="tabmap" class="translate">Network map</a></li>
<li class="tab col s2"><a href="#tab-binding" class="translate">Binding</a></li>
<li class="tab col s2"><a href="#tab-exclude" class="translate">Excludes</a></li>
<!--li class="tab col s2"><a href="#tab-sett" id="settings" class="translate">Settings</a></li-->
<li class="tab col s2"><a href="#tab-debug" id="tabdebug" class="translate">Debug</a></li>
<!-- <li class="tab col s2"><a href="#tab-exclude" class="translate">Excludes</a></li>-->
<!-- li class="tab col s2"><a href="#tab-sett" id="settings" class="translate">Settings</a></li-->
<!-- li class="tab col s2"><a href="#tab-dev" id="develop" class="translate">Developer</a></li-->
</ul>
</div>
Expand Down
29 changes: 15 additions & 14 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"common": {
"name": "zigbee",
"version": "1.10.15",
"version": "1.11.2",
"news": {
"1.10.15": {
"en": "Work in progress",
"de": "Work in progress",
"ru": "Work in progress",
"pt": "Work in progress",
"nl": "Work in progress",
"fr": "Work in progress",
"it": "Work in progress",
"es": "Work in progress",
"pl": "Work in progress",
"uk": "Work in progress",
"zh-cn": "Work in progress"
"1.11.2": {
"en": "debug for states",
"de": "debug for states",
"ru": "debug for states",
"pt": "debug for states",
"nl": "debug for states",
"fr": "debug for states",
"it": "debug for states",
"es": "debug for states",
"pl": "debug for states",
"uk": "debug for states",
"zh-cn": "debug for states"
},
"1.10.14": {
"en": "Herdsman 2.1.9, Converters 20.58.0\nFix: Aqara T1M (CL-L02D) \ndeleteDeviceStates change to deleteObj",
Expand Down Expand Up @@ -222,7 +222,8 @@
"cancel"
]
}
]
],
"installedFrom": "asgothian/ioBroker.zigbee#1.11"
},
"native": {
"port": "",
Expand Down
26 changes: 26 additions & 0 deletions lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@
this.setDeviceActivated(obj.from, obj.command, obj.message, obj.callback);
}
break;
case 'setDeviceDebug':
if (obj.message && typeof obj.message === 'object') {
this.toggleDeviceDebug(obj.from, obj.command, obj.message, obj.callback);
}
break;
case 'getDebugDevices':
if (obj.message && typeof obj.message === 'object') {
this.getDebugDevices(obj.from, obj.command, obj.message, obj.callback);
}
break;
}
}
}
Expand Down Expand Up @@ -209,6 +219,7 @@

async getDevices(from, command, id, callback) {
if (this.zbController) {
this.warn(`getDevices called from ${from} with command ${JSON.stringify(command)} and id ${JSON.stringify(id)}`);
const pairedDevices = await this.zbController.getClients(true);
const groups = {};
let rooms;
Expand Down Expand Up @@ -532,6 +543,21 @@
}
}

async toggleDeviceDebug(from, command, msg, callback) {
if (this.stController) {
const id = msg.id;
const result = await this.stController.toggleDeviceDebug(id);
this.adapter.sendTo(from, command, {debugDevices:result}, callback)
}
}

async getDebugDevices(from, command, msg, callback) {
if (this.stController) {
this.warn("get Debug Devices Called");

Check warning on line 556 in lib/commands.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Strings must use singlequote
this.stController.getDebugDevices((debugDevices) => this.adapter.sendTo(from, command, {debugDevices:debugDevices}, callback));
}
}

async reconfigure(from, command, msg, callback) {
if (this.zbController) {
const devid = getZbId(msg.id);
Expand Down
Loading
Loading