Skip to content
ggodart edited this page Dec 31, 2020 · 1 revision

The complete list of global variables and their values can be found on the Widgets menu of the default web page or at the top of /bin/mh.

Time and Date variables

$Time_Startup, $Time_Startup_time, $Time_Now, $Date_Now, $Date_Now_Speakable, $Year_Month_Now
  $Time_Sunrise, $Time_Sunset, $Time_Sunrise_Twilight, $Time_Sunset_Twilight
  $Second, $Minute, $Hour, $Mday, $Wday, $Day, $Month, $Year, $Holiday
  $New_Msecond_100, $New_Msecond_250, $New_Msecond_500, $New_Second, $New_Minute,
  $New_Hour, $New_Day, $New_Month, $New_Year
  $Season, $Weekday, $Weekend, $Time_Of_Day, $Dark
  %Moon

The %Moon array has $Moon{phase}, $Moon{brightness}, $Moon{age}, and $Moon{new,first,full,last} entries.
The $Time_Now and $Date_Now variables return a formatted time and date.
$Dark is true between $Time_Sunset_Twilight and $Time_Sunrise_Twilight, false otherwise.
The $New_* variables are true only on the pass that we enter a new Second, Minute, Hour, etc. $New_Msecond_100/250 are true every .1 and .25 seconds. There are also new_* functions if you want to test on every nth second/minute/hour (see the new_second function).

Other Global variables

$Startup is true on the first pass after starting MisterHouse.
$Reload is true when the Reload(F1) is requested AND the code been reloaded because one or more code members have been changed.
$Reread is always true after Reload(F1), even if no code members have changed.
$Keyboard echoes characters typed on the keyboard (currently windows only)
%Save is a hash in which the values of variables can be saved so that they remain unchanged after MisterHouse is re-started. The values can be checked using the web widgets menu.
%Misc is a hash in which other miscellaneous data can be stored. These values can also be checked using the web widgets menu. This is a handy place to put data you might want to display in .shml web pages.

Constants

The following constants are defined, so we can use them without quoting them (e.g. if $state eq ON instead of if $state eq 'on'):

  ON      => 'on';
  OFF     => 'off';
  DIM     => 'dim';
  BRIGHTEN=> 'brighten';
  TOGGLE  => 'toggle';
  STATUS  => 'status';
  OPEN    => 'open';
  CLOSE   => 'close';
  OPENED  => 'opened';
  CLOSED  => 'closed';
  MOTION  => 'motion';
  STILL   => 'still';
Clone this wiki locally