Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
indigo_2023.2_documentation:plugins:noaaweather [2024/06/26 20:28] – [Scripting Support] davel17indigo_2023.2_documentation:plugins:noaaweather [2025/04/14 20:10] (current) – external edit 127.0.0.1
Line 13: Line 13:
   * Degrees C   * Degrees C
   * Degrees F (Degrees C)   * Degrees F (Degrees C)
-  * Degrees C (Degrees F) +  * Degrees C (Degrees F)
  
 The second setting in the dialog allows you to turn on extra debugging information in the Event Log. Unless you're trying to debug a problem it's probably best to leave that unchecked. The second setting in the dialog allows you to turn on extra debugging information in the Event Log. Unless you're trying to debug a problem it's probably best to leave that unchecked.
Line 25: Line 25:
 ==== Creating Weather Forecast, Current Conditions, and Weather Alerts Devices ==== ==== Creating Weather Forecast, Current Conditions, and Weather Alerts Devices ====
  
-There are three additional weather device types that can provide additional weather data -- Alerts, Conditions, and Forecast data.  These devices are based on more precise location information -- your lat/long coordinates (or any valid coordinates you provide) -- rather than being linked to a weather station (which may not be near by. The creation and configuration of these devices is very straightforward.+There are three additional weather device types that can provide additional weather data -- Alerts, Conditions, and Forecast data.  These devices are based on more precise location information -- your lat/long coordinates (or any valid coordinates you provide) -- rather than being linked to a weather station (which may not be nearby. The creation and configuration of these devices is very straightforward.
  
 The current conditions device is meant to mimic the original weather station device as closely as possible. Linking your logic to these new device types should work, but if you decide to transition to these new device types, you should confirm they are working the way you expect. The current conditions device is meant to mimic the original weather station device as closely as possible. Linking your logic to these new device types should work, but if you decide to transition to these new device types, you should confirm they are working the way you expect.
Line 33: Line 33:
 You can trigger off of various state changes on a Weather Station (or Current Conditions Device) - like when the temperature or wind direction change. Some of these states don't make for good triggers but will provide some nice information on a control page. You can trigger off of various state changes on a Weather Station (or Current Conditions Device) - like when the temperature or wind direction change. Some of these states don't make for good triggers but will provide some nice information on a control page.
  
-{{:plugins:noaatriggerstates.png|}}+{{:plugins:noaatriggerstates.png?nolink|NOAA Trigger States Image}}
  
 Weather Station device types provide you with several device states that you can use in the Trigger dialog: Weather Station device types provide you with several device states that you can use in the Trigger dialog:
Line 75: Line 75:
  
     {"temperature": "V", "dewpoint": "V", "windDirection": "Z", "windSpeed": "Z", "windGust": "S", "barometricPressure": "V", "seaLevelPressure": "V", "visibility": "C", "precipitationLastHour": "C", "precipitationLast3Hours": "Z", "precipitationLast6Hours": "Z", "relativeHumidity": "V", "windChill": "V", "heatIndex": "V"}     {"temperature": "V", "dewpoint": "V", "windDirection": "Z", "windSpeed": "Z", "windGust": "S", "barometricPressure": "V", "seaLevelPressure": "V", "visibility": "C", "precipitationLastHour": "C", "precipitationLast3Hours": "Z", "precipitationLast6Hours": "Z", "relativeHumidity": "V", "windChill": "V", "heatIndex": "V"}
-    +
 The various codes are as follows: The various codes are as follows:
  
Line 94: Line 94:
 This information will give you some additional granularity with respect to how much you can trust the data.  Accessing this data using a script is pretty straightforward. This information will give you some additional granularity with respect to how much you can trust the data.  Accessing this data using a script is pretty straightforward.
  
-    import json  +    import json 
-    +
     dev = indigo.devices[12345678]     dev = indigo.devices[12345678]
     codes = dev.states['qualityCodes']     codes = dev.states['qualityCodes']
     quality_codes = json.loads(codes)     quality_codes = json.loads(codes)
     temp_quality = quality_codes['temperature']     temp_quality = quality_codes['temperature']
-    +
     if temp_quality in ("X", "Q"):     if temp_quality in ("X", "Q"):
         indigo.server.log("don't trust")         indigo.server.log("don't trust")
     else:     else:
         indigo.server.log("trust")         indigo.server.log("trust")
-    +
 ===== Weather Icons ===== ===== Weather Icons =====
  
 +=== Weather Station and Current Condition Devices ===
 +You can link to the current condition icons in the "traditional" way. On a control page, select **Display Device State** and **Current Condition Icon**. Then select **As Image** and choose **NOAA Condition+.png**. This should work for both the Weather Station and Current Condition device types.
 +
 +=== Forecast Devices ===
 +For Forecast icons, the reference is a bit different. NOAA provides a detailed description of the icon like, ''/icons/land/day/tsra,30?size=medium''. The way to display these images is to link to them directly via the NOAA API itself. Select Display Refreshing Image URL, set the icon size you want (medium is 86x86) and then in the URL field, enter a URL which is a combination of text and a device state substitution. The text part is ''https://api.weather.gov'' and then append the substitution string for the state you want like ''%%d:123456789:icon_01%%''. So the full URL would be:
 +
 +''https://api.weather.gov%%d:123456789:icon_01%%''
 +
 +(replacing 123456789 with your device ID and then the icon you want like icon_01, icon_02, etc.
 +
 +You can also construct refreshing image URLs for the current conditions icons, but the construction is a little different. The full URL for those would be something like, ''https://api.weather.gov/icons/land/day/%%d:123456789:currentConditionIcon%%''.
 +
 +If you want to have both day and night versions, you'd need to create a variable value that is equal to ''day'' when Indigo's ''isDaylight'' variable is true and equal to ''night'' when ''isDaylight'' is false. Then add a variable substitution for that part of the URL, like:
 +
 +''https://api.weather.gov/icons/land/%%v:12345678%%/%%d:123456789:currentConditionIcon%%''.
 +
 +For all these URLs, there's no need to refresh the images more than once every half hour or so because the NOAA plugin weather devices don't update more frequently than that on their own.
  
 ===== Scripting Support ===== ===== Scripting Support =====
  • /www/perceptive/wiki/data/attic/indigo_2023.2_documentation/plugins/noaaweather.1719433729.txt.gz
  • Last modified: 2024/06/27 00:08
  • (external edit)