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 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/a845b1f2-a4f2-46cd-b129-5083c68bb4fen%40googlegroups.com.
