Cynics at Large Indigo: Cynical Weather

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


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.


Orientation Device

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

Orientation provides the following states:

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

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

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

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

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 Daily 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 as desired.

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

Release Notes

About This Area 20 Dec 2022 10:16