Author Topic: Weewx Awekas API  (Read 2329 times)

0 Members and 1 Guest are viewing this topic.

Offline SebQB49

  • Member
  • *
  • Posts: 4
Weewx Awekas API
« on: September 13, 2022, 03:16:08 PM »
Good evening,
I use the weather station from Bresser 7 in 1 Clearview and send the data to Awekas. Now I would like to download the data to Weewx via API. Is there a possibility? Many Thanks

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #1 on: September 14, 2022, 04:33:26 PM »
two options which I can see:
1. via the AWEKAS API - the respective reply has been sent to your question in the weewx user group - you'd have to change some coding
2. use a SDR (software defined radio) device and the weewx SDR extension (provided the hardware/sensors of this Bresser station are known in the SDR database)
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline SebQB49

  • Member
  • *
  • Posts: 4
Re: Weewx Awekas API
« Reply #2 on: September 15, 2022, 05:34:11 AM »

Thank you, I was able to connect to WU via API, data is also being fetched. Unfortunately, the data is still displayed incorrectly. I have Station_type = Simulator in the weewx.conf, is that correct?

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #3 on: September 15, 2022, 08:14:52 AM »
From what I know WU data which the station sends to WU can be fetched via the weewx interceptor driver. The simulator does what its name says - it simulates  ;)
I suggest you check the interceptor driver and its description at
https://github.com/matthewwall/weewx-interceptor/
entries in weewx.conf:
station_type=Interceptor in [Station]
device_type = wu-client in [Interceptor]  (after installation  8-))
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline SebQB49

  • Member
  • *
  • Posts: 4
Re: Weewx Awekas API
« Reply #4 on: September 15, 2022, 03:11:25 PM »
Hi, thanks for your help. I am now using the Inceptor driver. Data is also retrieved from WU. Under Current Conditions it says Outside Temp: 0.1 C
Inside Temp 17.2 C. Outside 12.9 and Inside 24.1 would be correct.


Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #5 on: September 15, 2022, 05:14:50 PM »
you may want to check what your station is posting before weewx is doing any processing.
For this run the driver only - as described with the interceptor driver documentation
e.g.
PYTHONPATH=bin python bin/user/interceptor.py --device=wu-client --mode=sniff --iface=eth0 --filter="src 192.168.0.4 and dst port 80"

you need to put your station's IP address - you may need to replace "python" by "python2" or "python3" and may need to adapt your path to the python directory
you may need to put a "sudo" in front of the command
if you use WLAN/WiFi with your weewx server, --iface=wlan0 needs to be put instead

the driver will send the output to the (server) console - then you can check what it receives and can figure out why your outdoor temperature shows wrong values inside weewx.
Meaning: see if it's a data issue with what station sends or is it due to some processing inside weewx
« Last Edit: September 16, 2022, 10:19:36 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline SebQB49

  • Member
  • *
  • Posts: 4
Re: Weewx Awekas API
« Reply #6 on: September 16, 2022, 09:00:32 AM »
Another thing that struck me was Hardware Simulator under "about this station". Even though I installed the interceptor driver. Sorry for the questions

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #7 on: September 16, 2022, 10:17:04 AM »
if you want to have something else written there, open the file /etc/weewx/skins/Seansons/about.inc
and change the respective line into:

....
<table>
    <tr>
      <td class="label">Hardware</td>
      <td class="data">xxxxxxxxxxxxxxxxx</td>
    </tr>
....
where xxxxxxxxxxxxx is what you want to have

I guess the entry comes from the original choice of station during setup.
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline gianvi97

  • Member
  • *
  • Posts: 11
Re: Weewx Awekas API
« Reply #8 on: June 26, 2023, 04:46:26 AM »
two options which I can see:
1. via the AWEKAS API - the respective reply has been sent to your question in the weewx user group - you'd have to change some coding
2. use a SDR (software defined radio) device and the weewx SDR extension (provided the hardware/sensors of this Bresser station are known in the SDR database)

Hi, how can I download the data to Weewx via API?
I tried to find the answer you speak of online but I couldn't...thanks

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #9 on: June 26, 2023, 06:53:27 AM »
look up https://groups.google.com/g/weewx-user/c/l3D5BLgeGTA?pli=1
in the same thread there is a link to the AWEKAS API description.
you will have to modify (respectively create a modified copy of) wee_import and weeimport.py and a new Python programm e.g. awekas.py (you could start with a copy of wuimport.py in /usr/share/weewx/weeimport) .

Read it (wee_import, wuimport.py and weeimport.py), understand it and implement the retrieval from AWEKAS analogously to WU.
The import portion may also need modification depending on the sensors used.

the wee_import start script wee_import describes at line 653 how to create a new service for import (here AWEKAS)

But you will need some programming skills  8-) - looks like nobody has done this so far
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #10 on: June 26, 2023, 08:20:07 AM »
the link for the AWEKAS API in the weewx-google group is outdated
here the latest: https://www.awekas.at/board/index.php?attachment/6243-awekas-station-api-v2-1-pdf/
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline gianvi97

  • Member
  • *
  • Posts: 11
Re: Weewx Awekas API
« Reply #11 on: June 26, 2023, 09:08:34 AM »
look up https://groups.google.com/g/weewx-user/c/l3D5BLgeGTA?pli=1
in the same thread there is a link to the AWEKAS API description.
you will have to modify (respectively create a modified copy of) wee_import and weeimport.py and a new Python programm e.g. awekas.py (you could start with a copy of wuimport.py in /usr/share/weewx/weeimport) .

Read it (wee_import, wuimport.py and weeimport.py), understand it and implement the retrieval from AWEKAS analogously to WU.
The import portion may also need modification depending on the sensors used.

the wee_import start script wee_import describes at line 653 how to create a new service for import (here AWEKAS)

But you will need some programming skills  8-) - looks like nobody has done this so far

I understand, then there are changes to be made. I have some programming basics but I would never be able to do something like this on my own.

You talk about line 653, but what about? Of the wee_import script?

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #12 on: June 26, 2023, 10:38:17 AM »
Quote
the wee_import start script wee_import describes at line 653 how to create a new service for import (here AWEKAS
yes, that's what that sentence says
there are three things to be considered:
1. the wee_import start script by the name wee_import in  /usr/share/weewx
2. the Python program weeimport.py in  /usr/share/weewx/weeimport
3. the Python program wuimport.py in  /usr/share/weewx/weeimport
starting from line 653 of 1. you find the instructions what to do to create your own download service (module, program)

I suggest you make a copy of wuimport.py
(sudo cp  /usr/share/weewx/weeimport/wuimport.py /usr/share/weewx/weeimport/awekasimport.py )

then edit
1. the wee_import script
2. the weeimport.py (add the awekas option)
3. modify awekasimport.py in a way that it no longer reads its data from WU but from AWEKAS.

Depending on how the field map of the original wuimport.py looks like and what are the sensor data you want to download from Awekas, you may have to modify the field map, make sure you can hand-over the credentials (stationID, password ....) needed to access the AWEKAS API. For this you have the API description.
Analogously as the wuimport.py program downloads data from WU, your new awekasimport.py will have to download the needed data from AWEKAS.

That's how I would do it ...

EDIT moved a wrongly placed ")" from the cp command to the end of the line
« Last Edit: June 27, 2023, 12:39:40 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #13 on: June 27, 2023, 01:46:44 AM »
if the above approach, which would be the professional way to do, is too complicated for you, I could also imagine another way of doing so:
download the AWEKAS data and convert them into a CSV file and then use wee_import to import the CSV file with its existing option

- create a script (linux or powershell depending on your operating system) to download data via the AWEKAS API
make sure the programs (wget, curl) by which you access the AWEKAS API and download the data for a specific EPOCH time stamp are installed on your server (this is for Linux based OS - some linux derivates don't install them by default)

the result will be a JSON file as descibed in the AWEKAS API document
- create a script to convert that JSON file into a CSV file (and use only data you need, omit the rest)
don't forget the header line of the CSV file with the field descriptions (names) which is used in the import config file
use ";" as delimiter - it will save you some headache with wee_import

(examples: https://www.cyberciti.biz/faq/how-to-convert-json-to-csv-using-linux-unix-shell/ )
- define your field map in the wee_import import configuration file
- run wee_import with your CSV file and your respective import configuration file as described in the weewx utilities guide
http://www.weewx.com/docs/latest/utilities.htm#wee_import_utility

- create a CRONTAB job (or a Windows scheduler task) which runs the before mentioned scripts one after the other in the time interval of your choice

for historical data I would download the needed time period and create the import CSV file with the help of MS EXCEL or a text editor (e.g. notepad++) manually - then run wee_import

if you happen to possess an Ecowitt (clone) weather station, there are much simpler ways to get your data to AWEKAS and weewx in parallel without having to download this data again from AWEKAS
« Last Edit: June 27, 2023, 01:55:31 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline gianvi97

  • Member
  • *
  • Posts: 11
Re: Weewx Awekas API
« Reply #14 on: June 27, 2023, 05:29:20 AM »
if the above approach, which would be the professional way to do, is too complicated for you, I could also imagine another way of doing so:
download the AWEKAS data and convert them into a CSV file and then use wee_import to import the CSV file with its existing option

- create a script (linux or powershell depending on your operating system) to download data via the AWEKAS API
make sure the programs (wget, curl) by which you access the AWEKAS API and download the data for a specific EPOCH time stamp are installed on your server (this is for Linux based OS - some linux derivates don't install them by default)

the result will be a JSON file as descibed in the AWEKAS API document
- create a script to convert that JSON file into a CSV file (and use only data you need, omit the rest)
don't forget the header line of the CSV file with the field descriptions (names) which is used in the import config file
use ";" as delimiter - it will save you some headache with wee_import

(examples: https://www.cyberciti.biz/faq/how-to-convert-json-to-csv-using-linux-unix-shell/ )
- define your field map in the wee_import import configuration file
- run wee_import with your CSV file and your respective import configuration file as described in the weewx utilities guide
http://www.weewx.com/docs/latest/utilities.htm#wee_import_utility

- create a CRONTAB job (or a Windows scheduler task) which runs the before mentioned scripts one after the other in the time interval of your choice

for historical data I would download the needed time period and create the import CSV file with the help of MS EXCEL or a text editor (e.g. notepad++) manually - then run wee_import

if you happen to possess an Ecowitt (clone) weather station, there are much simpler ways to get your data to AWEKAS and weewx in parallel without having to download this data again from AWEKAS
Hello, thank you for your kind and complete answer and for the time you have dedicated to me.

This approach is just what I was thinking.
I already have the awekas link with its api that returns the data to me

https://api.awekas.at/current.php?key=tZNpNSIsEGM%2FIxpbyB6exyYvbI8wx8A0rJL6NLJ17c1OIiCvhyjs8S5PJan6b4e7%2FCMC1AV%2B7KfBC0AvYvuAAg%3D%3D

So I should fetch this json file and convert it to csv. weewx doesn't take .json data? Do I have to convert them to json?

I already do something like this to get updated data on my webcam. With a php script, I take the data from the wunderground api (json format) and print it in a txt file
Then I print this txt file on the self-updating image of the webcam. And to run the script I use an online cronjob every few minutes.

https://www.meteone.it/stazionimeteo/jesce/FoscamCamera_E8ABFAA7EB56/snap/webcam.php

I have to look for the best solution to feed this data to weewx. I know some weather stations create a current.txt file with all data in string. Do you have any idea?

Unfortunately I don't have big programming bases if not something like python and php. It would be difficult for me to create something from scratch and I'm not sure how weewx works

Thanks

P.s: I found something like this
https://github.com/themoosman/weewx-ambientweatherapi-json
« Last Edit: June 27, 2023, 05:42:15 AM by gianvi97 »

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #15 on: June 27, 2023, 09:18:35 AM »
I already have the awekas link with its api that returns the data to me

https://api.awekas.at/current.php?key=tZNpNSIsEGM%2FIxpbyB6exyYvbI8wx8A0rJL6NLJ17c1OIiCvhyjs8S5PJan6b4e7%2FCMC1AV%2B7KfBC0AvYvuAAg%3D%3D

So I should fetch this json file and convert it to csv. weewx doesn't take .json data? Do I have to convert them to json?
the proposed approach is to use the weewx CSV import - how this works is described in http://www.weewx.com/docs/latest/utilities.htm#wee_import_utility

now the question is how to get this CSV file

as the AWEKAS API provides a JSON file, this needs to be converted into a CSV file which weewx can import
that mean that that CSV file has to have the names of the data you provide in the proper sequence - example see weewx documentation
the 2nd (and following lines if you import more than one line at a time) line has the data in the sequence of the header line separated by a ";" (without the "")

If you have (or can build) a PHP file/script which downloads the data from AWEKAS, converts the JSON format into a CSV and saves that, you are almost done.
The JSON file has a structure variable_name, "value" - so you have to build a line with all the variable names and another one with all the values, each one (also the variable names) separated by a ";"
after the last value no semicolon !
now save first the line of the names, then the line with the values into the same (txt) file which has then two line - headers and values
(you may save write or print instead of save but that's he same thing here as long as that file with the two lines is created)
When you have created the proper import description (import configuration file with its field map and the other options chosen which have to be in the import config file),
wee_import can import this file into weewx
when your PHP script runs every minute and creates that file (with the same file name), wee_import just also needs to run every minute and do the import

The name of the text file is irrelevant as long as it is a text file and contains the proper headers and values. in your import config file (proposed name import.conf) you refer to the CSV file - what's written there has to match the name of the file you created.

what's your weather station ? Brand, model ?
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline gianvi97

  • Member
  • *
  • Posts: 11
Re: Weewx Awekas API
« Reply #16 on: June 27, 2023, 09:29:02 AM »
I already have the awekas link with its api that returns the data to me

https://api.awekas.at/current.php?key=tZNpNSIsEGM%2FIxpbyB6exyYvbI8wx8A0rJL6NLJ17c1OIiCvhyjs8S5PJan6b4e7%2FCMC1AV%2B7KfBC0AvYvuAAg%3D%3D

So I should fetch this json file and convert it to csv. weewx doesn't take .json data? Do I have to convert them to json?
the proposed approach is to use the weewx CSV import - how this works is described in http://www.weewx.com/docs/latest/utilities.htm#wee_import_utility

now the question is how to get this CSV file

as the AWEKAS API provides a JSON file, this needs to be converted into a CSV file which weewx can import
that mean that that CSV file has to have the names of the data you provide in the proper sequence - example see weewx documentation
the 2nd (and following lines if you import more than one line at a time) line has the data in the sequence of the header line separated by a ";" (without the "")

If you have (or can build) a PHP file/script which downloads the data from AWEKAS, converts the JSON format into a CSV and saves that, you are almost done.
The JSON file has a structure variable_name, "value" - so you have to build a line with all the variable names and another one with all the values, each one (also the variable names) separated by a ";"
after the last value no semicolon !
now save first the line of the names, then the line with the values into the same (txt) file which has then two line - headers and values
(you may save write or print instead of save but that's he same thing here as long as that file with the two lines is created)
When you have created the proper import description (import configuration file with its field map and the other options chosen which have to be in the import config file),
wee_import can import this file into weewx
when your PHP script runs every minute and creates that file (with the same file name), wee_import just also needs to run every minute and do the import

The name of the text file is irrelevant as long as it is a text file and contains the proper headers and values. in your import config file (proposed name import.conf) you refer to the CSV file - what's written there has to match the name of the file you created.

what's your weather station ? Brand, model ?

Ok yes the approach is correct, I have to use this by force. The php script that transforms the json to csv I can do it simply. For the rest then, I'm sincerely lost. The whole part with weewx is difficult for me to understand. I have read the documentation but an expert hand would be needed

I have this bresser 7 in 1

https://www.bresser.de/it/Ora-Tempo/Stazioni-Centri-meteo-WIFI/MeteoChamp-HD-WLAN-Wetter-Center-7-in-1-BRESSER.html

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3298
Re: Weewx Awekas API
« Reply #17 on: June 27, 2023, 10:43:15 AM »
where do you run weewx ?
on a RaspberryPi, on a NAS ? On a VM in a NAS ? Which OS (operating system) ?
when you think you have the CSV file ready, send it to me in a PM (private mail) (see below *).
Then we will see if your data from AWEKAS is properly imported.
once the format is correct,  I can create the import configuration file for you and you can try the import
For this I will need the file (see below *)
Once this works, we can automatize the download and import every 5 minutes by creating one or more CRONTAB entries.

*)
Once your PHP script is ready, run the download and then the PHP script for one day every 5 minutes so you can create a bigger input file.
For this you best create a file with the name awekas-import_date-time.txt where date-time is the EPOCH timestamp which comes with the AWEKAS API download (a 10-digit number starting with 16... - it's the seconds passed since 1.1.1970) - so your file name would be something like
awekas-import_1687876200.txt
awekas-import_1687876500.txt
awekas-import_1687876800.txt
awekas-import_1687877100.txt
etc.

you then create manually a text file awekas-import_20230627.txt by copying the first file and then copy the data lines from every other file behind the dataline of the first one and save it.
sudo cp awekas-import_1687876200.txt awekas-import_20230627  (file names here are examples)


WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.1, GW2000(3) 3.1.1, HP2551 1.9.5,5.1.5;HP3500 1.7.2,WS3800 1.2.8, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.3.5/1.4.0, WS80(2)1.2.5, WS68, WS69, WH40, WH31, WH31-EP, WN30, WN34L, WN35, WH32, WH32-EP, WH32B, WH57 [Lightning], WH41 [PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB(3169)
Barani Meteoshield Pro, MetSpec Rad02 - Ecowitt 5763,34418;WU ISAARB3(WH4000SE),ISAARB22(HP2553), http://meshka.eu

Offline gianvi97

  • Member
  • *
  • Posts: 11
Re: Weewx Awekas API
« Reply #18 on: June 27, 2023, 10:58:13 AM »
where do you run weewx ?
on a RaspberryPi, on a NAS ? On a VM in a NAS ? Which OS (operating system) ?
when you think you have the CSV file ready, send it to me in a PM (private mail) (see below *).
Then we will see if your data from AWEKAS is properly imported.
once the format is correct,  I can create the import configuration file for you and you can try the import
For this I will need the file (see below *)
Once this works, we can automatize the download and import every 5 minutes by creating one or more CRONTAB entries.

*)
Once your PHP script is ready, run the download and then the PHP script for one day every 5 minutes so you can create a bigger input file.
For this you best create a file with the name awekas-import_date-time.txt where date-time is the EPOCH timestamp which comes with the AWEKAS API download (a 10-digit number starting with 16... - it's the seconds passed since 1.1.1970) - so your file name would be something like
awekas-import_1687876200.txt
awekas-import_1687876500.txt
awekas-import_1687876800.txt
awekas-import_1687877100.txt
etc.

you then create manually a text file awekas-import_20230627.txt by copying the first file and then copy the data lines from every other file behind the dataline of the first one and save it.
sudo cp awekas-import_1687876200.txt awekas-import_20230627  (file names here are examples)

Ok I'll try to make the script in php.

I will run weewx on orangepi