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

This forum is for questions about Action Groups and Actions. If you're asking yourself "can Indigo do X" then this is may be the place to ask.
Jaymer
Posts: 6
Joined: Fri Jun 19, 2020 11:11 am

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

Post by Jaymer »

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 2809 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...
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

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

Post by matt (support) »

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
Jaymer
Posts: 6
Joined: Fri Jun 19, 2020 11:11 am

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

Post by Jaymer »

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 2764 times
User avatar
kw123
Posts: 8453
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

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

Post by kw123 »

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)
Jaymer
Posts: 6
Joined: Fri Jun 19, 2020 11:11 am

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

Post by Jaymer »

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...
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

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

Post by matt (support) »

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
Post Reply

Return to “Action Groups and Actions”