function _drawDiscoveredDevicesList() {
		_stopDiscoveredDevicesRefresh();
		if ( $( "#" + _prefix + "-discovered-devices" ).length === 0 ) {
			return;
		}
		$.when( _getDevicesInfosAsync() )
			.done( function( devicesInfos ) {
				if ( devicesInfos.discoveredDevices.length > 0 ) {
					// Sort the discovered ziblue devices by last update
					devicesInfos.discoveredDevices.sort( function( d1, d2 ) {
						return d2.lastUpdate - d1.lastUpdate;
					});
					var html =	'<table><tr>'
						+			'<th>' + Utils.getLangString( _prefix + "_address" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_endpoint" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_signal_quality" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_last_update" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_feature" ) + '</th>'
						+			'<th></th>'
						+		'</tr>';
					$.each( devicesInfos.discoveredDevices, function( i, discoveredDevice ) {
						html += '<tr class="' + _prefix + '-discovered-device" data-address="' + discoveredDevice.address + '" data-end-point="' + discoveredDevice.endPoint + '">'
							+		'<td>' + discoveredDevice.address + '</td>'
							+		'<td>' + discoveredDevice.endPoint + '</td>'
							+		'<td>' + ( discoveredDevice.quality >= 0 ? discoveredDevice.quality : '' ) + '</td>'
							+		'<td>' + _convertTimestampToLocaleString( discoveredDevice.lastUpdate ) + '</td>'
							+		'<td>'
							+			'<table class="' + _prefix + '-feature">';
						$.each( discoveredDevice.features, function( featureName, feature ) {
							html +=			'<tr>'
								+				'<td>'
								+					'<div class="font-weight-bold">' + featureName + '</div>'
								+					( feature.data ? '<div class="' + _prefix + '-feature-data">' + feature.data + '</div>' : '' )
								+				'</td><td width="40%">';
							if ( feature.deviceTypes && ( feature.deviceTypes.length > 0 ) ) {
								html +=				'<div class="' + _prefix + '-device-type" data-feature-name="' + featureName + '" data-settings="' + ( feature.settings ? feature.settings : '' ) + '">';
								if ( feature.deviceTypes.length > 1 ) {
									html +=				'<select>';
									$.each( feature.deviceTypes, function( k, deviceType ) {
										html +=				'<option value="' + deviceType + '">' + deviceType + '</option>';
									} );
									html +=				'</select>';
								} else {
									html +=	feature.deviceTypes[0];
								}
								html +=				'</div>';
							}
							html +=				'</td>'
								+			'</tr>';
						} );
						html +=			'</table>'
							+		'</td>'
							+		'<td>'
							+			'<input type="checkbox">'
							+		'</td>'
							+	'</tr>';
					});
					html += '</table>';
					$("#" + _prefix + "-discovered-devices").html( html );
				} else {
					$("#" + _prefix + "-discovered-devices").html( Utils.getLangString( "zigate_no_discovered_device" ) );
				}
				_discoveredDevicesLastRefresh = Date.now();
				_resumeDiscoveredDevicesRefresh();
			} );
	}
/**
	 * Draw and manage discovered ziblue device list
	 */
Draw and manage discovered ziblue device list
Draw and manage discovered ziblue device list
function _drawDiscoveredDevicesList() {
		_stopDiscoveredDevicesRefresh();
		if ( $( "#" + _prefix + "-discovered-devices" ).length === 0 ) {
			return;
		}
		$.when( _getDevicesInfosAsync() )
			.done( function( devicesInfos ) {
				if ( devicesInfos.discoveredDevices.length > 0 ) {
					devicesInfos.discoveredDevices.sort( function( d1, d2 ) {
						return d2.lastUpdate - d1.lastUpdate;
					});
					var html =	'<table><tr>'
						+			'<th>' + Utils.getLangString( _prefix + "_address" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_endpoint" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_signal_quality" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_last_update" ) + '</th>'
						+			'<th>' + Utils.getLangString( _prefix + "_feature" ) + '</th>'
						+			'<th></th>'
						+		'</tr>';
					$.each( devicesInfos.discoveredDevices, function( i, discoveredDevice ) {
						html += '<tr class="' + _prefix + '-discovered-device" data-address="' + discoveredDevice.address + '" data-end-point="' + discoveredDevice.endPoint + '">'
							+		'<td>' + discoveredDevice.address + '</td>'
							+		'<td>' + discoveredDevice.endPoint + '</td>'
							+		'<td>' + ( discoveredDevice.quality >= 0 ? discoveredDevice.quality : '' ) + '</td>'
							+		'<td>' + _convertTimestampToLocaleString( discoveredDevice.lastUpdate ) + '</td>'
							+		'<td>'
							+			'<table class="' + _prefix + '-feature">';
						$.each( discoveredDevice.features, function( featureName, feature ) {
							html +=			'<tr>'
								+				'<td>'
								+					'<div class="font-weight-bold">' + featureName + '</div>'
								+					( feature.data ? '<div class="' + _prefix + '-feature-data">' + feature.data + '</div>' : '' )
								+				'</td><td width="40%">';
							if ( feature.deviceTypes && ( feature.deviceTypes.length > 0 ) ) {
								html +=				'<div class="' + _prefix + '-device-type" data-feature-name="' + featureName + '" data-settings="' + ( feature.settings ? feature.settings : '' ) + '">';
								if ( feature.deviceTypes.length > 1 ) {
									html +=				'<select>';
									$.each( feature.deviceTypes, function( k, deviceType ) {
										html +=				'<option value="' + deviceType + '">' + deviceType + '</option>';
									} );
									html +=				'</select>';
								} else {
									html +=	feature.deviceTypes[0];
								}
								html +=				'</div>';
							}
							html +=				'</td>'
								+			'</tr>';
						} );
						html +=			'</table>'
							+		'</td>'
							+		'<td>'
							+			'<input type="checkbox">'
							+		'</td>'
							+	'</tr>';
					});
					html += '</table>';
					$("#" + _prefix + "-discovered-devices").html( html );
				} else {
					$("#" + _prefix + "-discovered-devices").html( Utils.getLangString( "zigate_no_discovered_device" ) );
				}
				_discoveredDevicesLastRefresh = Date.now();
				_resumeDiscoveredDevicesRefresh();
			} );
	}
function _drawDiscoveredDevicesList ( ) { _stopDiscoveredDevicesRefresh ( ) ; if ( $ ( "#" + _prefix + "-discovered-devices" ) . length === 0 ) { return ; } $ . when ( _getDevicesInfosAsync ( ) ) . done ( function ( devicesInfos ) { if ( devicesInfos . discoveredDevices . length > 0 ) { devicesInfos . discoveredDevices . sort ( function ( d1 , d2 ) { return d2 . lastUpdate - d1 . lastUpdate ; } ) ; var html = '<table><tr>' + '<th>' + Utils . getLangString ( _prefix + "_address" ) + '</th>' + '<th>' + Utils . getLangString ( _prefix + "_endpoint" ) + '</th>' + '<th>' + Utils . getLangString ( _prefix + "_signal_quality" ) + '</th>' + '<th>' + Utils . getLangString ( _prefix + "_last_update" ) + '</th>' + '<th>' + Utils . getLangString ( _prefix + "_feature" ) + '</th>' + '<th></th>' + '</tr>' ; $ . each ( devicesInfos . discoveredDevices , function ( i , discoveredDevice ) { html += '<tr class="' + _prefix + '-discovered-device" data-address="' + discoveredDevice . address + '" data-end-point="' + discoveredDevice . endPoint + '">' + '<td>' + discoveredDevice . address + '</td>' + '<td>' + discoveredDevice . endPoint + '</td>' + '<td>' + ( discoveredDevice . quality >= 0 ? discoveredDevice . quality : '' ) + '</td>' + '<td>' + _convertTimestampToLocaleString ( discoveredDevice . lastUpdate ) + '</td>' + '<td>' + '<table class="' + _prefix + '-feature">' ; $ . each ( discoveredDevice . features , function ( featureName , feature ) { html += '<tr>' + '<td>' + '<div class="font-weight-bold">' + featureName + '</div>' + ( feature . data ? '<div class="' + _prefix + '-feature-data">' + feature . data + '</div>' : '' ) + '</td><td width="40%">' ; if ( feature . deviceTypes && ( feature . deviceTypes . length > 0 ) ) { html += '<div class="' + _prefix + '-device-type" data-feature-name="' + featureName + '" data-settings="' + ( feature . settings ? feature . settings : '' ) + '">' ; if ( feature . deviceTypes . length > 1 ) { html += '<select>' ; $ . each ( feature . deviceTypes , function ( k , deviceType ) { html += '<option value="' + deviceType + '">' + deviceType + '</option>' ; } ) ; html += '</select>' ; } else { html += feature . deviceTypes [ 0 ] ; } html += '</div>' ; } html += '</td>' + '</tr>' ; } ) ; html += '</table>' + '</td>' + '<td>' + '<input type="checkbox">' + '</td>' + '</tr>' ; } ) ; html += '</table>' ; $ ( "#" + _prefix + "-discovered-devices" ) . html ( html ) ; } else { $ ( "#" + _prefix + "-discovered-devices" ) . html ( Utils . getLangString ( "zigate_no_discovered_device" ) ) ; } _discoveredDevicesLastRefresh = Date . now ( ) ; _resumeDiscoveredDevicesRefresh ( ) ; } ) ; }
Draw and manage discovered ziblue device list
Draw and manage discovered ziblue device list
// Sort the discovered ziblue devices by last update