[CODE] Heliotrope: a plugin that tracks the sun

Hi JOD,

Give version 6 (submitted to apps.mios.com, files attached to first post in the thread) a try. I haven’t tested the events so let me know how it goes.

If you’re north of 23.5º N, you’ll probably want the “Sun Azimuth [0,360) increases past” event.

Hi futzle,

Thank you…
Since I’m already running v4.0 installed through apps.mios, I dont see if there is an updated version available, and going to apps.mios.com does not show the version.
Do you know if the auto update (box is checked) will install v6.0 when it is available?

Otherwise I’ll just upload the files and check it out, which I think disables future auto updates?

@Jod

A previous post from MCVFlorin to force update use:
http://Vera_IP:3480/data_request?id=update_plugin&Plugin=Plugin_ID

Thanks @Brientim,

I can’t use that right now as I’m not on Vera’s LAN.

Nice plugin…just one question. When I configure a trigger ‘if sun goes below altitude’ it is always executed if luup restarts/reloads. I don’t have this kind of behavior with other plugins.

Is there a way to make the trigger only execute one time?

Thanks

Interesting. I tried the same on a stock temperature sensor device (“Temperature goes over …”) and I find that it, too, fires when the condition happens to be true at Luup restart. Can you see if you get it on other events where the comparison is < or >?

Edit: I’m going to experiment with the mysterious fifth argument to luup.variable_set() and see if that has an effect. I’ll report back when I’ve had a chance to play.

If this really is a feature of all devices, then there’s a workaround: have the Heliotrope event trigger a virtual binary switch, and have the switch status change trigger the scene. But yuck.

Also I am going to add Heliotrope to the Combination Switch plugin Real Soon, and that’ll have the right semantics.

Interesting. I tried the same on a stock temperature sensor device (“Temperature goes over …”) and I find that it, too, fires when the condition happens to be true at Luup restart. Can you see if you get it on other events where the comparison is < or >?

If this really is a feature of all devices, then there’s a workaround: have the Heliotrope event trigger a virtual binary switch, and have the switch status change trigger the scene. But yuck.

Also I am going to add Heliotrope to the Combination Switch plugin Real Soon, and that’ll have the right semantics.[/quote]

@futzle agree this a a system function that I have in cases implemented the work around either the using a virtual switch or variable container. I tend to use variable container where I have multiple values I wish to test as the first conditions. However, this could also be achieved using the combo variable container. I also go this for cyclic scheduled activities which result in notifications.

No luck, sorry. If I pass true in that fifth argument, then no event ever triggers. If I pass true only the first time at Luup startup, and false thereafter, it just delays the problem. Either the event fires too often, or it never fires at all. Neither of which is acceptable.

I can’t believe that the current behaviour is the intended one. I’ll have to take it up with MCV. Meanwhile, you have an ugly workaround.

If you're north of 23.5º N, you'll probably want the "Sun Azimuth [0,360) increases past" event.
@futzle, v6.0 was made available on apps.mios yesterday, thank you. I'm using the "Sun Azimuth [0,360) increases past" and have a question.

I know it was brought up before about “normalizing” the Azimuth, so with my UI showing “-” numbers past the 180 mark, does one need to use the “-” when setting the trigger degrees too?

A few quick demo mockups with and without “-” and I’ve not managed to get a trigger to work (yet).

futzle
I think I have an easy (for you) feature request which enhances your goal and might make things a bit easier for some users too.

I suspect you have most of the code already done for calculating sunrise/sunset, dusk/dawn, etc … how about adding code to create devices for these?

The idea came from seeing a similar plugin (Twilight - Automate your home with EventGhost) for another app which breaks things down a bit to make usability easier into…

sunrise / sunset
civil dawn / dusk (Civil twilight)
nautical dawn/ dusk (Nautical twilight)
astronomical dawn/ dusk (Astronomical twilight)

… by exposing these as Devices that are true/false, and with a time of day they occurred, users can easily create scenes with these instead of needing to know the exact location of the sun… plus time of day allows for a time offset (+ or -) to be used in the scene which is very useful since people’s rooms get dark at different times before/after these sun events based on things like room facing, window coverings, etc.

I hope you like the idea?

Hi Aaron,

Part of the reason I developed the Combination Switch was so that users could make up their own conditions like this, without adding complexity to plugins like Heliotrope. The kind of binary flags that you are proposing can be achieved now using one Heliotrope and three Combination Switches, one for each level of twilight. If users needed only one level of twilight then they would need only one Combination Switch. For users who don’t care about twilight, they won’t see this feature at all.

So while I agree that adding twilight directly to Heliotrope is easy, it goes against the philosophy (which I picked up from my days with UNIX) of small tools that do one thing well.

Let the idea sit with me a bit. I’m not rejecting it; it’s a good idea. But features in software are forever, and I want to be sure before committing to anything. Meanwhile, try the Combination Switch to get the same behaviour.

Hi Futzle,
I understand your hesitation but I think the one added features (auto creation of devices, with time stamps) enhances the plugin… I think if the code sets were in an IDE they would all even be in the same library as they are so complimentary, and my feature’s dependency is your Heliotrope code. And, I maybe just have the device creation be optional (user selected) so if users only want it to be a global variable (maybe for LUUP code) then they can have that without devices. For the standard user, who will not code LUUP, devices are needed.

Also, devices with time stamps will considerably reduce complexity for creating Scenes based on sunrise/sunset/dusk/dawn, especially when looking to use time offsets… which I don’t think is possible with Heliotrope + Combination Switch, in the current form? … though a good feature request for C.S. might a a time offset option eh :wink:

Either way you decide, Thank you for helping the community!

@Futzle,
I hope you have given this one more consideration? You can see, from the Combination Switch thread, there would be a lot of use that would come from my feature request.

Hi Futzle, wonderful plugin, thanks a lot!

One question, I try to use it as a trigger when the altitude goes below 30 to swith on some lights and close some windows covering. Now, the morning, for example, when the altitude is already below 30, it always trigger my scene. Is it possible to run it once? Another solution was to use your combination switch, and to select the Heliotrope device, but I couldn’t see this device in the combo. Or to implement time values, like you did with the temperature (between 10AM and 5PM). So, when you agree with this, and of course when you will have time, it could be great to implement this!

Anyway, I find this plugin very useful! :wink:

chris

chris66, the repeated triggering is a known bug in the way Vera does events. I can’t work around it within the plugin, unfortunately.

Heliotrope is already supported by the Combination Switch, as the Sun Position condition.

Ok, so maybe I’ve a problem with autoupdate, I’m still in version 8, I will uninstall and reinstall.

Perfect now! But autoupdate didn’t work, Micasa problem, right? :wink:

Autoupdate of plugins has never worked for me.

Not always a good option to uninstall and then reinstall due to removing relationships with other elements of your configuration such as Scene or Combination switch etc.

You have two options to force an update without uninstall/install
Option 1
Goto apps.mios.com login and then select your unit if presented with muliple units.
From the My Account select View Plugin Details
Identify the plugin you wish to update and open it by either clicking in the Plugin Name or View located on the right side.
Click on Versions located on the top right of the screen to display the version history sceen.
Under Actions click on Install for the version you wish to install.

Option 2 will enable most recent approved version to be installed.
In your browser use the following command. You need to replace Vera_IP and Plugin_ID to details obtained from your unit.
http://Vera_IP:3480/data_request?id=update_plugin&Plugin=Plugin_ID

To force a plugin rollback to a previous version.
Click on Versions located on the top right of the screen to display the version history sceen.
identify the version you want to install.

Thanks for the info Brientim, :wink:

@Futzle, just a logical question:
With combination switch, I put for testing:
Sun position azimut is in range 90° to 270° (East to West)
Sun position Altitude is in range 20° to 70°
Switch is on when 2 or more …
Now my heliotrope, after reaching 180° is in negative value: -179° but the Combination Switch always returns True.
So my first question: is it normal that CS returns True in this case?
Second question, do I have to put:
Sun position azimut is in range 90° to -90° to follow your logic and to be right?

Thanks, chris