So, I want to easily be able to query the database, and see at any given 
time what the 24 hour rain total is. When I go to Dec 15 at 2:00pm, I want 
to know how much was accumulated between 12/14 2:00pm-12/15 2:00pm. Yes, I 
can do a complex mysql query to get this information, but I really don't 
understand as to why this isn't a field that can't be calculated every time 
an archive record is listed, and then it would instantaneously be there.

This issue started when I had excess water in my basement. I figured hmmm I 
must have gotten a lot of rain in the past day, so let me see in a graph 
view the 24 hour totals over the past few weeks, and find the max that my 
property has gotten in a 24 hour window. Midnight to Midnight wasn't the 
max, but rather a day from 4am-4am provided the max.

I understand that I can do the rain sum function on reports, but still 
think having this directly in the database would be better to have for 
queries. It seems doable.

On Thursday, January 3, 2019 at 4:17:29 PM UTC-5, gjr80 wrote:
>
> Hi,
>
> I am a little bit lost in terms of understanding what it is you want to 
> do. Do you want a field in the weeWX archive that contains the rainfall in 
> the last 24 hours;for example today's 09:30 archive record would contain 
> the rainfall from 09:30 yesterday to 09:30 today, today's 09:35 record 
> would contain the rainfall from 09:35 yesterday to 09:35 today? If done 
> properly (ie add a field to the in use schema then implement some code to 
> calculate the value and add it to the archive record - refer to Adding a 
> new type to the archive database 
> <http://weewx.com/docs/customizing.htm#add_archive_type>) then it will 
> not interfere with weeWX. It is when you start willy nilly adding fields 
> and implementing external code to interact with the database that people 
> run into problems (particularly with the daily summaries).
>
> But I guess I would still ask fundamentally what do you want to do with 
> this data? I am hard pressed to understand why you might want the rainfall 
> from 11:25 17 September 2017 until 11:25 18 September 2017, or say 11:45 17 
> September 2017 to 11:45 18 September 2017. Would not the existing daily 
> midnight to midnight totals be adequate for historical analysis. WeeWX 
> already has a tag that will provide the current previous 24 hour period 
> rainfall in a report. If you use the tag 
>
> $span($day_delta=1).rain.sum (in fact it is one of the examples for the span 
> tag <http://weewx.com/docs/customizing.htm#_________Tag_$span_______>) 
> that will display the rainfall over the last immediate 24 hour period. The 
> problem with this tag is whilst you get the current value you don't have 
> access to historical data eg what was the rainfall from 11:25 17 September 
> 2017 until 11:25 18 September 2017.
>
> I really think you need to very clearly define what data you want and what 
> you want to do with it lest you will spend an awful lot of effort (both 
> yours and ours) for perhaps little gain.
>
> Gary
>
> On Thursday, 3 January 2019 01:37:50 UTC+10, bdf0506 wrote:
>>
>> Yea, I figured I could do this with a mysql query, but was hoping to get 
>> it into the database structure so I can run simple queries based on the 
>> numbers already being calculated as a field, as this is an important number 
>> to see for me in the db itself.
>>
>> If I alter the table and add syntax to the table, I believe this will 
>> mess up the insert functionality from weewx, correct?
>>
>> On Tuesday, January 1, 2019 at 3:31:04 AM UTC-5, mwall wrote:
>>>
>>> On Monday, December 31, 2018 at 12:50:45 PM UTC-5, bdf0506 wrote:
>>>>
>>>> I am looking to add information into my archive database that will show 
>>>> rainfall over the last 24 hours.
>>>>
>>>> Today, I have the influxdb extension, and when I look in the influxdb, 
>>>> I see a measurement for "rain24_in". I would like for this to also appear 
>>>> within the mysql DB that I am using. I currently have "rain" and 
>>>> "rainRate" 
>>>> in mysql DB, but nothing about 24hour rainfall.
>>>>
>>>> How can I accomplish this?
>>>>
>>>
>>> you already have it.
>>>
>>> SELECT SUM(rain), MIN(usUnits), MAX(usUnits) FROM archive WHERE 
>>> dateTime>X and dateTime<=Y
>>>
>>> where Y is the current time (as epoch) and X=Y-24*3600
>>>
>>> the rain24_in the influx packets is simply the value returned from that 
>>> query.
>>>
>>> m
>>>
>>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to