fmatovic Geschrieben February 18, 2019 at 22:48 Share Geschrieben February 18, 2019 at 22:48 Hi guys, I'm trying to implement a daily reset command to be exectured through cron job on raspberry pi (through which the Brick and Outdoor Weather Station Bricklet are connected) for the rain gauge. So... anyone has any idea how to reset the rain gauge through python or any other way except the one removing the batteries and reseting the whole brick etc.? Thanks Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
borg Geschrieben February 19, 2019 at 11:09 Share Geschrieben February 19, 2019 at 11:09 You have to save the value of the last "last_value" and then read the new value for the new day "new_value". The amount of rain for one day can then be calculated by "new_value - last_value". Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
fmatovic Geschrieben February 19, 2019 at 17:53 Autor Share Geschrieben February 19, 2019 at 17:53 Okay but, just a workaround the total will still remain the same. Any idea how i can do that in my python script? with API from tinkerforge? Wihout creating additional column in my db and storing another value each day and then representing it on frontend oldValue - newValue ? Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
borg Geschrieben February 19, 2019 at 17:55 Share Geschrieben February 19, 2019 at 17:55 In the database you can save the global value for each day. When you want to display the value you get the value from last day from the database and the value from today and the difference is the amount of rain from the last 24 hours. You can do the same for the amount of rain for the last 1 hour etc, depending on the frequency with which you save data to the database. Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
fmatovic Geschrieben February 19, 2019 at 19:06 Autor Share Geschrieben February 19, 2019 at 19:06 Yes yes, but that's all done on my DB and Cron jobs. On the other side you can't just send values to DB each 24 hours, cause then you don't have other values like, wind, temp and hum in real time (each 40 sec). So you would have to split the rain with separate script to store its rain. Nvm... seems like CRON job to run each day at midnight and new column in table will have to do it. I was thinking if there was something in the API which could help me trigger the rain gauge to reset or dump its stored data on bricket directlly. Thanks anyway Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.