Compare commits
	
		
			6 Commits
		
	
	
		
			d3848ac1aa
			...
			feat/syste
		
	
	| Author | SHA256 | Date | |
|---|---|---|---|
| 165c79e67b | |||
| c0ac71ebba | |||
| 10e8e14cd6 | |||
| a9c8525e6e | |||
| 39c07fcef0 | |||
| 52d521a6ad | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | docker-compose.yml | ||||||
| @ -56,6 +56,9 @@ Use `https://your.domain.tld/api/metrics` to retrieve useful insides for monitor | |||||||
| ## Add a Location Tracker | ## Add a Location Tracker | ||||||
| We use the [SenseCAP T1000-B](https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-B-p-5698.html) from seeedstudio because of the fair price and multiple location providers. However, you can use any LoRaWAN-enabled tracker that is compatible with TTN and supports the required payload fields. | We use the [SenseCAP T1000-B](https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-B-p-5698.html) from seeedstudio because of the fair price and multiple location providers. However, you can use any LoRaWAN-enabled tracker that is compatible with TTN and supports the required payload fields. | ||||||
|  |  | ||||||
|  | ## Troubleshooting | ||||||
|  | Run `journalctl -u locationhub.service -f` to see log output. | ||||||
|  |  | ||||||
| ### Onboard SenseCAP T1000-B | ### Onboard SenseCAP T1000-B | ||||||
| 1. Download and install the App [SenseCraft](https://play.google.com/store/apps/details?id=cc.seeed.sensecapmate)  | 1. Download and install the App [SenseCraft](https://play.google.com/store/apps/details?id=cc.seeed.sensecapmate)  | ||||||
| 2. Skip the user account at startup with `Skip` in the upper right corner | 2. Skip the user account at startup with `Skip` in the upper right corner | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								server/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								server/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -309,6 +309,3 @@ cython_debug/ | |||||||
| *.vsix | *.vsix | ||||||
|  |  | ||||||
| config.py | config.py | ||||||
|  |  | ||||||
| #docker |  | ||||||
| docker-compose.yml |  | ||||||
| @ -1,22 +1,29 @@ | |||||||
| [Unit] | [Unit] | ||||||
| Description=LocationHub | Description=LocationHub Service | ||||||
|  | Documentation=https://git.mosad.xyz/localhorst/LocationHub | ||||||
| After=network.target systemd-networkd-wait-online.service mysqld.service | After=network.target systemd-networkd-wait-online.service mysqld.service | ||||||
|  |  | ||||||
| [Service] | [Service] | ||||||
| Type=simple | Type=simple | ||||||
| User=locationhub | User=locationhub | ||||||
|  | Group=locationhub | ||||||
| WorkingDirectory=/home/locationhub/git/LocationHub/server/ | WorkingDirectory=/home/locationhub/git/LocationHub/server/ | ||||||
| ExecStart=/usr/bin/npm run dev |  | ||||||
|  | # Combine commands for build and start | ||||||
|  | ExecStart=/bin/bash -c "/usr/bin/npm run build && /usr/bin/npm run start" | ||||||
|  |  | ||||||
|  | # Restart policies | ||||||
| Restart=on-failure | Restart=on-failure | ||||||
| StandardOutput=append:/var/log/LocationHub.log | RestartSec=5s | ||||||
| StandardError=append:/var/log/LocationHub.log |  | ||||||
|  | # Logging configuration | ||||||
|  | StandardOutput=journal | ||||||
|  | StandardError=journal | ||||||
|  | SyslogIdentifier=locationhub | ||||||
|  |  | ||||||
|  | # Resource control (optional but helps stability) | ||||||
|  | MemoryLimit=512M | ||||||
|  | CPUQuota=50% | ||||||
|  |  | ||||||
| [Install] | [Install] | ||||||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||||||
| ``` |  | ||||||
| Activate Systemd Job |  | ||||||
| ``` |  | ||||||
| systemctl daemon-reload |  | ||||||
| systemctl enable locationhub.service |  | ||||||
| systemctl start locationhub.service |  | ||||||
| systemctl status locationhub.service |  | ||||||
| @ -56,24 +56,24 @@ router.post( | |||||||
|         timestamp: latitudeData?.timestamp |         timestamp: latitudeData?.timestamp | ||||||
|           ? new Date(latitudeData.timestamp) |           ? new Date(latitudeData.timestamp) | ||||||
|           : longitudeData?.timestamp |           : longitudeData?.timestamp | ||||||
|             ? new Date(longitudeData.timestamp) |           ? new Date(longitudeData.timestamp) | ||||||
|             : undefined, |           : undefined, | ||||||
|       }; |       }; | ||||||
|       const wifiTimestamp = (() => { |  | ||||||
|         const messages = message.uplink_message.decoded_payload?.messages?.[0]; |       const wifiMessage = | ||||||
|         const wifiScan = messages?.find((e: { type: string }) => e.type === "Wi-Fi Scan"); |         message.uplink_message.decoded_payload?.messages[0].find( | ||||||
|         return wifiScan?.timestamp ? new Date(wifiScan.timestamp) : undefined; |           (e) => e.type === "Wi-Fi Scan" | ||||||
|       })(); |         ); | ||||||
|  |  | ||||||
|       const wifiScans = |       const wifiScans = | ||||||
|         message.uplink_message.decoded_payload?.messages[0] |         wifiMessage?.measurementValue?.map((w) => ({ | ||||||
|           .find((e) => e.type === "Wi-Fi Scan") |           lp_ttn_end_device_uplinks_id, | ||||||
|           ?.measurementValue?.map((w) => ({ |           mac: w.mac, | ||||||
|             lp_ttn_end_device_uplinks_id, |           rssi: w.rssi, | ||||||
|             mac: w.mac, |           scanned_at_utc: wifiMessage?.timestamp | ||||||
|             rssi: w.rssi, |             ? new Date(wifiMessage.timestamp) | ||||||
|             scanned_at_timestamp: wifiTimestamp, |             : undefined, | ||||||
|           })) ?? []; |         })) ?? []; | ||||||
|  |  | ||||||
|       const ttnGatewayReceptions = message.uplink_message.rx_metadata.map( |       const ttnGatewayReceptions = message.uplink_message.rx_metadata.map( | ||||||
|         (g) => ({ |         (g) => ({ | ||||||
| @ -109,9 +109,9 @@ router.post( | |||||||
|           gnss: |           gnss: | ||||||
|             gnnsLocation.latitude && gnnsLocation.longitude |             gnnsLocation.latitude && gnnsLocation.longitude | ||||||
|               ? { |               ? { | ||||||
|                 latitude: gnnsLocation.latitude, |                   latitude: gnnsLocation.latitude, | ||||||
|                 longitude: gnnsLocation.longitude, |                   longitude: gnnsLocation.longitude, | ||||||
|               } |                 } | ||||||
|               : undefined, |               : undefined, | ||||||
|           gnss_timestamp: gnssTimestamp.timestamp, |           gnss_timestamp: gnssTimestamp.timestamp, | ||||||
|         }); |         }); | ||||||
|  | |||||||
| @ -5,14 +5,14 @@ interface CreateWifiScanParams { | |||||||
|   lp_ttn_end_device_uplinks_id: string; |   lp_ttn_end_device_uplinks_id: string; | ||||||
|   mac: string; |   mac: string; | ||||||
|   rssi: number; |   rssi: number; | ||||||
|   scanned_at_timestamp?: Date; |   scanned_at_utc?: Date; | ||||||
| } | } | ||||||
|  |  | ||||||
| interface UpdateWifiScanParams { | interface UpdateWifiScanParams { | ||||||
|   wifi_scan_id: string; |   wifi_scan_id: string; | ||||||
|   mac?: string; |   mac?: string; | ||||||
|   rssi?: number; |   rssi?: number; | ||||||
|   scanned_at_timestamp?: Date; |   scanned_at_utc?: Date; | ||||||
| } | } | ||||||
|  |  | ||||||
| @injectable() | @injectable() | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user