[OBSOLETE] ColorCast - Color Changing Weather Lamp

This app is based on the Color Changing Smart Weather lamp by Jim Kohlenberger (@jkohlen).


ColorCast is a weather app that displays the forecast with colors using your Hue or LIFX lights. You can specify which types of wether conditions to display and assign specific colors to let you know when it’s going to rain, snow, sleet, when it’s going to be cloudy, windy, cold, hot and/or humid. You can define the parameters for each weather type and ColorCast will let you know if any of those conditions will occur during the forecast period. ColorCast will also flash the lights if you choose to be notified of weather alerts. You can choose the forecast range so you can be notified of the current conditions or, if you’re heading out to work in the morning, the forecast for the next 8 hours, or any number of hours up to the next 24. You’ll know at a glance if you should bring a sweater, an umbrella, etc. You just need a free api key from forecast.io (https://developer.forecast.io/)

Features

  • Choose which colors you want to use for each weather event or disable any unwanted weather events.
  • Specify the “cold” temperature(actual or apparent), the “hot” temperature(actual or apparent), the wind speed, the cloud cover %, the humidity to trigger weather events
  • Select the number of hours that you want to look ahead. This means you can install a version of the app for workdays that will check the weather for the next 8 hours and let you know if, during those 8 hours, it is going to be cold, hot, windy, rainy or snowy. You can install another instance of the app for the evening, that only looks at the next 2 hours. You can select to look ahead from 1-24 hours or just check the current conditions
  • If multiple weather conditions are matched, the lamp will cycle through all the applicable weather colors. For instance, if it’s going to be cold, windy and snowing, the light will turn on and change from blue to yellow to pink.
  • In the event of a weather alert, the light will work as it always does, but all applicable colors will flash
  • The selection of a motion sensor is optional. The app can be controlled by a button click alone
  • Select which type of weather alerts you want to see (Advisory, Watch, and/or Warning)
  • The lights can remember their last settings and revert to those settings after the weather is done displaying. You can disable this feature to have the lights turn off when the display is complete.
  • The forecast is updated automatically every 15 minutes and stored locally instead of being retrieved each time the lights are triggered to help reduce any delays.

What’s New 2016-02-21

  • Added support for contact sensors. Now you can trigger the display when a door is opened.
  • Added the ability to specify precipitation intensity for rain.
  • Added the ability to specify accumulation for snow.
  • Added “Always On” to display the forecast continuously while the app is active.*
  • Redesigned the interface to make it more user friendly and easier to use.
  • Added option to enable/disable the app.
  • Added support for LIFX bulbs.
  • Added the option to disable the “All Clear” alert.
  • Adjusted the color definition for “Yellow”
  • Added an “Under the Hood” section for additional app settings and debugging.

* “Always On” has some significant limitations that are worth mentioning. Due to scheduling and app execution time limits, when multiple weather conditions exist, the lights will cycle through all colors, leaving each one on for 2 minutes. The scheduling limit is supposed to be one minute, which I still think is too long, but at 1 minute I noticed a high rate of schedule failures. These limitation also prevent flashing the lights for weather alerts. Trying to flash the lights for more then 20 seconds would exceed the maximum app execution time. Because of this, flashing lights for weather alerts are disabled when “Always on” is being used. If an alternative becomes available, I’ll implement it.

Wish List

  • Add Pollen indicator to the list of available triggers. I’ve been
    looking for a pollen api to do this with no luck so far.

To install this SmartApp:

  1. Go to One simple home system. A world of possibilities. | SmartThings and create an account
  2. After your account is created go to “My SmartApps” then click “+ New SmartApp”
  3. Select the “From Code” tab
  4. Copy the code from Smart-Weather-Lamp/Smart-Weather-Lamp.groovy at master · jdiben/Smart-Weather-Lamp · GitHub and paste it into that page
  5. Click “Create”
  6. Click “Publish” then Click “For Me”
  7. When that’s complete just go to the SmartThings app and add a new app
  8. Swipe the top section over to “My Apps” and tap the app you just created.
  9. Follow the onscreen setup and you’re done.

Let me know if you have any suggestions or comments. I’d love to hear your feedback

15 Likes

I was going to tackle this… But now I don’t have to!:wink:

Thanks dude!

Don’t you ever sleep? :smile:

1 Like

What is this sleep you speak of? :wink:

1 Like

I’ve added a few new options

  • Custom App Icon (I know. I’m super excited abut this one too!)
  • Reconfigured setup pages and added a few options
  • Added weather triggers for Cloud Cover, Sleet, and Dew Point (Humidity)
  • Added option for actual or apparent temperature when checking hot and cold triggers
  • Added ability to select which type of weather alerts you want to see (Advisory, Watch, and/or Warning)
  • You can now choose which colors you want to use for each weather event or disable any unwanted weather events.
  • Conditionalized the forecast api to only request data that is needed for the enabled weather events. This should speed up response time if only slightly

I’m still looking for a good api for Pollen Count and really hope to find one soon.

The updated code is available at the github link at the top of this page.

I’ve added a couple of new features:

  • The lights can now remember their last settings and revert to those settings after the weather is done displaying. You can disable this feature to have the lights turn off when the display is complete.
  • The forecast is now updated automatically every 15 minutes and stored
    locally instead of being retrieved each time the lights are
    triggered. This should make response time a bit better.

The updated code is available at the github link at the top of this page

Oh…now I might need to get a Hue now. This is a great feature add!

So, I don’t have any Hue lights to test this with. I want my lights to work as normal lights and only change color/flash for severe weather. Can this app do that? If so, I’m going to buy some Hues pronto!

So, if I don’t use a motion sensor, is the only way to get the weather report by using the Tap Trigger?

Currently, the lights will only flash when there’s a severe weather alert. You can’t set a color for a severe weather alert. The color is controlled by the weather events you set up. For instance, if you set the lights to turn purple when there’s rain in the forecast then the lights would turn steady purple for rain with no alerts or flash purple for rain when there is also a severe weather alert. I could create a new app based on this one that would do what you’re looking for but I don’t have the time right now. Maybe in a few months

Yes, those are the only 2 options at the moment. If you have suggestions for another way to trigger it then post it here. I may be able to add it in at some point.

I am working on an update, when time permits, that will allow the lights to always report the forecast without the need for any kind of trigger. It would update every 15 minutes or so. The only downside is that you would lose that light for anything else while the app was running because it would constantly be updating to reflect the weather.

I think the constant-on is a good one. I think I’d like to see a door sensor as well. That way, I could open my coat closet and have the light come on as well as give me the weather. To this end, it would also be nice be able to adjust how long the weather (color) stays on, before switching back to the preset.

I’m not sure if it can be coded this way, but a light switch would also be a great trigger. Maybe build in a delay before the trigger fires as well, so you can turn on a light and have that trigger the weather, which then changes a light’s color, then after a preset time the light changes back to white (or its previous setting).

I envision turning on my closet lights in the morning, having one of the lights in the closet be a hue bulb. All the lights come on to the preset hue white-ish color, then a second later the hue bulb changes to the weather color for however long I preset, then it changes back to the previous white-ish until I turn the lights off… Dunno if it’s possible, but this seems like a viable use for me!

I like the switch idea as well. I was actually thinking of using a virtual switch I could toggle to determine how the light should act.

If VSwitch ON show weather.
If VSwitch OFF act as normal light

The motion concept in my case doesn’t work for me. I have a dedicated light in my living room I use to signal various events.

I like the concept of the app though.

any update on just having this every so often, if not maybe I will update.
I did make a change to the app to allow disabled for all clear color… and adding supporting code.
in this way I can have nothing happen if it is all clear.

I think the motion actually triggers it more than if it ran every xx minutes…

I also made another change to the app… I found an issue we have a wind alert 30-50 mph. but the actually hourly wind is only showing 13 mph etc. This is below my threshold so no color is set even though an alert is triggered.
I added a preference for default alert color which gets set if there is an alert but the specific event color is not triggered.
I also figured in order to signify an alert you shouldn’t have to pass your threshold for that event ie snow, rain etc. so I further modified the code to search for those keywords in the event header and if they are found set the color to that regardless and also still set the default if any alert but no color or specific type found.
ie

if (response.alerts) { //See if Alert data is included in response
		response.alerts.each { //If it is iterate through all Alerts
			def thisAlert=it.title;
			log.debug thisAlert
			alertFlash.each{ //Iterate through all user specified alert types
              log.debug "in alert this alert = $thisAlert it = $it!"
              
				if (thisAlert.toLowerCase().indexOf(it)>=0) { //If this user specified alert type matches this alert response
					log.debug "ALERT: "+it
                    
                    // try to find color for specific event based on snow wind sleet rain etc.
                    if ((thisAlert.toLowerCase().indexOf('wind') >= 0) && (windColor != 'Disabled'))
                      {
                        log.debug "Found alert of type Wind!"
                        colors.push(windColor)
                        log.debug "Wind"
                        log.debug windColor
                       }
                       
                    if ((thisAlert.toLowerCase().indexOf('rain') >= 0) && (rainColor != 'Disabled'))
                    
                      {
                        log.debug "Found alert of type Rain!"
                        colors.push(rainColor)
                        log.debug "Rain"
                        log.debug rainColor
                       }
                       
                    if ((thisAlert.toLowerCase().indexOf('snow') >= 0) && (snowColor != 'Disabled'))
                      {
                        log.debug "Found alert of type Snow!"
                        colors.push(snowColor)
                        log.debug "Snow"
                        log.debug snowColor
                       }
                       
                    if ((thisAlert.toLowerCase().indexOf('sleet') >= 0) && (sleetColor != 'Disabled'))
                      {
                        log.debug "Found alert of type Sleet!"
                        colors.push(windColor)
                        log.debug "Sleet"
                        log.debug sleetColor
                       }
                       
					weatherAlert=true //Is there currently a weather alert
				}
			}
		}
	}

Hi Joe (@jdiben), first, thanks for the great App! Very well thought out. I tried using it with my new LIFX bulb, and while I can get the ancestor app (jkohlen’s) to work, yours doesn’t engage my light, both with the motion sensor and with the tap trigger. I can see it is polling from forecast.io as my pull numbers decrease each time I tap it, but the light doesn’t engage. Any tips or tricks?

One other question, should the API we enter include the location coordinates of where we want the weather forecast? Or how is that determined? I just copied the key at the bottom next to the reset button, nothing else. Thanks!

Yes, I was wondering that also. I have set it up with no problems and amended the temps to suit but not sure if the forecast is my location and don’t know how to test.

BTW I am waiting for this lamp to be delivered -
http://www.litecraft.co.uk/deco-callagan-1-light-table-lamp-white

I assume your referring to the always on update. I’m a bit stuck on this one at the moment. SmartThings, understandably, doesn’t seem to like schedules that run more than once per minute. If there’s only one type of weather to be displayed this isn’t a problem. The problem arises when we need to alternate between colors to show multiple types of weather. Ideally it would alternate colors every 10 seconds or so. In this case I feel that alternating colors every minutes is just too long. I’m still looking for a work around and if I find one I’ll update the app with it.

I originally had an option to have the all clear disabled but every time I walked past the sensor I couldn’t help wondering if it was really all clear or if the sensor, app or SmartThings in general failed.

The issue with alerts could be a couple of things. first, the forecast.io data compiles it’s own weather data but the alerts, I believe, come from the national weather service so they might not match up. Second, the weather alerts cover a much larger area while forecast.io covers just your zip code. It could be that the high wind alert effected you county but not your town. Another possibility is that you can set your forecast to show only the next 3 hours but a weather alert will still come through regardless if it is within the time frame you set. I thought about trying to parse the alert to see if it falls into the forecast range that’s set but in the end I decided that those alerts could be serious and wanted to make sure that it came through no matter the time range.

@aaronsmethurst - I didn’t include LIFX because I don’t own any of those bulbs to test with. If you’re comfortable editing code, you can try getting it to work on you’re own. If you’re successful you can update the source at github for everyone else to use. If you’re not comfortable editing code, I can try adding it and give it to you to test. Let me know.

@aaronsmethurst and @Mavis - The forecast location is based on the location you have set for your hub. As long as the hub’s location is set to your zip code you will be getting you’re local forecast.

@Mavis - I like that lamp. let me know when you get it if it looks and works well. I might consider it too.

I haven’t tried out the app yet, so I have a quick question. Is there an option inside the app to have this only happen between certain times of day?

I have a long hallway leading to the front door and would like the hallway light to flash the weather based on a motion sensor in the hallway when we are heading out for work in the morning. If there is no ability to set the times, we will have the cats telling us about the weather all throughout the day (and in the middle of the night). The middle of the night part is no big deal, but we can still see the hallway light from our living area so it would probably be quite distracting. Also, it would trigger when we are coming in the front door as well which would seem to be not needed as we are coming from outside.