How to output to logfile - and write to OS automatically?

Posted on
Tue Jun 23, 2020 12:46 pm
Jaymer offline
Posts: 6
Joined: Jun 19, 2020

How to output to logfile - and write to OS automatically?

Am having some temp problems with my AC (I think).
So I have an every-5-minute trigger that queries my Thermostat.
Sets some variables and writes to the Log.

1) I see a log window, but other than copy/paste, How do I save that log?
Screen Shot 2020-06-23 at 2.42.20 PM.png
Screen Shot 2020-06-23 at 2.42.20 PM.png (154.75 KiB) Viewed 2394 times


2) I only need to prepare a log 1 time for documenting this to the rental company, and I'll just use some pattern matching to get the timestamp & 1 line of data that I need.
But is there a better way to do this... like ANOTHER log? ... or an explicit "write to file"?
Or a way to format only 1 line of output "timestamp. [my message with the variables here]"
and not the other Log stuff?

I'm sure I'm missing something, but searching on this forum is hard.
thx
jaymer...

Posted on
Tue Jun 23, 2020 12:57 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: How to output to logfile - and write to OS automatically

Everything in the Event Log window is written to daily log files as well. Press the Show Event Logs Folder at the top of the window to see the files. You could use a script to write it out, formatted however you want, to another file. But if you can just use pattern matching/grep or something to get what you want that would probably be easiest.

Image

Posted on
Wed Jun 24, 2020 8:05 am
Jaymer offline
Posts: 6
Joined: Jun 19, 2020

Re: How to output to logfile - and write to OS automatically

1. Thanks for the tip - never knew those logs were there - hadn't clicked on that button to open the window :)
2. That was easier than I thought - the logs are "proper" so each line has a timestamp - which is what I would expect but not what I expected because I thought the daily log would look exactly as the on-screen Event Log. But a simple grep gave me the lines i wanted and some text replacement gave me columns to import into a spreadsheet for a chart.

Very nice and easy, although I'm sure y'all have a better way to do this knowing the desired final product (the chart).
Moved into a new place and my coils are extremely dirty, hence the poor performance.

4A910555-44A8-4CB3-B270-6682B7FA57B0_1_201_a.jpeg
4A910555-44A8-4CB3-B270-6682B7FA57B0_1_201_a.jpeg (179.19 KiB) Viewed 2349 times

Posted on
Wed Jun 24, 2020 2:21 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: How to output to logfile - and write to OS automatically

you can simply query the SQL database and it will give you all entries for the sensors / switches..

the utilities plugin has a menu item to do that. It will also list the sql file, so that you can run it manually

Karl
Code: Select all
   utilities                       print SQL data for device 768183209/ThermostatUpstairs states: [u'temperatureInput1', u'hvacCoolerIsOn', '', '', '', '', '', '', '', '', '', '', '', '', '']
   SQL command=                    /Applications/Postgres.app/Contents/Versions/latest/bin/psql indigo_history -U postgres  -c  "SELECT id, to_char(ts,'YYYY-mm-dd-HH24:MI:ss') as ts,temperatureInput1,hvacCoolerIsOn from device_history_768183209 WHERE temperatureInput1 IS NOT NULL  ORDER by id  LIMIT 20 OFFSET (SELECT COUNT(*) FROM device_history_768183209 WHERE temperatureInput1 IS NOT NULL )-20;"
   SQL-OUTPUT:                     
  id   |         ts          | temperatureinput1 | hvaccoolerison
-------+---------------------+-------------------+----------------
 43826 | 2020-06-24-13:18:49 |                22 |
 43829 | 2020-06-24-13:23:54 |                23 |
 43832 | 2020-06-24-13:31:02 |                22 |
 43835 | 2020-06-24-13:36:07 |                23 |
 43838 | 2020-06-24-13:42:13 |                22 |
 43841 | 2020-06-24-13:47:19 |                23 |
 43844 | 2020-06-24-13:54:26 |                22 |
 43846 | 2020-06-24-13:58:30 |                23 |
 43848 | 2020-06-24-14:05:38 |                22 |
 43851 | 2020-06-24-14:10:43 |                23 |
 43854 | 2020-06-24-14:19:52 |                22 |
 43857 | 2020-06-24-14:24:58 |                23 |
 43860 | 2020-06-24-14:31:04 |                22 |
 43863 | 2020-06-24-14:36:09 |                23 |
 43866 | 2020-06-24-14:45:19 |                22 |
 43868 | 2020-06-24-14:49:23 |                23 |
 43870 | 2020-06-24-14:56:30 |                22 |
 43872 | 2020-06-24-15:00:35 |                23 |
 43874 | 2020-06-24-15:11:46 |                22 |
 43876 | 2020-06-24-15:15:50 |                23 |
(20 rows)

Posted on
Thu Jun 25, 2020 8:35 pm
Jaymer offline
Posts: 6
Joined: Jun 19, 2020

Re: How to output to logfile - and write to OS automatically

thanks Karl - I'm playing with "sqlite3" - will be fun

I noticed something tonight. I rarely sleep my laptop but did today and noticed this in the log:
Jun 25, 2020 at 5:46:23 PM
Received sleep notification from system

Jun 25, 2020 at 10:24:05 PM
Received awake notification from system
Schedule Query AC Temp
Action Collection Set: 77.0 Actual: 78.0
Z-Wave sent "012 - Thermostat (GC-TBZ48)" temperature status request
Z-Wave received "012 - Thermostat (GC-TBZ48)" temperature update to 76 °F
Trigger EntryRoomMotion
Action Collection


So I lost 5 hours of logs.

1) How do I prevent this?
I keep my macbook closed and have a large external monitor.
Today, I manually turned the monitor off and I guess that put it to sleep (or the power outage during a storm combined with the monitor off).

2) During this "sleep" time, was Indigo basically turned off? Or does it still hear z-wave msgs?

thx
jaymer...

Posted on
Fri Jun 26, 2020 2:42 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: How to output to logfile - and write to OS automatically

Check your Mac's sleep settings to make sure it isn't going to sleep. The display going to sleep is fine, but if the Mac itself goes to sleep Indigo does no processing.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests