Created
March 16, 2015 21:12
-
-
Save KellyMahan/ca95af6f614086581a45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
garage = Winker.devices.find{|d| d.name == "Garage Door"} | |
#i dont have a garage door to check this but I think this would be the correct update to send. | |
#assuming position is the correct attribute and a value between 0 and 1. and 0 is closed 1 is open. | |
if garage.position > 0 and garage.updated_at < 10.minutes.ago #check for position and last update time | |
garage.update(desired_state: {position: 0}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment