Cynical Weather Plugin
Download Cynical Weather (Release Notes)
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;
- Visual Crossing hyperlocal weather data.
Overview
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 Visual Crossing 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 times.
Devices
Orientation Device
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.
Location Device
A Location device represents a geographic location on Earth. Its device state reports current local weather data from the Visual Crossing service.
To use Visual Crossing 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 Visual Crossing and determines what units your weather data will use. The default "us" value will get you miles and inches, but note that some measurements still use SI units.
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 Visual Crossing. This is a JSON dictionary as documented by the Visual Crossing 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 hundred 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
A Hourly Forecast device represents a forecast for a previously created Location. Forecasts are from the Visual Crossing service.
The device states are pretty much the same as those of a Location.
Forecasts are downloaded along with Location data. You may have as many Hourly Forecast devices as you like, without increasing your daily request quota.
Daily Forecast Device
A Daily Forecast device represents a forecast for a previously created Location. Forecasts are from the Visual Crossing service.
The device states are similar to those of the underlying Location device. The temperature given is a daily average; the tempmin and tempmax states predict the daily low and high values. Also note that daily forecast values are variously either sums, extrema, or averages. Consult the Visual Crossing documentation for details as needed.
Forecasts are downloaded along with Location data. You may have as many Daily Forecast devices as you like, without increasing your daily request quota.
Actions
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.
Release Notes