Cynical Weather

Cynical Weather #

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

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.

Devices #

Orientation Device #

To use Visual Crossing weather data, sign up 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.

Configuration Settings #

Setting Value Description
Facing number The angle from True North when looking out your window.

An orientation device represents a direction for looking out of your house. States of the device tell you the direction of the Sun relative to that orientation - whether the Sun is to the left or right, and how high it is in the sky.

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.)

An Orientation device provides the following states:

State Meaning
azimuth The horizontal angle (left/right) to the Sun." %}}
height The vertical angle (up/down) to the Sun." %}}
index A composite value indicating how straight the Sun shines on you." %}}

The azimuth is the left-right angle to the Sun if you’re facing in the device’s given orientation. Zero means the Sun is straight ahead; -90 is to your left, +90 to your right. (Values greater than 90 mean the Sun is behind you.) The azimuth does not indicate how high the Sun is in the sky.

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 sign up 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.

Configuration Settings #

Setting Value Description
Refresh Interval number Minutes between updates to weather data. Clear to disable automatic refresh.
Units enum What measurement units to use.
Latitude number The geographic latitude in fractional degrees. Leave blank for Indigo’s location.
Longitude number The geographic longitude in fractional degrees. Leave blank for Indigo’s location.
Report raw JSON data checkbox Whether to fill the ‘data’ state with the raw data received.

The Refresh Interval lets you decide how often your weather data is updated. Visual Crossing only allows a limited number of updates each day for any API key, so setting this to much shorter than the default may not last you the day. If you have many Location devices, you may have to make that longer to stay on budget. Alternatively, you can give Visual Crossing your credit card and they will let you use as much weather data as you want, for a (small) fee.

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.

Device States #

State Value Description
alert string Any weather alerts currently in effect. Blank of none.
alert_url url string If a weather alert is in effect, a URL to more details.
cloudcover number An estimate of cloud cover in percent.
data json string Raw JSON weather data. Only set if the Report raw JSON data checkbox is set.
dew number The dewpoint temperature.
humidity number Relative humidity in percent.
icon string An icon name for the general weather. Useful to translate into icons or pictures in control pages etc.
pressure number Atmospheric pressure at sea level (not at location elevation).
state enum The state of the device itself. Not a weather indicator.
conditions string A textual summary of weather conditions.
temp number The temperature.
feelslike number The temperature, adjusted by wind and humidity to approximate human perception thereof.
winddir number The bearing on the wind, in degrees.
windgust number Momentary maximum wind speed.
windspeed number The speed of the wind.

You can consult the Visual Crossing developer documentation for more details on these values and many more.

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 #

This device represents a forecast for a previously created Location. Forecasts are from the Visual Crossing service.

Configuration Settings #

Setting Value Description
Location device The Location device for which you want a forecast.
Hours number How many hours to cast ahead.

A zero-hour forecast describes conditions for the current hour - the one that has already begun. A one-hour forecast describes the next hour - the one that will begin at the next full hour. Visual Crossing typically offers at least 24 hours of hourly forecasts.

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 forecast devices as you like, without increasing your daily request quota.

Daily Forecast Device #

This device represents a forecast for a previously created Location. Forecasts are from the Visual Crossing service.

Configuration Settings #

Setting Value Description
Location device The Location device for which you want a forecast.
Days number How many days to cast ahead.

A zero-day forecast describes conditions for the current day - the one that has already begun. A one-day forecast describes the next day - the one that will begin at midnight. Visual Crossing typically offers at least 7 days of daily forecasts.

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 forecast devices as you like, without increasing your daily request quota.

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 when desired.

Updating a Location also automatically updates all forecast devices based on it.

Notes #

Release Notes #

Notable releases:

Release Notes
3.5.0 First version supporting Visual Crossing instead of Dark Sky.
3.1.0 Python 3 conversion.
1.3.0 Upgrade TLS version to keep Dark Sky happy, for now.
1.2.1 Turn off HTTP compression because the forecast.io servers just broke that, somehow.
1.2.0 Released under Apache 2.0 license.
1.1.2 Support for Indigo 7.
1.1.0 Forecast.io has been renamed to Dark Sky.
0.9.2 Adds Hourly and Daily Forecast devices.
0.9.0 First beta release.