Author Topic: Behavior when iMAC goes to sleep or shuts down at night  (Read 5077 times)

smdcat

  • Calm
  • *
  • Posts: 9
    • KCAMORAG2
Behavior when iMAC goes to sleep or shuts down at night
« on: July 12, 2012, 06:20:23 PM »
My vantage pro 2 console has the weather link IP module connected to my local network.  I am using weathercat to collect and display the data.  No data is being sent to the Davis weatherlink site.  When my iMAC goes to sleep or does a scheduled night time shut down erroneous results are recorded.  The data base shows 1 minute sample rate (it is set to 5 minutes in weathercat) and a constant set of values for each parameter for each record.  Is this the expected behavior?  I had assumed that either no data would be recorded or weathercat would retrieve the missing time records from the weatherlink IP memory in the console when weathercat was restarted.
I am also sending data to wunderground and these erroneous records are being sent when weathercat restarts.
I am aware the weathercat is designed to run 24/7 but I am trying to save a little electricity when I can

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2911
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #1 on: July 12, 2012, 07:52:08 PM »
Hi smdcat, welcome to the forum!

Normally we recommend quitting WeatherCat before sleeping the machine (sometimes USB drivers have trouble waking up quickly enough), but it should be fine with WLIP.

What should happen is when your machine wakes up, WeatherCat will perform a historical download and update the data. As this isn't happening, we need to investigate that historical downloads are OK.

Try this simple test - quit WeatherCat, wait an hour then boot it back up again. It should then perform a historical download and fill in the missing hour with data from the logger. If it doesn't perform a historical download, or tries a couple of times then gives up, it suggests the logger isn't responding. If it does perform a historical download, but you get a straight line, check the date and time on your console exactly matches that of your Mac. If it works fine, then the problem may be the connection isn't being made to your logger quickly enough when your Mac wakes .

Let us know how you get on.

smdcat

  • Calm
  • *
  • Posts: 9
    • KCAMORAG2
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #2 on: July 13, 2012, 08:59:39 PM »
Clocks were off.  Resynced at midnight.  Now the behavior is as follows.  If weathercat is shut down manually, database is filled with historical data sampled at 1 minute.  Weather underground is updated historically at 5 minute intervals.  If the mac is shut down  either manually of via a clocked automatic shut down  without shutting down weathercat, no historical updates are done and only a  time gap appears in the log and a gap also appears in the weather underground data.

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #3 on: July 13, 2012, 09:50:34 PM »
Hi smcat
 you can used ical and one of Edouards stop scripts to shut down WeatherCat right before you use the auto shut down that's what I do then in the login prefs I have WeatherCat as a login startup item
Works great for me but I only have mine shut down for 1 minute but it will work for you also
Hope this helps
 [cheers1]

smdcat

  • Calm
  • *
  • Posts: 9
    • KCAMORAG2
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #4 on: July 13, 2012, 11:32:15 PM »
In principle this seems like exactly what I need for a nighttime shut down. I think you are saying to use an alarm in ical scheduled every day just before the mac scheduled shut down.  But I am not sure  where to put the shut down script.  Can you send more details on your setup.  New to macs in general after years of fooling with Bill Gates

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #5 on: July 14, 2012, 01:16:15 AM »
Hi smdcat
 yes I have it set as an utility application in iCal an set to run 1 minute before the shut of my imac i5
 the script that i used it is the first one that Edouard came out with and it quits WC also the second one he came out with doesn't quit WC

 But here is just a AppleScript that just quits WeatherCat
see attached



hope this helps
 [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Why put your Mac to sleep? (Re: Behavior when iMAC)
« Reply #6 on: July 14, 2012, 03:03:17 AM »
Hi smdcat, Randall, and WeatherCat fans,  [cat]

In principle this seems like exactly what I need for a nighttime shut down. I think you are saying to use an alarm in ical scheduled every day just before the mac scheduled shut down.  But I am not sure  where to put the shut down script.  Can you send more details on your setup.  New to macs in general after years of fooling with Bill Gates

Randall is correct, you can use Automator to automate things like putting your computer to sleep, shutting it down and so on.

There are also other ways to do the same thing.

However, before getting into this, perhaps we need to ask the question: exactly why are you trying to do at night with your Mac?  Is this an energy saving strategy, to stop the noise of your Mac at night, or what?

I'm guessing that you weren't shutting down your Mac automatically thus far.  So it would help us to understand why you are doing this in order to suggest the best "mousetrap" for your needs.

Cheers, Edouard  [cheers1]

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #7 on: July 14, 2012, 12:33:57 PM »
Hi smdcat,Edpuard
 First I'm not using Automator it screws things up I am using the the WeatherCat Quit Applescript I attached on my last post here(also use your Stop AppleScript in the advanced prefs on WeatherCat to run your script) then I use iCal to to launch it at a giving time 1 minute before I have my computer in the Energy Savings prefs to just  restart up the computer


But for smdcat I believe he is putting his computer to sleep at night and some times shutting it down to save money on his electric bill


I do it because my computer acts better and have better luck with WeatherCat


hope this is what smdcat is needing for his needs


 [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Can also use CronniX (Re: Behavior when iMAC goes to sleep)
« Reply #8 on: July 14, 2012, 06:29:53 PM »
Hi Randall, smdcat, and WeatherCat fans,

Sorry Randall if it seemed like I was throwing a curve ball there.

I had two concerns in the back of my head there.

While saving energy is important, there are reasons to run your weather station software 24/7.  There is only 1 data upload service that can take historical uploads, so if you want to share your data with science and the public - it is worth thinking about leaving your computer running.  Also if you don't run your weather software 24/7 some of my AppleScripts won't work properly.  WC Storm Monitor and WC ET Reporter need to be running essentially all the time.

All this may or may not be important to smdcat, but it is always prudent to mention such things so people have the whole picture.

My other thought was simply another way to schedule things.  I find using iCal to schedule automatic events on my computer a bit inconvenient.  An alternative is to use the free utility CronniX.  This too may not appeal to smdcat, but it is always better to have more choices than fewer!

So sorry if that muddies the waters, but for your information. . . . .

Cheers, Edouard  [cheers1]

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #9 on: July 14, 2012, 08:15:40 PM »
Hi Edouard
 No I just don't like using Automator and I have never used CronniX just trying to give the simplest solution I know that works for me Automator leaves the progress window on the screen and the only to get rid if it is manually closed iCal is simple to use when using the prefs energy savings sleep or restart
 [cheers1]

smdcat

  • Calm
  • *
  • Posts: 9
    • KCAMORAG2
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #10 on: July 15, 2012, 12:29:39 AM »
All,
Thanks for the suggestions.  My main objective in trying to do night time shut downs is to save energy and also to cut costs.  I have been doing little things like this (and some things like pump replacement for  our pool) for several years and have trimmed my bill by about $1000/year (more than enough for a new iMac every other year)  I live in California and electricity costs more that 32 cents /KWhr.  My iMac according to apple is 35 watts at idle vs about 1.5 watts at sleep.  8hrs off is thus about $35/yr.  Not much but  little things like that add up.  Plus its the right thing to do for the planet

Right now I plan to only upload to underground.  But I do want a continuous set of records of my own I if can get it.
I have been doing these shut downs on windows for about 5 years using the trashy Weatherlink software.  I am just trying to do some thing similar  as I transition my computers to Macs. 

Have tried to execute the quit weather cat script via ical but I don't seem to have it right.  Can seem to get ical alarm to point to the script.
Off on vacation tomorrow  so I will have wait awhile to try again.
Thanks for your help to this point

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Have a nice vacation!! (Re: Behavior when iMAC goes to sleep)
« Reply #11 on: July 15, 2012, 03:18:28 AM »
Dear smdcat and WeatherCat fans,

Have tried to execute the quit weather cat script via ical but I don't seem to have it right.  Can seem to get ical alarm to point to the script.
Off on vacation tomorrow  so I will have wait awhile to try again.

Well have a nice vacation!!  [cheer]

Let us know when you are back in town and we'll help you get WeatherCat to shutdown before your sleep command.  There is more than one way to "skin a cat" as the saying goes . . . . .  ;D

Cheers, Edouard  [cheers1]

P.S.  [cat] Did I say something wrong?  [lol]

smdcat

  • Calm
  • *
  • Posts: 9
    • KCAMORAG2
Re: Behavior when iMAC goes to sleep or shuts down at night
« Reply #12 on: August 04, 2012, 10:52:12 PM »
I am back from vacation and have been playing with this for a few days.  I see now how to use ical to invoke scripts but it turns out that it isn't quite what I needed.  I am using energy saver features which trigger a sleep after inactivity.  It appears from my testing that weather cat will not property restore missing events from the weather link IP device after waking up from sleep (returns the same entry regardless of time).  Based on comments above and my experience weathercat must be shut down before sleep.  What I needed then was something to shut down weather cat on a sleep event and restart it after the wake.  This appears not to be possible using  an applescript but based on google there are several ways to do this using shell scripts and other applications (Power manager).  I chose to use the Scenario  app by lagente.($5).  This has a user interface and allows execution of applescripts at shutdown, startup, sleep, wake and idle.  It appears not to work well on sleep triggered by pushing the power button or via the pull down apple menu.  It does work for scheduled events via ical or energy saver and sleep/awake triggered by the inactivity parameters in energy  saver.  This app with the appropriate scripts seems to meet most of my needs.

In fooling with this I decided to schedule a restart just before midnight to pick up the time sync at 12:15.  Unfortunately this triggers the apple startup sound in the bedroom where I have my iMac.  I got around this by using a free app called MuteCon which mutes prior to a restart and un mutes after automatically.  Documentation for this one is in Japanese on its web page but it is figure-outable.

I still have the problem that upon restart weather cat fills the data base with samples from the weatherlink IP module at 1 minute intervals even those the IP samples only at 5 minute intervals