Skip to content

Commit 3e44c85

Browse files
authored
ignore device without name
1 parent 328be99 commit 3e44c85

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

core/class/ajaxSystem.class.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,15 @@ public static function sync() {
175175
log::add('ajaxSystem', 'debug', json_encode($devices));
176176
foreach ($devices as $device) {
177177
$device_info = self::request('/user/{userId}/hubs/' . $hub['hubId'] . '/devices/' . $device['id']);
178+
if($device_info['deviceName'] == ''){
179+
continue;
180+
}
178181
$eqLogic = eqLogic::byLogicalId($device['id'], 'ajaxSystem');
179182
if (!is_object($eqLogic)) {
180183
$eqLogic = new ajaxSystem();
181184
$eqLogic->setEqType_name('ajaxSystem');
182185
$eqLogic->setIsEnable(1);
183-
if($device_info['deviceName'] == ''){
184-
$eqLogic->setName($device_info['deviceType'].' - '.config::genKey(24));
185-
}else{
186-
$eqLogic->setName($device_info['deviceName']);
187-
}
186+
$eqLogic->setName($device_info['deviceName']);
188187
$eqLogic->setCategory('security', 1);
189188
$eqLogic->setIsVisible(1);
190189
}
@@ -201,16 +200,14 @@ public static function sync() {
201200
$groups = self::request('/user/{userId}/hubs/' . $hub['hubId'] . '/groups');
202201
log::add('ajaxSystem', 'debug', json_encode($groups));
203202
foreach ($groups as $group) {
203+
if($group['groupName'] == ''){
204+
continue;
205+
}
204206
$eqLogic = eqLogic::byLogicalId($group['id'], 'ajaxSystem');
205207
if (!is_object($eqLogic)) {
206208
$eqLogic = new ajaxSystem();
207209
$eqLogic->setEqType_name('ajaxSystem');
208210
$eqLogic->setIsEnable(1);
209-
if($group['groupName'] == ''){
210-
$eqLogic->setName('Groupe - '.config::genKey(24));
211-
}else{
212-
$eqLogic->setName($group['groupName']);
213-
}
214211
$eqLogic->setName($group['groupName']);
215212
$eqLogic->setCategory('security', 1);
216213
$eqLogic->setIsVisible(1);

0 commit comments

Comments
 (0)