I tried a lot of what was suggested and found astro too much hard work for what it should have been. I mean all i wanted to do was to turn a light on around the time it went dark so how hard could that be? In the end i popped for a different approach using MQTT and a command line tool called sunwait. http://www.risacher.org/sunwait/
Assuming MQTT already set up i did the following…
Download and compile sunwait then copy to /usr/local/bin
Add cron entries (sudo crontab -e) that would trigger MQTT events at the right time for sun rise and sun set (can add offsets here too)
Seems reliable and i can control offset nicely. Given the pages of information ive read about astro, it seems a lot simpler if you have MQTT set up too.
for reference i tied the switch to a rule which turned on all lights in a group at sundown -10 and turned them off at 10pm
rule "Evening Lights On"
when
Item Lights_NightTime changed to ON
then
logInfo( "Lights", "Turning on evening lights...")
LightsEvening_Group.members.forEach[s | s.sendCommand(ON)]
end
rule "Evening Lights Off"
when
Time cron "0 0 22 ? * MON-SUN"
then
logInfo("Lights", "Turning off evening lights...")
LightsEvening_Group.members.forEach[s | s.sendCommand(OFF)]
end
Nice work, but in my opinion a little bit complicated for a lot of users.
Installing the astro binding and do some mouse clicks to configure it is a lot easier …
Given the list of problems here and on other threads its clearly not quite as simple as we would all like it to be quite yet. Maybe 2.2 will fix that of course.
Very much of the opinion that astro is a bit of sledgehammer to crack a nut. Id love to see a nice simple “night time” binding that provides a switch when its light / dark with some optional offsets so i didn’t have to do what i did. Taking 2.2 daily snapshots is not something i wanted to do either given the variety of success in this thread and other issues that could bring.
I’m with @sihui. What you did is very clever but I fail to see how it is any less complicated or any less of a sledge hammer than using Astro.
I’m sure many users would welcome such a binding. Do you plan on implementing it?
Having a new “simpler” nightime binding won’t fix this problem. Bugs happen, they get fixed in the newer versions, the project moves on. This is true for all add-ons.
True, but i guess the main difference is that it works reliably now in 2.1, which astro does not. Ive not plucked up the courage to try 2.2 snapshots as that seems a bit bleeding edge for me and any issues will lower the wife acceptance factor.
im pretty new to the community having lingered for a short while but Im tempted to have a go as the scope seems very simple so it may be a nice introduction.
True, maybe im just a bit impatient and like things to work. This thread has been going for 9 months so change is very slow. I really love openhab and the architecture so far and am bought in for the long run
It is indeed an older thread but to be fair, the bug in Astro was fixed within a week or two, if not sooner, from when the problem was reported. In an ideal world, the problem would have been detected during the beta period test but for whatever reason, it was not.
If you don’t want to be on the bleeding edge but still get it to work, I think you can choose a specific version of the SNAPSHOT. Just choose one that isn’t too far past when the 2.1 release occurred.
Were it almost any other binding, you could also upgrade just that one binding. But I think Astro is now managed directly under the Eclipse Smarthome project and I don’t think it is as easy to get it as a separate jar file as the other bindings are.
For the record, I’ve been running on build 988 very stably for over 8 weeks now. It absolutely does not have the bug with Astro.
that I want to change when the sun starts to go down (nightTime on/dayTime off) and when it has finished rising (nightTime off/ dayTime on).
I have created sun and moon things for the astro binding
]
and these rules to switch between day and night.
rule "Set day time"
when
Channel 'astro:sun:home:rise#event' triggered START
then
sendCommand(nightTime, OFF)
sendCommand(dayTime, ON)
end
rule "Set night time"
when
Channel 'astro:sun:home:set#event' triggered START
then
sendCommand(nightTime, ON)
sendCommand(dayTime, OFF)
end
And put those switches into my site map just for testing purposes
For one, have you waited for a sunrise or a sunset to occur? Those rules will only trigger for those events. If you restart OH or change a .items file without Persistence and restoreOnStartup then these Switches are in the NULL state.
You either need to wait for a sunrise or a sunset or you need to create a System started rule that will calculate what the switches should be in based on the actual time of day.
// 2 hours before sunrise or no later than 8:30 am or no earlier than 5:30 am for some devices
{
Channels: Type rangeEvent : rise#event
[
offset=-120,
earliest=“05:30”,
latest=“08:30”
]
// 1 hours before sunrise or no later than 8:30 am or no earlier than 5:30 am for other devices Type rangeEvent : rise2#event
[
offset=-60,
earliest=“05:30”,
latest=“08:30”
]
// 2 hours before sunrise or no later than 8:30 am or no earlier than 5:30 am for some devices
{
Channels:
Type rangeEvent : rise#event
[
offset=-120,
earliest=“05:30”,
latest=“08:30”
]
// 1 hours before sunrise or no later than 8:30 am or no earlier than 5:30 am for some devices
{
Channels:
Type rangeEvent : rise#event
[
offset=-60,
earliest=“05:30”,
latest=“08:30”
]