Cynical Weather Plugin
This plugin provides weather- and environment-related functions. It does not require any hardware to operate, relying instead on web services and good old trigonometry. The idea is to help you manage your house by knowing more about its external environment. In particular, Cynical Weather provides
- Sun tracking and orientation;
- Dark Sky hyperlocal weather data.
To track the sun, create one or more Orientation devices that represent windows or other openings in your house. Then use scripts or triggers to observe the angle of the Sun and act accordingly.
To use Dark Sky weather data, obtain an API key and enter it into the plugin settings. Then create a Location device for your location and use scripts and triggers on the state of that device. To obtain forecasts, create a Location device first, then add Daily Forecast and Hourly Forecast devices for the desired time.
Orientation devices know nothing about the weather. They will still tell you where the Sun is even if it is hidden behind clouds or the moon. By themselves, orientations are conditional indicators: if the sky is clear, this is where the outside light is coming from.
If you have an iPhone, an easy way to establish the Facing value for an orientation is to use the built-in Compass App. Hold the phone horizontally with the top edge up against the window or adjacent wall, and read off the indicated angle. (Be careful not to push the off button while you do that.)
Orientation provides the following states:
The height is the angle from the horizon to the Sun. At sunset or sunrise, it is zero. At noon, it is highest (how high depends on the season and your location). After sunset, the height becomes negative, though also somewhat irrelevant since the Earth is between you and the Sun. Note that if the height is near 90, azimuth becomes somewhat meaningless, since the Sun is almost straight above you.
The index combines azimuth and height into a bounded value that's useful for responding to sunlight. It is zero if the Sun is essentially "elsewhere"; it is 100 when the Sun is substantially shining straight at you; and it varies between 0 and 100 as the Sun moves between. This is not a geometric measurement; it is meant to help you create simple triggers ("when the index is above 70, close the drapes") and will require some experimentation.
To use Dark Sky data, you need to obtain an API key of your own. This is free and is used to identify you (as opposed to me) as a user of their service. Enter the API key into the plugin settings. Keep it to yourself and let your friends get their own.
The Units setting is passed straight through to Dark Sky and determines what units your weather data will use. The default "automatic" value will pick appropriate units based on your location.
Leave the Latitude and Longitude fields blank to use Indigo's idea of your location. Fill it out if you want weather for elsewhere. Note that this needs to be fractional degrees, not using minutes and seconds.
The Report raw JSON data checkbox asks that a special "data" state be filled in with the entire response received from Dark Sky. This is a JSON dictionary as documented by the Dark Sky developer pages. It might be useful if you want to extract data that Cynical Weather does not directly expose as detailed state.
Keep in mind that each device update (as set by Refresh Interval) connects to the Internet and downloads a few kilobytes of data. If you pay for your Internet connection by the byte, you may want to lengthen the refresh interval, disable the device when you do not need up-to-date weather, or disable automatic refresh altogether and set your own schedule to execute Update Data actions as needed.
Note that these values are from computer models of your location. They do not take account of your particular local environment. For example, if you have a concrete pad around your house, you will find that your measured air temperature is significantly higher than the open field environment used by the model. On the other hand, you don't need to buy and maintain a weather station for this.
Hourly Forecast Device
The device states are pretty much the same as those of a Location.
Daily Forecast Device
The device states are similar to those of the underlying Location device. However, instead of temperature, it offers minimum and maximum temperature values. Also note that daily forecast values are variously either sums, extrema, or averages. Consult the Dark Sky documentation for details as needed.
Update Data Action
Tells a Location device to update itself immediately. This is useful if you need latest data now. It can also be used to explicitly control the schedule of updates by clearing the Refresh Interval setting of locations and executing updates as desired.
Updating a Location also automatically updates all forecast devices based on it.