So I removed the Astro Jar mentioned on Github, upgraded to #1031 and installed the Astro binding via PaperUI. Unfortunately… my problem returned (sunrise/set not triggered)…
With the standard, PaperUI binding, I get this in openhab.log:
2017-09-03 13:35:46.997 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-09-03 13:35:47.239 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-moon at midnight for thing astro:moon:local
2017-09-03 13:35:47.907 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:local
2017-09-03 13:35:48.360 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:local
In the Karaf console, I see:
openhab> bundle:list|grep -i astro
177 | Active | 80 | 0.9.0.201706170545 | Astro Binding
openhab> feature:list|grep -i astro
esh-binding-astro | 0.9.0.SNAPSHOT | | Started | addons-2.2.0-SNAPSHOT |
openhab-binding-astro | 2.2.0.SNAPSHOT | x | Started | addons-2.2.0-SNAPSHOT | Astro Binding
When I uninstall Astro via PaperUI and put back the Astro JAR in the Addons-folder:
You should have one “active” astro binding, not several which are “started” or “uninstalled”, the binding needs to be active.
Still the same recommendation: set up a quick test system, only install the astro binding, see what happens … or at least do a clean up of your tmp and chache folders …
Edit: ahhh, now I see, you used an additional command I’ve never seen before, so let’s compare again:
openhab> feature:list|grep -i astro
esh-binding-astro │ 0.9.0.SNAPSHOT │ │ Started │ addons-2.2.0-SNAPSHOT │
openhab-binding-astro │ 2.2.0.SNAPSHOT │ x │ Started │ addons-2.2.0-SNAPSHOT │ Astro Binding
Thx! So indeed, when installing Astro via PaperUI, somehow an old version of the Astro binding got installed.
So I was looking in the OpenHAB folder structur, and in the folder “/var/lib/openhab2/kar” I’ve located two subfolders:
openhab-addons-2.1.0-SNAPSHOT
openhab-addons-2.2.0-SNAPSHOT
I think they got there because in the past I had the OpenHAB addons packages installed. I uninstalled it (using apt-get), but I guess the packages stayed.
Would it be safe to delete those two subfolders? Do you have something similar in that /kar folder?
If they are not gone delete the two openhab-addons-2* files.
No, my /kar folder is empty, but I did never install the addons package.
Also delete the contens of the tmp and cache folder to clean up any mess (restart will take slightly longer after that, because all bindings have to be downloaded again).
Then restart openHAB and install the new “fresh” astro binding.
The apt-get purge didn’t help (“Package ‘openhab2-addons’ is not installed, so not removed”).
I stopped OpenHAB, deleted the contents of the /kar, /tmp and /cache folder.
I started OpenHAB. I had some various error messages at first boot. I did nothing more than reboot a few times and now they are gone.
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.