Benutzer-Werkzeuge

Webseiten-Werkzeuge


stellar-iot-notizen

Dies ist eine alte Version des Dokuments!


Stellar Wireless IoT

Hier sammle ich rein Notizen bzgl. einem Entwicklungsstand unseres AWOS!

Einrichtung des Servers

Installation von mosquitto

Folgendes gilt für Debian Bullseye

benny@tiger:~$ sudo apt install mosquitto mosquitto-clients
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libcjson1 libdlt2 libev4 libmosquitto1 libwebsockets16
The following NEW packages will be installed:
  libcjson1 libdlt2 libev4 libmosquitto1 libwebsockets16 mosquitto mosquitto-clients
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 783 kB of archives.
After this operation, 2,001 kB of additional disk space will be used.
Do you want to continue? [Y/n] 

Einrichtung für Laborbetrieb

Zugriff ohne Authentifizierung erlauben

root@tiger:~# echo "allow_anonymous true" > /etc/mosquitto/conf.d/allow_anonymous.conf
root@tiger:~# systemctl restart mosquitto.service 
root@tiger:~# systemctl status mosquitto.service 
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-01-03 19:39:35 CET; 12s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 1321695 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321696 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321697 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321698 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
   Main PID: 1321699 (mosquitto)
      Tasks: 1 (limit: 2340)
     Memory: 1.0M
        CPU: 52ms
     CGroup: /system.slice/mosquitto.service
             └─1321699 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jan 03 19:39:35 tiger systemd[1]: Starting Mosquitto MQTT Broker...
Jan 03 19:39:35 tiger mosquitto[1321699]: 1641235175: Loading config file /etc/mosquitto/conf.d/allow_anonymous.conf
Jan 03 19:39:35 tiger systemd[1]: Started Mosquitto MQTT Broker.

"mosquitto" von außen erreichbar machen

root@tiger:~# echo "listener 1883" > /etc/mosquitto/conf.d/listener_1883.conf
root@tiger:~# systemctl restart mosquitto.service 
root@tiger:~# systemctl status mosquitto.service 
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-01-03 19:43:25 CET; 1s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 1321980 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321981 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321982 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 1321983 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
   Main PID: 1321984 (mosquitto)
      Tasks: 1 (limit: 2340)
     Memory: 1.0M
        CPU: 49ms
     CGroup: /system.slice/mosquitto.service
             └─1321984 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jan 03 19:43:24 tiger systemd[1]: Starting Mosquitto MQTT Broker...
Jan 03 19:43:24 tiger mosquitto[1321984]: 1641235404: Loading config file /etc/mosquitto/conf.d/allow_anonymous.conf
Jan 03 19:43:24 tiger mosquitto[1321984]: 1641235404: Loading config file /etc/mosquitto/conf.d/listener_1883.conf
Jan 03 19:43:25 tiger systemd[1]: Started Mosquitto MQTT Broker.
                      
root@tiger:~# ss -lsbnut | grep 1883
tcp   LISTEN 0      100          0.0.0.0:1883       0.0.0.0:*          
tcp   LISTEN 0      100             [::]:1883          [::]:*          

MQTT-Nachrichten anzeigen

benny@tiger:~$ mosquitto_sub --pretty --insecure -t stellar
...
stellar {
	"data":[
		{
			"timestamp":"2022-01-03T21:15:41+0100",
			"connectable":1,
			"deviceMac":"7d4811xxxxxx",
			"rssi":-61,
			"rawData":"008734940b44aa0779ee42ba4b4a10054d"
		},
... (omitted)
		{
			"timestamp":"2022-01-03T21:15:41+0100",
			"connectable":1,
			"deviceMac":"5c551axxxxxx",
			"rssi":-62,
			"rawData":"001006631e020db93b0000000000000000"
		}
	],
	"dateType":"gap",
	"bleMac":"dc0856131e7f",
	"wlanMac":"dc0856131e60",
	"timestamp":1641240941
}
....

Einrichtung des Stellar APs

Die hier gezeigten Befehle sind nur in einem internen Entwicklungsbuild verfügbar.

IoT Server Konfiguration auf dem Stellar AP

support@AP-1E:60:/$ cat /tmp/iot-server.conf 
{
	"GenericIoTServer": {
		"ServiceSwitch": "enable",
		"RadioMode": "ble",
		"Host": "192.168.2.134",
		"Port": 1883,
		"Topic": "stellar",
		"ReportingInterval": 5
	}
}

support@AP-1E:60:/$ cat /tmp/ble-config.conf 
{
    "GenericBLE":{
        "ServiceSwitch":"enable"
    }
}

IoT Server starten

(Dies speichert auch die Konfiguration bootfest.)

support@AP-1E:60:/$ ssudo iot-cfg iot-server -f /tmp/iot-server.conf
support@AP-1E:60:/$ /usr/bin/iot-server start ..

support@AP-1E:60:/$ ssudo iot-cfg iot-server show
{
	"GenericIoTServer": {
		"ServiceSwitch": "enable",
		"RadioMode": "",
		"Host": "192.168.2.134",
		"Port": 1883,
		"Topic": "stellar",
		"ReportingInterval": 5
	}
}
support@AP-1E:60:/$ ssudo iot-cfg ble-manage -f /tmp/ble-config.conf 
support@AP-1E:60:/$ {
	"success": true,
	"error": {
		"errorCode": 0,
		"errorMessage": ""
	}
}
/usr/bin/btd start ..
/usr/bin/bt-manager start ..
support@AP-1E:60:/$ ssudo iot-cfg ble-manage show
{
	"GenericBLE": {
		"ServiceSwitch": "enable",
		"ConnectDevList": [
			
		]
	}
}
stellar-iot-notizen.1641245005.txt.gz · Zuletzt geändert: (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki