Is a Custom Event Log Possible ?

Posted on
Thu Nov 24, 2022 8:20 am
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

Is a Custom Event Log Possible ?

Imagine I gave a particular event of interest, and I would like to have a daily log of all the times that particular event occurred. For example, what f You wanted to see a record of when my doors were locked/unlocked? Or when motion was detected in any of my “secure” zones?

I realize that I can find that info in the event log, but sifting through all those events is super tedious. Is there a plug-in, or maybe a bit of Python script that I could implement to manually (and separately) log particular events of high interest?

Posted on
Thu Nov 24, 2022 10:19 am
Dual offline
Posts: 257
Joined: Feb 05, 2019

Re: Is a Custom Event Log Possible ?

I use Python to log each time my irrigation water meter increments by 10 GPH. Partial contents of resulting text file:

Date, Time, Gallons
2021-03-29, 02:03:24, 520
2021-03-29, 02:06:50, 530
2021-03-29, 02:10:16, 540
2021-03-29, 02:13:42, 550
2021-03-29, 02:17:08, 560
2021-03-29, 02:20:33, 570

My code:

Code: Select all
# write irrigation log
# indigo.variables[1062132435] # "IrrigationGallonsVariable"

import datetime
now = datetime.datetime.now()
timeVar = now.strftime("%Y-%m-%d, %H:%M:%S")
gallonsVar = str(indigo.variables[1062132435].value)
irrigationLogFile=open('/Users/cavedale/Desktop/IrrigationLog.txt', 'a')
irrigationLogFile.write(timeVar)
irrigationLogFile.write(', ')
irrigationLogFile.write(gallonsVar)
irrigationLogFile.write('\n')
irrigationLogFile.close()



Sent from my iPhone using Tapatalk

Posted on
Thu Nov 24, 2022 10:25 am
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

Re: Is a Custom Event Log Possible ?

This looks perfect - thank you !

Posted on
Thu Nov 24, 2022 10:50 am
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Is a Custom Event Log Possible ?

I do something similar across a number of different logs and scripts. I save mine with a *.csv extension, but that's pure personal preference. I save these files on a NAS drive thusly:

Code: Select all
2022
  |__11
    |__24
      |__foo.csv
      |__bar.csv
so that each day's logs are in a distinct folder.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron