Nice.
For appending to csv file, you just have to enter a path and set the variable 'ap_useCSVfile' to 1
Moderator: leecollings
Nice.
Found it allready. No airplanes up till now.For appending to csv file, you just have to enter a path and set the variable 'ap_useCSVfile' to 1
Yes, first things first.Finishing touch is in the icon . (See first post)
Code: Select all
--- Your settings ----------------------------------------------------------------
-- First set the used device index numbers and variables you might want to change.
---#################################################################
local ap_text_idx = 2559 --idx of the custom Text device
local ap_counter_idx = 2560 --idx of the optional incremental counter device. (or 99999 if not confugured)
local ap_maxRadiusKm = 3 -- Query max radius in KM around your coordinates.
local ap_maxAltitudeM = 2500 -- Save only < max ap_maxAltitude in Meters.
local ap_useCSVfile = 1 -- 0 = NO csv file, or 1 = Save airplanes also in csv file.
-- local ap_csvFile = '../scripts/dzVents/scripts/SavedAirplanes.csv'
-- local ap_csvFile = '/scripts/dzVents/scripts/SavedAirplanes.csv'
local ap_csvFile = '/<pathtoyourfile>/SavedAirplanes.csv'
local ap_pollFreq = 15 --Poll frequency in seconds. Default 15. Normally > 1 and < 60.
----------------------------------------------------------------------------------
Code: Select all
local csvFile = '/home/pi/Desktop/GPV_data/Humidity' .. dz.time.rawDate .. '.csv' -- location/name of your csv text file
Thnx Jan! Waiting for the next plane..Use the full path in your synology.
Something like /volume1/docker/domoticz/scripts/yourfile.csv
Code: Select all
2024-06-27 16:21:15.835 Status: EventSystem: Script event triggered: /opt/domoticz/dzVents/runtime/dzVents.lua
2024-06-27 16:21:15.835 Error: dzVents: Error: (3.1.8) Airplanes-: An error occurred when calling event handler airplanes
2024-06-27 16:21:15.835 Error: dzVents: Error: (3.1.8) Airplanes-: ...erdata/scripts/dzVents/generated_scripts/global_data.lua:59: attempt to index a nil value (local 'file')
Code: Select all
2024-06-27 15:54:14.314 Status: Domoticz V2024.4 (build 16089) (c)2012-2024 GizMoCuz
2024-06-27 15:54:14.314 Status: Build Hash: 7ee2474fb, Date: 2024-06-20 07:16:22
2024-06-27 15:54:14.314 Status: Startup Path: /opt/domoticz/
Code: Select all
local file_path = '/opt/domoticz/userdata/Made/net_verbruik.txt'
Code: Select all
local ap_csvFile = '/volume1/docker/domoticz/SavedAirplanes.csv'
Code: Select all
"ap_time ap_hex ap_flight ap_r ap_t ap_desc ap_gs ap_track ap_direction ap_lat ap_long ap_distance ap_geom_rateString ap_altitude"
"19:44:15 4d2271 RYR88UD 9H-QEC B738 BOEING 737-800 489 92.39 O 51.370488 5.460434 2.2 Stijgt 829 m/min. 2438"
"19:52:01 4d2348 RYR5UK 9H-VUI B38M BOEING 737 MAX 8 540 121.67 OZO 51.362527 5.472565 1.6 Stijgt 858 m/min. 2172"
"20:27:45 4d2460 WZZ4H 9H-WBV A320 AIRBUS A-320 508 80.78 O 51.366484 5.456314 1.8 Stijgt 849 m/min. 2294"
Great. You should now also be able to address the subdirectories under it when you prefer.
There is a delimiter!@janpep: Maybe a suggestion to build in a dellimiter to filter the records?
Code: Select all
local ap_csvFile = '/opt/domoticz/userdata/SavedAirplanes.csv'
Code: Select all
local ap_maxRadiusKm = 50 -- Query max radius in KM around your coordinates.
local ap_maxAltitudeM = 6500 -- was 2500 save only < max ap_maxAltitude in Meters.
Code: Select all
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.385 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.386 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.387 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: url = https://api.airplanes.live/v2/point/0/0/31.0685595
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: method = GET
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: post data = nil
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: headers = nil
2024-06-28 19:45:00.388 Status: dzVents: Debug: Airplanes: OpenURL: callback = airplanes
2024-06-28 19:45:00.389 Status: dzVents: Info: Airplanes: ------ Finished airplanes.lua
2024-06-28 19:45:00.832 Status: dzVents: Info: Handling httpResponse-events for: "airplanes"
2024-06-28 19:45:00.833 Status: dzVents: Info: Airplanes: ------ Start external script: airplanes.lua: HTTPResponse: "airplanes"
Code: Select all
2024-06-28 19:50:45.885 Status: dzVents: Debug: Airplanes: Item and JSON - OK
2024-06-28 19:50:45.885 Status: dzVents: Debug: Airplanes: result_table: type = table
2024-06-28 19:50:45.885 Status: dzVents: Debug: Airplanes: Total flights found in response = 0.
2024-06-28 19:50:45.885 Status: dzVents: Debug: Airplanes: Nothing left in global _d.ap_table to write to device.
2024-06-28 19:50:45.886 Status: dzVents: Info: Airplanes: ------ Finished airplanes.lua
2024-06-28 19:51:01.163 Status: dzVents: Info: Handling httpResponse-events for: "airplanes"
2024-06-28 19:51:01.163 Status: dzVents: Info: Airplanes: ------ Start external script: airplanes.lua: HTTPResponse: "airplanes"
2024-06-28 19:51:01.164 Status: dzVents: Debug: Airplanes: Item and JSON - OK
2024-06-28 19:51:01.164 Status: dzVents: Debug: Airplanes: result_table: type = table
2024-06-28 19:51:01.164 Status: dzVents: Debug: Airplanes: Total flights found in response = 0.
2024-06-28 19:51:01.164 Status: dzVents: Debug: Airplanes: Nothing left in global _d.ap_table to write to device.
2024-06-28 19:51:01.171 Status: dzVents: Info: Airplanes: ------ Finished airplanes.lua
2024-06-28 19:51:15.927 Status: dzVents: Info: Handling httpResponse-events for: "airplanes"
2024-06-28 19:51:15.928 Status: dzVents: Info: Airplanes: ------ Start external script: airplanes.lua: HTTPResponse: "airplanes"
2024-06-28 19:51:15.929 Status: dzVents: Debug: Airplanes: Item and JSON - OK
2024-06-28 19:51:15.929 Status: dzVents: Debug: Airplanes: result_table: type = table
2024-06-28 19:51:15.929 Status: dzVents: Debug: Airplanes: Total flights found in response = 0.
2024-06-28 19:51:15.929 Status: dzVents: Debug: Airplanes: Nothing left in global _d.ap_table to write to device.
2024-06-28 19:51:15.930 Status: dzVents: Info: Airplanes: ------ Finished airplanes.lua
In the url the coordinates seem to be missing.
Users browsing this forum: No registered users and 1 guest