Items Weather_Item - hollie/misterhouse GitHub Wiki
Weather_Item
See original
SYNOPSIS
  $WindSpeed = new Weather_Item 'WindSpeed';
  $WindSpeed-> tie_event('print_log "Wind speed is now at $state"');
  $freezing = new Weather_Item 'TempOutdoor < 32';
  if (state_now $fountain eq ON and state $freezing) {
    speak "Sorry fountains don't work too well when frozen";
    set $fountain OFF
  }
  $Windy = new Weather_Item 'WindSpeed > 15';
  speak "Wind is gusting at $Weather{WindSpeed} mph" if state $Windy;
  # For current state, easiest to use it directly
  speak "Outdoor temperature is $Weather{TempOutdoor} degrees";
DESCRIPTION
INHERITS
INI PARAMETERS
METHODS
| Method | Description | 
|---|---|
new($type) | 
$type is the name of the %Weather index you want to monitor. $type can also have a =<> comparison operator in it so you can make the object a true/false test. | 
state | 
Returns the last state, or 1/0 if $comparision and $limit were used. | 
INHERITED METHODS
| Method | Description | 
|---|---|
state_now | 
Returns the state only when the weather data changed. | 
AUTHOR
SEE ALSO
For examples on interface code that stores data into %Weather, see mh/code/bruce/weather_monitor.pl (uses mh/lib/Weather_wx200.pm), mh/code/public/iButton_ws_client.pl, and mh/code/public/weather_com.pl