Sun radiation/direction

Ask questions about integrating other services (internet and otherwise) and applications with Indigo.
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Sun radiation/direction

Post by MarcoGT »

Hi all,

windows in my flat are towards south and west.
In summer, in North Germany, we have sun till 2245 about.
Is there a way to get the solar incidence/radiation/direction and close/open the shades?

Anyone already tried something?

Thanks
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Sun radiation/direction

Post by DaveL17 »

I looked at Weather Underground data, but this doesn't appear to be available via the API. I did find this site which has data for Berlin: NOAA Solar Calculator. It may have data that you can use, or at least point you to something useful.

Cheers,
Dave
Last edited by DaveL17 on Tue Aug 04, 2015 7:37 am, edited 1 time in total.
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

Thanks, I will give it a try, but at first look I have not found anything about Hamburg in Germany.

I also found http://pysolar.org/, mentioned also on the forum, but it seems, as already said, too much.
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Sun radiation/direction

Post by DaveL17 »

MarcoGT wrote:Thanks, I will give it a try, but at first look I have not found anything about Hamburg in Germany.
Apologies. It's Berlin and not Hamburg. Would that not be close enough?
I also found http://pysolar.org/, mentioned also on the forum, but it seems, as already said, too much.
That looks really interesting!

Dave
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
freshwuzhere
Posts: 105
Joined: Thu Apr 05, 2012 2:52 pm

Re: Sun radiation/direction

Post by freshwuzhere »

You checked out Cynical Weather? It will give you 2 of your 3 requirements for an "orientation device".

http://www.cynic.org/indigo/plugins/online/weather.html
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

Very nice, this is basically what I need :) thanks :)
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

Yesterday I tried with the Cynical Weather plugin and it works; I get basically and index (one for each window) between 0-100 which indicates "how much sun" I have on the windows.
Now I can play with it to adjust my shades; about that I have a question :mrgreen:

I can do for example

Code: Select all

if index_bedroom > 80 
    set shades at 50
But it could also be that later I set the shade manually at 80
At the next evaluation of "index" Indigo will set again the shade at 50 :mrgreen:

I thought I could set a variable "override" and set it to "true" when I moved the shade manually, but I have to modify all my triggers/schedules at setting that variable to "false".
How can I distinguish that the shade was moved by me and not by a schedule/trigger?

Thanks
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Sun radiation/direction

Post by DaveL17 »

MarcoGT wrote:How can I distinguish that the shade was moved by me and not by a schedule/trigger?
You can do it with Python, but does it matter who did what? You could do something like this:

Code: Select all

if index_bedroom > 80 and shade_level < 50:
    set shades at 50
But what might even be a bit easier is if you can come up with a simple ratio for index to shade level--say:

Code: Select all

shade_level = index_bedroom - 30
new_shade_level = lambda(shade_level): (abs(shade_level) + shade_level) / 2

if new_shade_level < current_shade_level
    set shades at new_shade_level
which lets you use one block of code to evaluate every shade condition (the second line--the one with Lambda--ensures that new_shade_level is never a negative value.

Dave
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

DaveL17 wrote: You can do it with Python, but does it matter who did what? You could do something like this:

Code: Select all

if index_bedroom > 80 and shade_level < 50:
    set shades at 50
Well, this cannot work always (if I am not missing something)
If for example index > 80 and shade < 50, the action is triggered and shade is set at 50
But then, my wife sets manually shade at 40, the Indigo set it again at 50, am I missing something?
Last edited by MarcoGT on Thu Aug 06, 2015 6:20 am, edited 1 time in total.
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Sun radiation/direction

Post by DaveL17 »

Ah. I misunderstood.

Do your shades report back a status change when someone moves them manually?
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

DaveL17 wrote:Ah. I misunderstood.

Do your shades report back a status change when someone moves them manually?
Yes, at least if with "status change report" it means that Indigo logs something.
In logs there is the changing of value (0=totally close-100=totally open)
But I think it is hard to understand who did the change, if my wife or Indigo due to trigger/schedule
MarcoGT
Posts: 1111
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Sun radiation/direction

Post by MarcoGT »

Yes, yestarday I started to implement it with variable on auto/manual (or true/false)
What was missing is the schedule :)
You gave me the hint, thanks a lot :)
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Sun radiation/direction

Post by DaveL17 »

Sorry--I hit 'submit' instead of 'preview'. :) Here's one way you can accomplish this.
  • Create a variable that represents a manual override of the shade level. This can be whatever you want (true/false), (manual/auto), etc.

    Create a schedule that resets this variable to automatic mode at midnight or whenever.

    Create a trigger that changes the value of this variable to manual if a change in shade level is reported.

    Create a trigger that sets the shade level based on the radiation index only if the override variable doesn't indicate a manual override.
Each day would start with the shades in automatic mode. If someone manually changes a shade, the mode would switch to manual mode for the rest of that day. You could add additional logic based on other events (i.e., if you set your status from 'home' to 'away', resume automatic mode). You might need to put in a slight delay on the setting of the variable by the radiation trigger to account for confirmations (i.e., if Indigo changes the shade level and then the device reports back it's confirmation of the action.)

I'm not sure that I'm being clear--does that all make sense?
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
Post Reply

Return to “Integrating Services/Applications”