Hi again,
so I tried to do it your way, it works now.
the feinstaub.log looks like this:
{"time":1606510522,
"datum":"2020-11-27",
"zeit":"21:55:22",
"ipAddress":"192.168.1.23",
"daten":{"esp8266id": "759897", "software_version": "NRZ-2020-131",
"sensordatavalues":[{"value_type":"SDS_P1","value":"465.88"},{"value_type":"SDS_P2","value":"66.15"},{"value_type":"BME280_temperature","value":"-0.09"},{"value_type":"BME280_pressure","value":"98677.09"},{"value_type":"BME280_humidity","value":"100.00"},{"value_type":"samples","value":"3565079"},{"value_type":"min_micro","value":"39"},{"value_type":"max_micro","value":"43094"},{"value_type":"interval","value":"145000"},{"value_type":"signal","value":"-62"}]}
}
now we need to save it to main database weewx.sdb I hope. Let's ask Ian how
to do it with filepile.
Or let me know, when you will be further with your solutions.
Thanks,
M
Dátum: piatok 27. novembra 2020, čas: 21:29:24 UTC+1, odosielateľ: miso k
> so i added the file named data_simple.php with content as in the example
> above. Then I have browsed the address myRPiweewxIPaddress/data_simple.php
> and i got the answer:
> Sensor: ok
> ,but this will be also without any imput data from sensor...
> No csv is produced.
>
> rights on data_simple.php are -rw-r--r-- . is it ok?
>
>
> Dátum: piatok 27. novembra 2020, čas: 13:14:25 UTC+1, odosielateľ: miso k
>
>> Hello,
>> I have this answer from sensor developer:
>>
>> this feature exists in this firmware. Just look for "Send data to custom
>> API". There you can configure a server and a path to a script on i.e. a
>> Raspberry PI. If configured the firmware will send a JSON object to this
>> address. There is a sample script at
>> https://github.com/opendata-stuttgart/madavi-api/blob/master/data_simple.php
>> that
>> will take this object and save the data to a CSV file.
>>
>>
>>
>> Dňa pi 27. 11. 2020, 12:18 Calo Geyer <[email protected]> napísal(a):
>>
>>> And this is what I am going to do this night or later when I got time;
>>> changing the script to fill the database directly.
>>>
>>> https://tech.hamm7.de/blogs/feinstaub/feinstaubphp
>>>
>>> On Friday, November 27, 2020 at 12:10:01 PM UTC+1 Calo Geyer wrote:
>>>
>>>> Hi, I now made some php call using the setting "send to own API" and do
>>>> get the data into a log file. It basically looks like the json output when
>>>> you retrieve via IPaddress/data.json directly from the sensor.
>>>> Requirements are apache (httpd) and php installed. Do not forget to
>>>> start httpd (sudo systemctl start httpd on archlinux)
>>>>
>>>> I initially followed this instruction
>>>>
>>>>
>>>> https://blog.helmutkarger.de/feinstaubsensor-teil-12-sensordaten-selbst-speichern/
>>>>
>>>> creating a folder in srv/http/weewx/feinstaub and placed the SDS011.php
>>>> there. The SDS011.php contains the code which is shown in the thread above.
>>>> <?php
>>>> $json = file_get_contents("php://input");
>>>> file_put_contents("feinstaub.log", $json);
>>>> ?>
>>>> I then created an empty feinstaub.log file in that folder too and make
>>>> sure you grant write and read access to it (chmod 666 feinstaub.log). If
>>>> you then add the server and path including name of .php (in my case
>>>> weewx/SDS011.php) in your sensor configuration then you should see the
>>>> updated data every 145 seconds.
>>>>
>>>> Since I missed the timestamp etc. I moved to this php script
>>>>
>>>>
>>>> https://www.a-d-k.de/20170226_221904-Feinstaubalarm+oder+wie+gut+ist+die+Luft.htm
>>>>
>>>> ?php $logURL="feinstaub.log";
>>>> $logToOrdner="feinstaublog/".date('Ymd').".log"; $itime=
>>>> time();//timestamp
>>>> Januar 1 1970 00:00:00 GMT $datum= date('Y-m-d'); $zeit= date('G:i:s');
>>>> $ipAddress=$_SERVER['REMOTE_ADDR']; $daten =
>>>> file_get_contents('php://input'); if(isset($daten) &&
>>>> !empty($daten)){//wenn Daten leer, nicht speichern //create oder add;
>>>> aktuelles Messwert $handle=fopen($logURL,'w'); fwrite ($handle, "{" );
>>>> fwrite ($handle, '"time":'.$itime.','.chr(10)); fwrite ($handle,
>>>> '"datum":"'.$datum.'",'.chr(10)); fwrite ($handle,
>>>> '"zeit":"'.$zeit.'",'.chr(10)); fwrite ($handle,
>>>> '"ipAddress":"'.$ipAddress.'",'.chr(10)); fwrite ($handle,
>>>> '"daten":'.$daten.chr(10) ); fwrite ($handle, "}".chr(10) ); fclose
>>>> ($handle); } if(isset($daten) && !empty($daten)){//wenn Daten leer, nicht
>>>> speichern //als Datensätze in Ordner, $add=file_exists($logToOrdner);
>>>> $handle=fopen($logToOrdner,'a'); if($add)fwrite ($handle, "," ); fwrite
>>>> ($handle, "{" ); fwrite ($handle, '"time":'.$itime.','); fwrite ($handle,
>>>> '"datum":"'.$datum.'",'); fwrite ($handle, '"zeit":"'.$zeit.'",'); fwrite
>>>> ($handle, '"daten":'.$daten ); fwrite ($handle, "}".chr(10) ); fclose
>>>> ($handle); } ?>
>>>>
>>>> This log is then in a separate folder having the date on it. I will now
>>>> continue later on the next steps.
>>>>
>>>> Regards,
>>>> Andreas
>>>> On Friday, November 20, 2020 at 9:35:16 AM UTC+1 [email protected]
>>>> wrote:
>>>>
>>>>> Michal,
>>>>> I have emailed you directly.
>>>>> Ian
>>>>>
>>>>> On Friday, November 20, 2020 at 3:10:23 AM UTC [email protected]
>>>>> wrote:
>>>>>
>>>>>> Hi Ian,
>>>>>> Just a kindly reminder, if you will have little time.
>>>>>>
>>>>>> I am desperate to provide PM info to my neighbors, which are using
>>>>>> wood for heating!
>>>>>>
>>>>>> Thanks,
>>>>>> Michal
>>>>>>
>>>>>> Dňa ut 17. 11. 2020, 9:11 steeple ian <[email protected]>
>>>>>> napísal(a):
>>>>>>
>>>>>>> Morning,
>>>>>>> I am just doing some work on the weather34 skin at the moment. Give
>>>>>>> a little time and I will write this up more fully for you.
>>>>>>> Ian
>>>>>>>
>>>>>>> On Tue, 17 Nov 2020 at 07:36, [email protected] <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> thanks for guiding me!
>>>>>>>>
>>>>>>>> 1. I am able to install weewx-sds011, but i am not able to repeat
>>>>>>>> all your steps.
>>>>>>>> 2. how can i rsync data? just throught API in the web interface of
>>>>>>>> luftdaten sensor?
>>>>>>>>
>>>>>>>> 3. how filepile works? it saves data to a plain text document?
>>>>>>>> filename = /var/tmp/pond.txt
>>>>>>>> Or are you able to store it in the new SDB database?
>>>>>>>>
>>>>>>>> 4. I will be probably able to create .tmpl and integrate it to my
>>>>>>>> webpage. Only how the $parameters and formating looks like is the
>>>>>>>> question
>>>>>>>>
>>>>>>>> thanks for your help!
>>>>>>>>
>>>>>>>> btw, my webpage: http://jastrabie.online/weewx/
>>>>>>>>
>>>>>>>> Dátum: pondelok 16. novembra 2020, čas: 9:41:36 UTC+1, odosielateľ:
>>>>>>>> [email protected]
>>>>>>>>
>>>>>>>>> Google weewx-sds011. There is an extension for that sensor.
>>>>>>>>>
>>>>>>>>> In my case I rsync data to my main server and then use
>>>>>>>>> weewx-filepile extension to insert data into the new extended
>>>>>>>>> database. I
>>>>>>>>> then use a custom .tmpl to aggregate the data for a rolling 24hr AQI.
>>>>>>>>>
>>>>>>>>> Ian
>>>>>>>>>
>>>>>>>>> On Sun, 15 Nov 2020 at 20:46, [email protected] <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>> has anybody integrated the air quality API to WeeWX?
>>>>>>>>>>
>>>>>>>>>> It should be probably something easy, as the sensor firmware has
>>>>>>>>>> API with custom server, path, port, username/password to entry.
>>>>>>>>>>
>>>>>>>>>> or there is also api for sensor.community service
>>>>>>>>>>
>>>>>>>>>> https://sensor.community/
>>>>>>>>>> https://opensensemap.org/
>>>>>>>>>>
>>>>>>>>>> thanks for info,
>>>>>>>>>> Michal, SVK
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>> Google Groups "weewx-user" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>> To view this discussion on the web visit
>>>>>>>>>> https://groups.google.com/d/msgid/weewx-user/0171755b-7bd6-49f8-bc18-39261c278466n%40googlegroups.com
>>>>>>>>>>
>>>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/0171755b-7bd6-49f8-bc18-39261c278466n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "weewx-user" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/weewx-user/3f5f192a-541f-4918-ab85-1f91c612c429n%40googlegroups.com
>>>>>>>>
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/3f5f192a-541f-4918-ab85-1f91c612c429n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>> You received this message because you are subscribed to a topic in
>>>>>>> the Google Groups "weewx-user" group.
>>>>>>> To unsubscribe from this topic, visit
>>>>>>> https://groups.google.com/d/topic/weewx-user/UJhz34G5r8s/unsubscribe
>>>>>>> .
>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>> [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/weewx-user/CADASSaTpGmhGVTTVjxdvnufG2AgUmOq7bS2RKYUrOsHuGyknCA%40mail.gmail.com
>>>>>>>
>>>>>>> <https://groups.google.com/d/msgid/weewx-user/CADASSaTpGmhGVTTVjxdvnufG2AgUmOq7bS2RKYUrOsHuGyknCA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "weewx-user" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/weewx-user/UJhz34G5r8s/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/a845b1f2-a4f2-46cd-b129-5083c68bb4fen%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/weewx-user/a845b1f2-a4f2-46cd-b129-5083c68bb4fen%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/0ea769f0-7846-4657-b7f8-47b63dc75bfbn%40googlegroups.com.