ESP32 LoRa for dummys - TinyGS: Application Programming Interface (API)
Para probar las API de TinyGs puede usar su navegador, pero encontrará que es mas práctico usar cURL un navegador orientado a linea de comandos (terminal), versiones compiladas apra la mayoria de sistemas operativos las encontrará en static-curl
https://api.tinygs.com/v1/statistics
Lista las estadísticas del sistema
{"members":5919,"packets":16714523,"stations":1677}
https://api.tinygs.com/v1/stations?
Lista todas las estaciones TinyGS con el siguiente formato (observe que el userID no tiene nada que ver con su usuario de acceso a TinyGS
{"name": "MalvaRosa","userId": 5343680049,"autoTune": 433,"confirmedPackets": 953,"lastSeen": 1730394223267,"location": [39.48, -0.33],"satellite": "Tianqi","status": 1,"telemetryPackets": 808,"test": false,"version": 2403242,"lastPacketTime": 1730387686501},https://api.tinygs.com/v1/stations?userId=5343680049
Devuelve todas las estaciones de un usuario
[{"name": "MalvaRosa","userId": 5343680049,"autoTune": 433,"confirmedPackets": 953,"lastSeen": 1730395183291,"location": [39.48, -0.33],"satellite": "Tianqi","status": 1,"telemetryPackets": 808,"test": false,"version": 2403242,"cnt_pckt_conf_433_LoRa": 718,"cnt_pckt_tele_433_LoRa": 691,"lastPacketTime": 1730387686501,"cnt_pckt_conf_137_LoRa": 235,"cnt_pckt_tele_137_LoRa": 117},{"name": "MalvaRosa_Test","userId": 5343680049,"autoTune": 900,"confirmedPackets": 0,"lastSeen": 1730395141293,"location": [39.48, -0.33],"satellite": "PY4-Unknown","status": 1,"telemetryPackets": 0,"test": false,"version": 2403242}]
https://api.tinygs.com/v1/station/MalvaRosa@5343680049
{"name": "MalvaRosa","userId": 5343680049,"antennaBand": [90, 2500],"autoTune": 433,"autoUpdate": true,"beta": true,"confirmedPackets": 4083,"creationDate": 1728812735116,"elevation": 11,"lastSeen": 1731686791360,"local_ip": "192.168.1.47","location": [39.48, -0.33],"modem_conf": "","radioStatus": 0,"satellite": "ONDOSAT-OWL-1","status": 1,"telemetryPackets": 3593,"test": false,"tx": true,"version": 2403242,"wifiRssi": -65,"recordDistance": 2955.53036241728,"frames": 4234,"lastPacketTime": 1731682167081,"antenna": "Yagi-Uda","description": "137Band: Lilygo ESP32 LoRa433 autotuning 137 & Turnstile\n433Band: Lilygo ESP32 LoRa 433 autotuning 433 & logperiode vertical","pictures": [{"src": "https://static.tinygs.com/stationImages/TinyGS_MalvaRosa_c89fe.jpg","status": 1,"type": "image/jpeg","size": 159128,"origName": "20241028_112548.jpg","shortId": "c89fe1d31328cdc7"}]}
https://api.tinygs.com/v1/station/MalvaRosa@5343680049/statistics
Devuelve las estadísticas de un estación concreta TinyGS, en este caso Malvarosa@5343680049(da error)
https://api.tinygs.com/v1/tinygs_supported.txt
Lista lo satélites soportados que pueden ser cargados en aplicaciones como gpredict or Look4Sat
Norby
1 46494U 20068J 24318.83421293 .00019065 00000-0 81076-3 0 9999
2 46494 97.8346 285.6840 0013552 145.1692 215.0433 15.22993847227170
https://api.tinygs.com/v1/packets
https://api.tinygs.com/v2/packets
"packets": [{"raw": "6/iADOxwPBr4BAzscDoAAEreHhw67t9kQjOPXUOgFAdCgXGNQpZWk+A2QAYAL7cVARgJGgEmDxGMoCsk3gldAABLRgKqBAEAsAEBACQAoUQeAAAAAAAAAAAAAAAAAAAAAAAAAA==","serverTime": 1731586620341,"mode": "LoRa","freq": 400.45,"sf": 9,"bw": 500,"cr": 5,"bitrate": null,"freqDev": null,"rxBw": null,"satellite": "Tianqi-26","norad": 99999,"id": "3fb42333-6387-426b-ab8b-ee52c40a14aa","satDisplayName": "Tianqi-26","parsed": {"header": {"netId": 235,"msgTypeId": 248,"headUnk": 128,"msgTypeId1n": 15,"msgTypeId2n": 8,"headUnk1n": 2},"payload": {"timestamp": 216821820,"satId": 26,"unk248xF8": 248,"unk24x18": 4,"unk81x51": 12,"unk121x79": 236,"unk81xx51": 112,"unk121xx79": 58,"unk71x47": 0,"unk206CEx3": [0, 74, 222],"unkx211x110x172x142x150x38": [30, 28, 58, 238, 223, 100],"unkx150x37x150x20": [66, 51, 143, 93],"lastRXtime": 1134564359,"unkx00x00": [66, 129],"unkValue": 1.3989722830040528e+30,"eccentricity": 81295593963520,"inclination": 2.09376120567322,"ascending": -0.000008881346730049,"angleX": 1.85376157074446e-33,"angleY": 7.17613534340837e-30,"unkValue2": 5.85726400107595e-13,"eccentricity2": 576465906264178700,"inclination2": 8362.50390625,"ascending2": 2.36361636262599e-38,"angleX2": 2.35357157497402e-38,"angleY2": -6.64470877341397e-19,"tinygsTxPower": 9000,"satId1b": 1,"satId2n": 10,"tinygsSatellite": "Tianqi-26"},"telemetry": true,"type": "Beacon","object": 0},"satPos": {"lat": 27.0680430552991,"lng": -128.527143810243,"alt": 901.236724880711},"stationNumber": 4},Vamos a ver ahora algunos programas
Crear un archivo de log o registro
El programa, escrito en Python (Necesitará tener instalado Python y un usar su IDE o un editor de progrmas para ponerlo a punto), crea un archivo de registro para registrar los datos a intervalos regulares (Estoy probandolo)
#!/usr/bin/env python3import requestsimport osimport time__author__ = "Diarmuid O'Briain"__copyright__ = "Copyright 2023, Limerick Clare Amateur Radio Club"__licence__ = "European Union Public Licence v1.2"__version__ = "1.0"telegram_id = "<Telegram-ID>"API = f"https://api.tinygs.com/v1/stations?userId={telegram_id}"LOG = "/path/to/lora_station.log"TIME=5 # espera 5 minutosdef access_api():"""Acceso a la API de TinyGS"""# Descargando los datos de la URLresponse = requests.get(API)# Comprobando que la descarga ha ido bienif response.status_code == 200:# Append the data to the filewith open(LOG, mode="a") as fh:fh.write(response.text)fh.write("\n\n")else:print(f"Error en la descarga de datos: {response.status_code}")if __name__ == "__main__":while True:access_api()time.sleep(TIME*60) # Time in seconds
Hay que reemplazar
- /path/to/lora_station.log por el directorio correcto
- <Telegram-ID> por el usuario correcto
Referencia:
- ESP32 LoRa for dummys - TinyGS
- ESP32 LoRa for dummys - TinyGS: 2,4 GHz
- ESP32 LoRa for dummys - TinyGS: relación de satélites recibidos
- ESP32 LoRa for dummys - TinyGS ¿Qué interés tiene recibir la telemetría de los satélites ?
- ESP32 LoRa for dummys - TinyGS: Application Programming Interface (API)
- ESP32 LoRa for dummys - Dashboard de control de TinyGS (NOC en Node-RED)
- ESP32 LoRa for dummys - TinyGS margen de mejoras
Comentarios
Publicar un comentario