Appearance
@xcons/cli-thingsboard - Widget Bundle Create Kılavuzu
Bu dokümantasyon, XCONS ThingsBoard CLI ile widget bundle oluşturma işlemlerini detaylı olarak açıklar.
Widget Bundle Create Komutu
bash
xcons-thingsboard widget-bundle create [options]Seçenekler
-h, --host <host>: ThingsBoard sunucu adresi (örn: 192.168.233.132:8080)-u, --user <email>: ThingsBoard kullanıcı adı/email-p, --pass <password>: ThingsBoard şifresi-n, --name <name>: Bundle adı-o, --order <order>: Bundle sırası (0-999)-d, --description <description>: Bundle açıklaması
Temel Kullanım
İnteraktif Bundle Oluşturma
bash
# Tüm parametreler komut sırasında sorulur
xcons-thingsboard widget-bundle create
# Sunucu bilgileri ile interaktif oluşturma
xcons-thingsboard widget-bundle create -h 192.168.233.132:8080 -u admin@domain.com -p passwordParametreli Bundle Oluşturma
bash
# Tüm parametrelerle bundle oluşturma
xcons-thingsboard widget-bundle create \
-h 192.168.233.132:8080 \
-u admin@domain.com \
-p password \
-n "Custom Widgets" \
-o 5 \
-d "Custom widget collection for IoT devices"
# Minimal parametrelerle (diğerleri interaktif sorulur)
xcons-thingsboard widget-bundle create -n "Development Bundle"Pratik Örnekler
Geliştirme Bundle'ı
bash
xcons-thingsboard widget-bundle create \
-h localhost:8080 \
-u tenant@thingsboard.org \
-p tenant \
-n "Development Widgets" \
-o 1 \
-d "Widgets under development and testing"Üretim Bundle'ı
bash
xcons-thingsboard widget-bundle create \
-h production-server:8080 \
-u admin@company.com \
-p secure_password \
-n "Production Dashboard Widgets" \
-o 10 \
-d "Production-ready widgets for customer dashboards"Özel Proje Bundle'ı
bash
xcons-thingsboard widget-bundle create \
-h 192.168.1.100:8080 \
-u project-admin@company.com \
-p project123 \
-n "Smart Factory Widgets" \
-o 20 \
-d "Custom widgets for smart factory monitoring and control"Departman Bundle'ı
bash
xcons-thingsboard widget-bundle create \
-h thingsboard.company.com:8080 \
-u engineering@company.com \
-p eng2024 \
-n "Engineering Department Widgets" \
-o 15 \
-d "Specialized widgets for engineering team dashboards"Bundle Özellikleri
Bundle Sırası (Order)
Bundle sırası, ThingsBoard widget library'sinde görünüm sırasını belirler:
- 0-9: Sistem bundle'ları (yüksek öncelik)
- 10-49: Üretim bundle'ları
- 50-99: Geliştirme bundle'ları
- 100+: Test/deneysel bundle'ları
Bundle Adlandırma Kuralları
İyi Örnekler:
"Production Dashboards""IoT Sensor Widgets""Control Panel Widgets""Analytics Widgets""Custom Charts"
Kaçınılması Gerekenler:
- Çok uzun adlar (50+ karakter)
- Özel karakterler (@, #, %, vb.)
- Sayı ile başlayan adlar
- Boşluk bırakılmayan adlar
Interaktif Mod
Parametreler belirtilmediğinde CLI interaktif sorular sorar:
bash
xcons-thingsboard widget-bundle createİnteraktif Soru Sırası:
ThingsBoard server host (with port):
192.168.233.132:8080Username/Email:
admin@domain.comPassword:
[şifre gizli olarak girilir]Bundle name:
Custom Widget BundleBundle order (0-999):
0Bundle description (optional):
Collection of custom widgets for specific use cases
Sunucu Bağlantısı
Host Formatları
CLI otomatik olarak protokol ekler:
bash
# Tüm bu formatlar geçerlidir:
-h localhost:8080
-h 192.168.1.100:8080
-h thingsboard.company.com:8080
-h http://localhost:8080
-h https://secure-tb.company.com:8080Kimlik Doğrulama
bash
# Tenant kullanıcısı
-u tenant@thingsboard.org -p tenant
# Sistem yöneticisi
-u sysadmin@thingsboard.org -p sysadmin
# Domain kullanıcısı
-u admin@company.com -p admin123
# Email adresi
-u user@example.com -p userpassBundle Yönetimi İş Akışı
1. Bundle Oluşturma
bash
xcons-thingsboard widget-bundle create \
-h server:8080 -u admin -p pass \
-n "New Project Bundle" -o 252. Bundle Kontrolü
bash
# Oluşturulan bundle'ı listede kontrol et
xcons-thingsboard widget-bundle list \
-h server:8080 -u admin -p pass \
--filter "New Project"3. Widget'ları Bundle'a Ekleme
bash
# Widget'lar install edilirken otomatik olarak "Xcon Studio" bundle'ına eklenir
# Ancak widget'lar manuel olarak farklı bundle'lara taşınabilir
xcons-thingsboard widget install \
-h server:8080 -u admin -p passHata Durumları ve Çözümler
Bağlantı Hataları
Hata: Connection refused - ThingsBoard server may be down or unreachable
Çözüm:
bash
# Sunucu durumunu kontrol et
ping 192.168.233.132
telnet 192.168.233.132 8080
# Host formatını kontrol et
xcons-thingsboard widget-bundle create -h http://192.168.233.132:8080Kimlik Doğrulama Hataları
Hata: Authentication failed - Invalid username or password
Çözüm:
bash
# Kullanıcı bilgilerini doğrula
# ThingsBoard web arayüzünde giriş yapmayı dene
# Doğru kullanıcı türünü kullan
xcons-thingsboard widget-bundle create \
-h server:8080 \
-u tenant@thingsboard.org \
-p tenantYetki Hataları
Hata: Access forbidden - User may not have permission to create widget bundles
Çözüm:
bash
# Sistem yöneticisi hesabı kullan
xcons-thingsboard widget-bundle create \
-h server:8080 \
-u sysadmin@thingsboard.org \
-p sysadmin
# Veya yetkili tenant admin hesabı kullanBundle Çakışması
Hata: Bad request - Invalid bundle data or bundle with this name already exists
Çözüm:
bash
# Mevcut bundle'ları kontrol et
xcons-thingsboard widget-bundle list -h server:8080 -u admin -p pass
# Farklı bir isim kullan
xcons-thingsboard widget-bundle create \
-n "Custom Widgets v2" \
-h server:8080 -u admin -p passBundle Konfigürasyonu
Varsayılan Ayarlar
Bundle oluşturulurken varsayılan ayarlar:
json
{
"title": "Bundle Name",
"alias": "generated_alias",
"description": "Bundle description",
"order": 0,
"image": null
}Bundle Alias
Bundle alias'ı otomatik oluşturulur:
- Bundle adından türetilir
- Özel karakterler kaldırılır
- Boşluklar alt çizgi ile değiştirilir
- Küçük harfe çevrilir
Örnekler:
"Custom Widgets"→custom_widgets"IoT Dashboard"→iot_dashboard"Production Analytics"→production_analytics
Bundle Kategorileri
Sistem Bundle'ları (Order: 0-9)
bash
# Sistem seviyesi widget'lar için
xcons-thingsboard widget-bundle create \
-n "System Widgets" -o 0 \
-d "Core system widgets and components"Üretim Bundle'ları (Order: 10-49)
bash
# Production kullanımı için
xcons-thingsboard widget-bundle create \
-n "Production Dashboard" -o 10 \
-d "Production-ready widgets for customer dashboards"Geliştirme Bundle'ları (Order: 50-99)
bash
# Geliştirme ve test için
xcons-thingsboard widget-bundle create \
-n "Development Tools" -o 50 \
-d "Development and testing widgets"Deneysel Bundle'ları (Order: 100+)
bash
# Deneysel ve prototype widget'lar için
xcons-thingsboard widget-bundle create \
-n "Experimental Widgets" -o 100 \
-d "Experimental and prototype widgets"Toplu Bundle İşlemleri
Çoklu Bundle Oluşturma
bash
# Farklı departmanlar için bundle'lar
departments=("Engineering" "Production" "Quality" "Maintenance")
orders=(10 20 30 40)
for i in "${!departments[@]}"; do
xcons-thingsboard widget-bundle create \
-h server:8080 -u admin -p pass \
-n "${departments[$i]} Widgets" \
-o "${orders[$i]}" \
-d "Custom widgets for ${departments[$i]} department"
doneProje Bazlı Bundle'lar
bash
# Proje isimleri
projects=("Project Alpha" "Project Beta" "Project Gamma")
for project in "${projects[@]}"; do
xcons-thingsboard widget-bundle create \
-h server:8080 -u admin -p pass \
-n "$project Widgets" \
-o 25 \
-d "Custom widgets for $project"
doneJSON Çıktısı ve Scripting
Bundle ID'sini Alma
bash
# Bundle oluştur ve çıktıyı yakala
output=$(xcons-thingsboard widget-bundle create \
-h server:8080 -u admin -p pass \
-n "API Bundle" -o 30 2>&1)
# Bundle ID'sini çıkar
bundle_id=$(echo "$output" | grep -o "Bundle ID: [a-f0-9-]*" | cut -d' ' -f3)
echo "Created bundle with ID: $bundle_id"Otomatik Bundle Yönetimi
bash
#!/bin/bash
# Bundle oluşturma fonksiyonu
create_bundle() {
local name=$1
local order=$2
local desc=$3
echo "Creating bundle: $name"
xcons-thingsboard widget-bundle create \
-h $TB_HOST -u $TB_USER -p $TB_PASS \
-n "$name" -o $order -d "$desc"
}
# Ortam değişkenleri
export TB_HOST="localhost:8080"
export TB_USER="tenant@thingsboard.org"
export TB_PASS="tenant"
# Bundle'ları oluştur
create_bundle "Dashboard Widgets" 10 "Primary dashboard widgets"
create_bundle "Control Widgets" 20 "Device control widgets"
create_bundle "Analytics Widgets" 30 "Data analytics widgets"Bundle Bakımı
Bundle Durumu Kontrolü
bash
# Bundle'ın varlığını kontrol et
xcons-thingsboard widget-bundle list \
-h server:8080 -u admin -p pass \
--filter "My Bundle"Bundle Güncelleme
Bundle'lar oluşturulduktan sonra ThingsBoard web arayüzünden güncellenebilir:
- Widget Library → Widget Bundles
- Bundle'ı bul ve Edit butonuna tıkla
- Title, Description, Order değerlerini güncelle
- Save ile kaydet
Bundle Stratejisi
Organizasyon Önerileri
Departman Bazlı:
bash
# IT departmanı
xcons-thingsboard widget-bundle create -n "IT Monitoring" -o 10
# Operations departmanı
xcons-thingsboard widget-bundle create -n "Operations Dashboard" -o 20
# Analytics departmanı
xcons-thingsboard widget-bundle create -n "Data Analytics" -o 30Fonksiyon Bazlı:
bash
# Dashboard widget'ları
xcons-thingsboard widget-bundle create -n "Dashboard Components" -o 10
# Control widget'ları
xcons-thingsboard widget-bundle create -n "Control Panels" -o 20
# Reporting widget'ları
xcons-thingsboard widget-bundle create -n "Reports & Analytics" -o 30Proje Bazlı:
bash
# Proje A widget'ları
xcons-thingsboard widget-bundle create -n "Project Alpha Widgets" -o 10
# Proje B widget'ları
xcons-thingsboard widget-bundle create -n "Project Beta Widgets" -o 20Sonraki Adımlar
Bundle oluşturduktan sonra:
- Widget Bundle Listeleme - Bundle'ları görüntüleme
- Widget Oluşturma - Bundle'a eklenecek widget'lar oluşturma
- Widget Kurulum - Widget'ları bundle'lara yükleme
Widget Bundle başarıyla oluşturuldu. Artık widget'larınızı organize edebilirsiniz!