EUREKA!!!!!!!
You guys got me to thinking about the fact that the datediff dosent know if the moonrise has occured or not! There is a 3rd variable in the script that is the heart of all the calculations, and propegates the virtual devices. It reports the status of the moon, either up or down. Using this new variable as an error trap, I think I got it working!!!!!!!!!!
Here is the final code, that seems to be working now:
You can have a look at the page now, on my site, and it SHOULD be a fairly accurate representation of the moon as it traverses the sky from rise to set.
again, its at johnwpb.com and follow the "MyHomeseer" link then login and go to the "Moon Phase" link at the bottom.
Shew!!!!!!!!!!!!!!
MANY, Many, MANY, Many, MANY, Many, MANY, Many, thanks to all that helped on this one! I will NEVER take on a project that involves times witout having a date to work with as well! Thats for sure!
You guys got me to thinking about the fact that the datediff dosent know if the moonrise has occured or not! There is a 3rd variable in the script that is the heart of all the calculations, and propegates the virtual devices. It reports the status of the moon, either up or down. Using this new variable as an error trap, I think I got it working!!!!!!!!!!
Here is the final code, that seems to be working now:
Code:
Moonstatus = hs.deviceString("m3")
Moonrise = hs.deviceString("m1")
CurrentTime = time
if Moonstatus = "Moonstatus: Up" then
MoonUpTime = DateDiff("h", Moonrise, CurrentTime)
if MoonUpTime < 0 then MoonUpTime = MoonUpTime +24
end if
if MoonUpTime > 14 then MoonUpTime = 0
if MoonUpTime < 0 then MoonUpTime =0
hs.SetDeviceString "M4",MoonUpTime
You can have a look at the page now, on my site, and it SHOULD be a fairly accurate representation of the moon as it traverses the sky from rise to set.
again, its at johnwpb.com and follow the "MyHomeseer" link then login and go to the "Moon Phase" link at the bottom.
Shew!!!!!!!!!!!!!!
MANY, Many, MANY, Many, MANY, Many, MANY, Many, thanks to all that helped on this one! I will NEVER take on a project that involves times witout having a date to work with as well! Thats for sure!