![]() Log.info "Sun is already down, run sunsetHandler" Determine if sun is down at time of initializtion and run sunsetHandler() if soĭef s = getSunriseAndSunset(zipCode: zipCode, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset) Subscribe(motions, "motion.active", handleMotionEvent) Subscribe(location, "sunsetTime", sunriseSunsetTimeHandler) ![]() Subscribe(location, "sunriseTime", sunriseSunsetTimeHandler) Subscribe(location, "position", locationPositionChange) unschedule handled in astroCheck method Section("Select Motion Sensor(s) you want to Use") " * for the specific language governing permissions and limitations under the License.ĭescription: "Dusk to dawn light with dim/bright motion sensing ", * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed * Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except * Dusk-to-Dawn Motion-Dimming Light - AaronZON If you try this, let me know how it works for you and if you see any issue/opportunities. I used code borrowed from (from this thread) and from the published SmartApp ‘Sunrise/Sunset’ along with some stuff I did myself. When motion is sensed, dimmer goes to 100% for 5 minutes (to also be a settable preference eventually) then returns to 20% (or 0% if the sun happened to come up in the meantime). During sun=down, the dimmer is set to 20% (hard coded but I will make this a settable preference at some point). I’ve noted some todo items in comments in the codeĭescription: This is a dusk to dawn light that uses sunrise and sunset information from ST and allows offsets. Letting ST figure out the location (I entered the zip code in preferences).It ran on the simulator and is running at my house. The bulb will dim to 10% but won’t start. However, the LED bulbs I’m using wouldn’t light off at 10% so I had a situation where the dimmer was reporting ON at 10% with no light. I revised your code to run the dimmed state at 10%. I had another weird issue that turned out to be a hardware issue. When it is cleaned up and fully tested, I will post. I used some of your code, some from Sunrise/Sunset, and some I wrote myself. In the meantime, however, I decided to write my own - because you can never have enough flavors of dusk-to-dawn implementations - with some additional features. I think all you have to do is update state.sunMode in setSunset() and setSunRise()… So then you have the lights on and responding to motion during the day which is what I observed. So, the next time motion is captured and triggers handleMotionEvent(evt), it thinks its still in SunsetMode, lights the lights and full brightness, then runs setSunset() which dims the lights to 20%. However, state.sunMode is not updated in setSunrise() so it stays “SunsetMode”. SetSunrise() should fire off as expected at sunrise and turn the lights off. so, state.sunMode will always be set to “SunsetMode” (except on the very first run of checkSun if it happens to be during the day). Looks like you have it coded to run checkSun every day at 1:00AM local time. OK, I think I know why this didn’t work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |