Jump to content

Time Stamp - How to maintain last known date?


Teken

Recommended Posts

I don't recall if this question or problem has ever been posed by a member so here goes. I have a program that tracks the current, low, high values.

 

Whether it be energy, voltage, humidity, temperature, etc.

 

The system currently sends me a e-mail from 1 to 3 times a day depending on what the application is being monitored etc. I would like to know is there a method where I can have a time stamp with the last change with the above fields?

 

Examples Below:

 

Current: 20'C 12:00 PM 18/08/2015

Low: 15'C 5:42 PM 05/12/2014

HIGH: 35'C 3:48 PM 22/07/2015

 

As you see in the fictitious example above which I have high lighted in different colors. Is there a method where these time stamps can exist until such time as these values change? From that point forward those dates and times would obviously change to reflect the current, low, high values??

 

These time stamps should exist even after a firmware update / system reboot.

 

Make sense, clear as mud??? 

Link to comment

I don't recall if this question or problem has ever been posed by a member so here goes. I have a program that tracks the current, low, high values.

 

Whether it be energy, voltage, humidity, temperature, etc.

 

The system currently sends me a e-mail from 1 to 3 times a day depending on what the application is being monitored etc. I would like to know is there a method where I can have a time stamp with the last change with the above fields?

 

Examples Below:

 

Current: 20'C 12:00 PM 18/08/2015

Low: 15'C 5:42 PM 05/12/2014

HIGH: 35'C 3:48 PM 22/07/2015

 

As you see in the fictitious example above which I have high lighted in different colors. Is there a method where these time stamps can exist until such time as these values change? From that point forward those dates and times would obviously change to reflect the current, low, high values??

 

These time stamps should exist even after a firmware update / system reboot.

 

Make sense, clear as mud??? 

I use a variable as a heartbeat from my WC8.

 

The variable is formatted as MMDDhhmmss. I figured the year wasn't needed in ISY.

 

After some experience with ISY becoming busy I have slowed the heartbeat down to every 15 seconds.

 

Each time the new heartbeat / datime is changed and it is greater than 0101000000 (Jan 1 Midnight) I save the value in the "init to" register.

When I ISY boots up a Boot-Up enabled program sends notification of the current date and time along with the last known WC8 datime variable IIRC I exploded the variable to look more human on the notification.

 

This variable value could be stuffed into an adjacent variable (until ISY gets user defined indexed variable types :) Michel shudders!) with any recorded variable.

 

After  power failure I can tell from notifications how long the grid was out. A fairly constant boot time has to be subtracted from the time difference.

Link to comment

I take it from your reply what I am asking can't presently be done?

Can't be done with  ISY 4.x.x  or earlier without having access to date/time in variables.

 

With a real time clock inputting data into ISY or Apostolakisl's program sequence to break out the date and time info into variables. Just save a compound variable created from date and time along with the data to be saved.

 

Notifications currently (v4.3.0) can send date and time in notifications but cannot save them without a technique stated above.

 

Am I missing something? this sounds like a very simple request. Maybe my middle eastern Canuck accent? :)

Link to comment

Am I missing something? this sounds like a very simple request. Maybe my middle eastern Canuck accent? :)

 

Sounds simple but unfortunately no easy way to obtain said data. I do hope you realize you Eastern folks do sound a little off eh?

 

Ha . . .

Link to comment

Can't be done with  ISY 4.x.x  or earlier without having access to date/time in variables.

 

 

 

It can be done using my programs for date and time variables.  The day/date programs are on the wiki, and below is a minute/hour set of programs.

===================================================================================
Hour Minute - [ID 0103][Parent 004D]

Folder Conditions for 'Hour Minute'

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
   Allow the programs in this folder to run.
 



-----------------------------------------------------------------------------------
Hour of Day 0 - [ID 00FC][Parent 0103]

If
        Time is 12:00:00AM
 
Then
        $iHour.of.Day  = 0
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 01 - [ID 0102][Parent 0103]

If
        Time is  1:00:00AM
 
Then
        $iHour.of.Day  = 1
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 02 - [ID 0101][Parent 0103]

If
        Time is  2:00:00AM
 
Then
        $iHour.of.Day  = 2
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 03 - [ID 0100][Parent 0103]

If
        Time is  3:00:00AM
 
Then
        $iHour.of.Day  = 3
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 04 - [ID 00FF][Parent 0103]

If
        Time is  4:00:00AM
 
Then
        $iHour.of.Day  = 4
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 05 - [ID 00FE][Parent 0103]

If
        Time is  5:00:00AM
 
Then
        $iHour.of.Day  = 5
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 06 - [ID 0104][Parent 0103]

If
        Time is  6:00:00AM
 
Then
        $iHour.of.Day  = 6
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 07 - [ID 0105][Parent 0103]

If
        Time is  7:00:00AM
 
Then
        $iHour.of.Day  = 7
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 08 - [ID 0106][Parent 0103]

If
        Time is  8:00:00AM
 
Then
        $iHour.of.Day  = 8
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 09 - [ID 0107][Parent 0103]

If
        Time is  9:00:00AM
 
Then
        $iHour.of.Day  = 9
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 10 - [ID 0108][Parent 0103]

If
        Time is 10:00:00AM
 
Then
        $iHour.of.Day  = 10
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 11 - [ID 010A][Parent 0103]

If
        Time is 11:00:00AM
 
Then
        $iHour.of.Day  = 11
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 12 - [ID 0109][Parent 0103]

If
        Time is 12:00:00PM
 
Then
        $iHour.of.Day  = 12
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 13 - [ID 010B][Parent 0103]

If
        Time is  1:00:00PM
 
Then
        $iHour.of.Day  = 13
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 14 - [ID 010C][Parent 0103]

If
        Time is  2:00:00PM
 
Then
        $iHour.of.Day  = 14
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 15 - [ID 010D][Parent 0103]

If
        Time is  3:00:00PM
 
Then
        $iHour.of.Day  = 15
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 16 - [ID 010E][Parent 0103]

If
        Time is  4:00:00PM
 
Then
        $iHour.of.Day  = 16
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 17 - [ID 0110][Parent 0103]

If
        Time is  5:00:00PM
 
Then
        $iHour.of.Day  = 17
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 18 - [ID 010F][Parent 0103]

If
        Time is  6:00:00PM
 
Then
        $iHour.of.Day  = 18
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 19 - [ID 0112][Parent 0103]

If
        Time is  7:00:00PM
 
Then
        $iHour.of.Day  = 19
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 20 - [ID 0111][Parent 0103]

If
        Time is  8:00:00PM
 
Then
        $iHour.of.Day  = 20
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 21 - [ID 0113][Parent 0103]

If
        Time is  9:00:00PM
 
Then
        $iHour.of.Day  = 21
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 22 - [ID 0114][Parent 0103]

If
        Time is 10:00:00PM
 
Then
        $iHour.of.Day  = 22
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Hour of Day 23 - [ID 0115][Parent 0103]

If
        Time is 11:00:00PM
 
Then
        $iHour.of.Day  = 23
        $iMinute.of.Hour  = 0
        Run Program 'Minute of Hour' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 



-----------------------------------------------------------------------------------
Minute of Hour - [ID 00FD][Parent 0103][Run At Startup]

If
        $iMinute.of.Hour < 0
 
Then
        $sMinute  = $iMinute.of.Hour
        $sHour  = $iHour.of.Day
        $iHour.of.Day Init To $iHour.of.Day
        $iMinute.of.Hour Init To $iMinute.of.Hour
        Wait  1 minute 
        Repeat Every  1 minute 
           $iMinute.of.Hour += 1
           $sMinute  = $iMinute.of.Hour
           $iMinute.of.Hour Init To $iMinute.of.Hour
 
Else
        $iMinute.of.Hour += 1
        Run Program 'Minute of Hour' (Then Path)
 



Link to comment

As an alternative

This could  also be done with only six programs for the hour using a binary search algorithm is program count is a problem. Of course apostolakisl's other programs would still need to be integrated to keep track of the minutes.

 

 

Trigger chain

If

   Time is 0:00 OR 1:00 OR 2:00 OR ..... OR 23:00

Then

  Run Hour16 (If)

 

Hour16 (disabled)

if

   Time is from 16:00 - 23:59

Then

   $Hour.temp = 16

   Run Hour8 (If)

Else

   $Hour.temp = 0

   Run Hour8 (If)

 

Hour8 (disabled)

If

   Time is 8:00 - 15:00

Then

   $Hour.temp += 8

   Run Hour 4 (If)

Else

  Run Hour4 (If)

 

Hour4 (disabled)

If

   Time is 4:00 - 7:59 OR 12:00 - 15:59  OR 20:00 - 23:00

Then

   $Hour.temp +=4

   Run Hour2 (If)

Else

   Run Hour2 (If)

 

Hour2 (disabled)

If

    Time is 2:00 - 3:59 OR 6:00-7:59 OR 10:00-11:59 OR 14:00-15:59 OR 18:00-19:59 OR 22:00-23:59

Then

    $Hour.temp +=2

    Run Hour1 (If)

Else

   Run Hour1 (If)

 

Hour1 (disabled)

If

   Time is 1:00-1:59 OR 3:00-3:39 OR 5:00-5:59 OR .......OR 23:00-23:59

Then

    $Hour.Temp +=1

    $sMiinute = 0

    $sHour = $Hour.temp

Link to comment

Thank you both but in case this was not made clear. My over all intent is to maintain the same date and time until there is a change in state for the values listed.

 

So if the lowest temp was recorded on December 01, 2015 at 12:00 PM as -29. This value should survive a reboot and firmware upgrade. If the low temp changes say on December 05, 2015 at 3:33 PM as -35. This new value and time stamp should be updated and in place.

 

I don't think the listed programs will do this, right?

Link to comment

The listed programs only get time and/or dates into variables.

 

Now you need to compact the variables into a timestamp, usually one variable containing all the variables.

 

This can be done (listed somewhere) by

 

$Datime = $Month

$Datime X= 100

$Datime += $Date

$Datime X= 100

$Datime += $Hour

$Datime X= 100

$Datime += $Minute

$Datime X= 100

$Datime += $Seconds

 

Now $Datime contains  MMDDhhmmss, one compact variable which you can store beside, or with your event data, that can be exploded later for viewing by humans. (insert smart-a comment here about westerner Canucks  :) )

 

ISY has a "init to" variable for each that will survive the reboot and be available always, from my experience.

Link to comment

So the above can be inserted into a custom e-mail and each time the e-mail is sent it will reflect either the same data or changed data?

Yes.

Except humans have difficulty interpreting it so I created an explode program to customs unparsed it out to more human readable form.

 

Originally I labelled it like this

 

MMDDhhmmss = 920123643

so that I could remember the format for it in the email.  Until winter there is no leading "1" digit and confusing.

Link to comment

A. Of course apostolakisl's other programs would still need to be integrated to keep track of the minutes.

 

The last program does minutes.

 

Thank you both but in case this was not made clear. My over all intent is to maintain the same date and time until there is a change in state for the values listed.

 

So if the lowest temp was recorded on December 01, 2015 at 12:00 PM as -29. This value should survive a reboot and firmware upgrade. If the low temp changes say on December 05, 2015 at 3:33 PM as -35. This new value and time stamp should be updated and in place.

 

I don't think the listed programs will do this, right?

 

You would use a variable to keep track of the max/min of the value and then compare the current value to that.  If the value exceeds it, then you write to another variable that is the time stamp.

 

loosely written example not exactly following ISY language.

 

 

If

$maxtemp is less than $currenttemp

and

whatever trigger you want

Then

$maxtemp = $currenttemp

$maxtempdatetimestamp = $currentyear*100000000 + $currentmonth * 1000000 +$currentday * 10000 + $currenthour * 100 +$currentminute

 

Of course you can't do the math exactly like that in ISY, but you can do that math just using a working variable and a bunch of extra lines, I just don't have the desire to write it that way right now.

Link to comment

The last program does minutes.

 

 

You would use a variable to keep track of the max/min of the value and then compare the current value to that.  If the value exceeds it, then you write to another variable that is the time stamp.

 

loosely written example not exactly following ISY language.

 

 

If

$maxtemp is less than $currenttemp

and

whatever trigger you want

Then

$maxtemp = $currenttemp

$maxtempdatetimestamp = $currentyear*100000000 + $currentmonth * 1000000 +$currentday * 10000 + $currenthour * 100 +$currentminute

 

Of course you can't do the math exactly like that in ISY, but you can do that math just using a working variable and a bunch of extra lines, I just don't have the desire to write it that way right now.

 

I appreciate the feed back this looks to be a larger task then first envisioned. I know you already linked the calendar program and most of the required code is there so some of it needs to be modified etc.

 

But, its the other portion of the code which makes me take pause.

 

I may have to abandon this idea until perhaps 5.XX offers something similar to what I need. At the current time my little box is a little taxed and don't know if adding more programs will cause it to stumble.

 

It would be really great to see one day the ISY have just a native calendar where a person could just pick and have follow up options as is now to repeat, from day, month, year, from this time etc.

 

But also have the ability to recall a known state / time stamp.

 

I guess when you come from other industrial applications where these features are just there. Its not something a person thinks about until its not.

 

I am going to consider the options laid out here and decide if the time vs investment will be worth the over all effort placed.

 

 

Thank You both . . .

Link to comment

I appreciate the feed back this looks to be a larger task then first envisioned. I know you already linked the calendar program and most of the required code is there so some of it needs to be modified etc.

 

But, its the other portion of the code which makes me take pause.

 

I may have to abandon this idea until perhaps 5.XX offers something similar to what I need. At the current time my little box is a little taxed and don't know if adding more programs will cause it to stumble.

 

It would be really great to see one day the ISY have just a native calendar where a person could just pick and have follow up options as is now to repeat, from day, month, year, from this time etc.

 

But also have the ability to recall a known state / time stamp.

 

I guess when you come from other industrial applications where these features are just there. Its not something a person thinks about until its not.

 

I am going to consider the options laid out here and decide if the time vs investment will be worth the over all effort placed.

 

 

Thank You both . . .

 

5.0 has the ability to assign a variable the current time and date directly from the ISY clock/calendar, so that avoids all the programs that do that.  But you would still need to assign a series of variables to store the max value and the time stamp for it.  Basically the last program I wrote.

 

IF

$maxtemp is less than $currenttemp

and

trigger

THEN

$maxtemp = $currenttemp

$maxtempstamp = [Year]  (this option is available in 5.0)

$maxtempstamp = $maxtempstamp * 100000000

$maxtempstampworkingvariable = [month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 1000000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

$maxtempstampworkingvariable = [day of month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 10000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

etc for hour and minute

 

None of this would tax ISY at all.  This would run in a split second only when your trigger hits.

Link to comment

5.0 has the ability to assign a variable the current time and date directly from the ISY clock/calendar, so that avoids all the programs that do that.  But you would still need to assign a series of variables to store the max value and the time stamp for it.  Basically the last program I wrote.

 

IF

$maxtemp is less than $currenttemp

and

trigger

THEN

$maxtemp = $currenttemp

$maxtempstamp = [Year]  (this option is available in 5.0)

$maxtempstamp = $maxtempstamp * 100000000

$maxtempstampworkingvariable = [month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 1000000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

$maxtempstampworkingvariable = [day of month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 10000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

etc for hour and minute

 

None of this would tax ISY at all.  This would run in a split second only when your trigger hits.

 

Well then, I eagerly await more 5.XX features to be pushed out to the 4.XX platform or see 5.XX come to Beta. I am going to mark down this code you have provided thus far.

 

As always much thanks for the continued support and guidance!

 

I honestly could not have achieved so very much with out the insight and feed back from you and many others.

Link to comment

Not sure I'm reading this right... Are you trying to find out when min/max values occur for tracked variables?

 

If so, might I humbly suggest that such a task is better handled by a database than the ISY? Put all the data in a database, then just politely ask it what the max value for a given field is, and when that field was written to the database. This is how I have all my temperature information stored. I can query the database for a max over any time period. Or averages. Or between 6:00 pm and 8:00 pm. Or every Nth record.

 

When I first set up my 1-Wire system, I created a series of programs on my ISY to track daily, weekly, monthly, annual, and all time temperature highs and lows. They're still chugging away, but I haven't bothered with them since I got MySQL up and running. It's much easier to query the database if I want to know.

 

Not to mention that there's no issue with data surviving a reboot.

 

If you want anything to point you in the right direction, let me know. I've got min/max query structures and php code you can look at or use.

 

 

 

Sent from my iPad using Tapatalk

Link to comment

Not sure I'm reading this right... Are you trying to find out when min/max values occur for tracked variables?

 

If so, might I humbly suggest that such a task is better handled by a database than the ISY? Put all the data in a database, then just politely ask it what the max value for a given field is, and when that field was written to the database. This is how I have all my temperature information stored. I can query the database for a max over any time period. Or averages. Or between 6:00 pm and 8:00 pm. Or every Nth record.

 

When I first set up my 1-Wire system, I created a series of programs on my ISY to track daily, weekly, monthly, annual, and all time temperature highs and lows. They're still chugging away, but I haven't bothered with them since I got MySQL up and running. It's much easier to query the database if I want to know.

 

Not to mention that there's no issue with data surviving a reboot.

 

If you want anything to point you in the right direction, let me know. I've got min/max query structures and php code you can look at or use.

 

 

 

Sent from my iPad using Tapatalk

 

Hey Builderb,

 

What I am after is having the ability to receive daily custom e-mails that indicate the time stamp. In the above example you saw hi lighted in colors its the time and date which is important to me.

 

Every day I receive reports indicating the current, low, and high value(s).

 

Whether it be for temperature, watts, voltage, KWH, traffic, etc.

 

The problem is if the ISY Series Controller is rebooted or firmware upgraded the time stamp will be system boot up time. It will never be the previous time stamp.

 

As indicated above say in January 01, 2015 the low temp was -25'C at 12:00 PM. I want this date and time to survive the two conditions. If the temp should drop to -35'C and the time is 2:25 AM the system by default will have recorded this value. So, perhaps another way at asking the question is.

 

What method is there to maintain the time stamp until such time as a legitimate change of state has occurred?  

Link to comment

Hey Builderb,

 

What I am after is having the ability to receive daily custom e-mails that indicate the time stamp. In the above example you saw hi lighted in colors its the time and date which is important to me.

 

Every day I receive reports indicating the current, low, and high value(s).

 

Whether it be for temperature, watts, voltage, KWH, traffic, etc.

 

The problem is if the ISY Series Controller is rebooted or firmware upgraded the time stamp will be system boot up time. It will never be the previous time stamp.

 

As indicated above say in January 01, 2015 the low temp was -25'C at 12:00 PM. I want this date and time to survive the two conditions. If the temp should drop to -35'C and the time is 2:25 AM the system by default will have recorded this value. So, perhaps another way at asking the question is.

 

What method is there to maintain the time stamp until such time as a legitimate change of state has occurred?

On my Pi, I run a web server. Any time I load a particular web page, it runs a PHP script that queries my temperature database, and spits out the current readings of all sensors, and the min/max of a couple that I care about. They say things like "The 24 Hour Max Exterior Temp of 85.5° F occurred at 3:54 PM. The average interior temperature at that time was 76° F". If a new entry is made to the database with a greater value, the new time stamp is returned when you ask for the high.

 

What I have is still not pretty, but it's functional. A work in progress. But the beauty of it is that once you have all the data, you can ask anything. Want to know what the high temp was on alternate Tuesdays in July? Or what time ranges one sensor was lower than another today? Or which sensor has the highest average values? No problem.

 

Not to knock it, because I love my ISY but it just isn't built for data storage.

 

 

 

 

Sent from my iPad using Tapatalk

Link to comment

On my Pi, I run a web server. Any time I load a particular web page, it runs a PHP script that queries my temperature database, and spits out the current readings of all sensors, and the min/max of a couple that I care about. They say things like "The 24 Hour Max Exterior Temp of 85.5° F occurred at 3:54 PM. The average interior temperature at that time was 76° F". If a new entry is made to the database with a greater value, the new time stamp is returned when you ask for the high.

 

What I have is still not pretty, but it's functional. A work in progress. But the beauty of it is that once you have all the data, you can ask anything. Want to know what the high temp was on alternate Tuesdays in July? Or what time ranges one sensor was lower than another today? Or which sensor has the highest average values? No problem.

 

Not to knock it, because I love my ISY but it just isn't built for data storage.

 

 

 

 

Sent from my iPad using Tapatalk

 

No, agree you're correct its hard to ask the ISY Series Controller to do so many things. Yet ask for something that is so specific like my request for a time stamp that will survive a reboot / firmware upgrade.

 

I may take you up on your offer to deploy one of the RPi 2 at home to accomplish this task. The only reason I haven't gone this route is because four of them are currently tasked to other Alpha / Beta trials. For other companies I have been asked to test software / hardware for.

 

Maybe I can take one of the units out of rotation and see if I can follow your steps to get this up and running. The reality is this specific issue isn't that pressing or the end of the world. Its just something I have thought about for many years and hoped the smart people on this forum had a simple and quick fix.

 

If its not too much trouble and you wish to provide a step by step guide in this thread or a new one. Perhaps you solution will help more people than just me!

 

Ha . . .

 

I always find it funny that I will ask a question that no one else has and then all of the sudden there is this massive swarm of people doing the same???

 

Ironic or just coincidence? 

Link to comment

No, agree you're correct its hard to ask the ISY Series Controller to do so many things. Yet ask for something that is so specific like my request for a time stamp that will survive a reboot / firmware upgrade.

 

I may take you up on your offer to deploy one of the RPi 2 at home to accomplish this task. The only reason I haven't gone this route is because four of them are currently tasked to other Alpha / Beta trials. For other companies I have been asked to test software / hardware for.

 

Maybe I can take one of the units out of rotation and see if I can follow your steps to get this up and running. The reality is this specific issue isn't that pressing or the end of the world. Its just something I have thought about for many years and hoped the smart people on this forum had a simple and quick fix.

 

If its not too much trouble and you wish to provide a step by step guide in this thread or a new one. Perhaps you solution will help more people than just me!

 

Ha . . .

 

I always find it funny that I will ask a question that no one else has and then all of the sudden there is this massive swarm of people doing the same???

 

Ironic or just coincidence?

Happy to help. Here's my write up from a while back on how to set up MySQL on a Pi, and how to pass 1-Wire data to the database:

 

http://forum.universal-devices.com/topic/15273-wundergroundcom/?p=130307

 

That will give you an idea of how the database side of things works, basic queries, etc.

 

I'm sure we'll have to figure a way to get your sensor info into MySQL. I'm not familiar with the Autelis product, which I believe you use. Hopefully there's an easy way to do it.

 

You'll also need to install a LAMP (or LEMP) stack on your Pi before you can get started. But that's relatively easy, I just searched online for guidance.

 

If you get as far as getting your data into the database, I'll write up the web server and PHP side of this. Let me know if you get stuck anywhere along the way. I'm no expert, but hopefully I can be of assistance.

 

 

Sent from my iPad using Tapatalk

Link to comment

And let me know if you need a write up on the LAMP stack installation. I'm not sure what your comfort level is with the command line.

 

As it happens, I recently purchased a new micro SD card and put a fresh installation of Raspbian on it that I was planning to install a LAMP stack on soon for some testing purposes. I have been using nginx as a web server so far (making my installation a LEMP stack), but I want to try Apache too. It's a pretty simple process to install either, so it won't take much to write up.

 

 

Sent from my iPad using Tapatalk

Link to comment

Hey Builderb,

 

What I am after is having the ability to receive daily custom e-mails that indicate the time stamp. In the above example you saw hi lighted in colors its the time and date which is important to me.

 

Every day I receive reports indicating the current, low, and high value(s).

 

Whether it be for temperature, watts, voltage, KWH, traffic, etc.

 

The problem is if the ISY Series Controller is rebooted or firmware upgraded the time stamp will be system boot up time. It will never be the previous time stamp.

 

As indicated above say in January 01, 2015 the low temp was -25'C at 12:00 PM. I want this date and time to survive the two conditions. If the temp should drop to -35'C and the time is 2:25 AM the system by default will have recorded this value. So, perhaps another way at asking the question is.

 

What method is there to maintain the time stamp until such time as a legitimate change of state has occurred?  

 

The program I wrote above would do just that.  You would need to also have your variables do an "init" in the last line of the previous program so they survive a power outage and finally you would need to send the email with the max value at midnight followed by a set of the variables to current values so it can keep track of it for that day.

 

 

Add to end of then clause of above program

 

i$maxtemp init to $maxtemp

$maxtempstamp init to $maxtempstamp

 

If

time is midnight (or whatever time you want, realizing that you will get the max temp for the previous 24 hour period)

Then

notify . . . (have it send the value and the time stamp)

run then clause of program from previous post

 

So doing exactly what I just showed above would give you one  email per day at midnight that includes the highest value that the temp achieved for the previous 24 hours including a time and date stamp.  The date part of the time stamp is perhaps unnecessary since you will know the date from the email, but whatever.

 

Certainly posting the info to a database is a fine idea and would let you graph it and do all kinds of analysis.  But if all you want is the max or min value for the previous 24 hours, this is going to be easier then setting up a database and will require no additional hardware.

Link to comment

The program I wrote above would do just that.  You would need to also have your variables do an "init" in the last line of the previous program so they survive a power outage and finally you would need to send the email with the max value at midnight followed by a set of the variables to current values so it can keep track of it for that day.

 

 

Add to end of then clause of above program

 

i$maxtemp init to $maxtemp

$maxtempstamp init to $maxtempstamp

 

If

time is midnight (or whatever time you want, realizing that you will get the max temp for the previous 24 hour period)

Then

notify . . . (have it send the value and the time stamp)

run then clause of program from previous post

 

So doing exactly what I just showed above would give you one  email per day at midnight that includes the highest value that the temp achieved for the previous 24 hours including a time and date stamp.  The date part of the time stamp is perhaps unnecessary since you will know the date from the email, but whatever.

 

Certainly posting the info to a database is a fine idea and would let you graph it and do all kinds of analysis.  But if all you want is the max or min value for the previous 24 hours, this is going to be easier then setting up a database and will require no additional hardware.

 

My apologies if I have confused you all and not expressed myself clearly. I currently have the programs in place which track the *current, low, and high* values.

 

I am more interested in maintaining the last known time stamp for a low / high value. I don't believe any of the examples provided will offer this solution unless I am totally off base?

 

It wouldn't be the first time, ha!

 

As stated previously I receive many e-mails a day and depending upon the item being monitored these custom e-mails stream in 1-3 times a day. My requirement (wish) is to see a time stamp that never loses its last known date and time until such time as there is a actual change in state.

 

I don't believe any of these current programs will be able to insert a time stamp into a custom e-mail that accomplishes this task??

 

As above if the lowest value is -25 at 12:00 PM on January 01, 2015. <-- I want this time and date to be remembered unless there is an actual change of state. In its current form the ISY can only insert the current time and date which doesn't help me.

 

The reality is I have many other resources that already track, graph, chart these requirements. But, none of them can actually send me a piece of e-mail with a time stamp that indicates the history of such.

 

I am thinking such a request is more of a novelty then a requirement for most people here. But for me its something that would in my mind offer better insight and awareness.

 

In case if anyone is wondering how this problem came to light. About a year ago when I was hot and heavy in gluing all of these devices to operate with one another. I was asked to provide a screen shot of a few programs in action. As bad luck would have it all of the time stamps which clearly showed the lowest / highest temperatures in my environment which was accurate until system reboot!

 

Clearly, I could not show them when it was -48'C! during XXX day, time, etc. Because it showed the current time and date which was clearly in the summer time!

 

Anyways this is why this topic came to light because I said to myself there has to be a method to issue a custom e-mail and issue the last known date and time when this change of state is present.

 

But its clear to me at the moment there isn't . . .

Link to comment

OK, I guess you are saying that you want ISY to keep looking for the highest value of temp or whatever . .. forever.  Not in any given block of time, just since the date of inception of the program.  This is easier than above.  Get rid of the second program and only keep this one.

 

IF

$maxtemp is less than $currenttemp

and

trigger (if $currenttemp is a state variable then that will serve as your trigger every time it changes)

THEN

$maxtemp = $currenttemp

$maxtempstamp = [Year]  (this option is available in 5.0)

$maxtempstamp = $maxtempstamp * 100000000

$maxtempstampworkingvariable = [month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 1000000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

$maxtempstampworkingvariable = [day of month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 10000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

etc for hour and minute

$maxtemp init to $maxtemp

$maxtempstamp init to $maxtempstamp

 

 

just by adding the "init to" lines your value will not be lost during a reboot.

Link to comment

OK, I guess you are saying that you want ISY to keep looking for the highest value of temp or whatever . .. forever.  Not in any given block of time, just since the date of inception of the program.  This is easier than above.  Get rid of the second program and only keep this one.

 

IF

$maxtemp is less than $currenttemp

and

trigger (if $currenttemp is a state variable then that will serve as your trigger every time it changes)

THEN

$maxtemp = $currenttemp

$maxtempstamp = [Year]  (this option is available in 5.0)

$maxtempstamp = $maxtempstamp * 100000000

$maxtempstampworkingvariable = [month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 1000000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

$maxtempstampworkingvariable = [day of month]

$maxtempstampworkingvariable = $maxtempstampworkingvariable * 10000

$maxtempstamp = $maxtempstamp + $maxtempstampworkingvariable

etc for hour and minute

$maxtemp init to $maxtemp

$maxtempstamp init to $maxtempstamp

 

 

just by adding the "init to" lines your value will not be lost during a reboot.

 

I apologize for being dense but will the above code be something I can inject into a custom e-mail?

 

1. What options in the custom e-mail drop down selection will allow me to see on January 01, 2015 at 12:00 PM the temp was -25'C?

 

2. Should number 1 change on January 02, 2015, at 2:33 PM the temp is -45'C. Will this custom e-mail show the new time stamp? Keeping in mind I don't care about the temperature as its already being recorded and updated etc which does in fact survive a reboot / firmware upgrade.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...