rdmtc / node-red-contrib-sun-position

This is a ultimate Node-Red Timer, Sun, Moon and Blind flow control.
Apache License 2.0
106 stars 24 forks source link

SunInWindow not working for southern hemisphere #362

Open waynethomas69 opened 2 years ago

waynethomas69 commented 2 years ago

Describe the bug When an oversteer is created, and the "Only in Mode restrict Sunlight" is selected, the oversteer does not work as expected. The node is set in restrict Sunlight, and the conditions are met, but oversteer does not activate - the blind still lowers to restrict the sun entering the room. If the same oversteer is changed to "Only in Mode minimise sunlight" the oversteer seems to work, but occasionally deactivates even though the conditions were met at all times. When the node is subsequently edited, the setting has changed itself to "Only in Mode maximise sunlight". At all times during testing global.clouds equalled 100, and the mode was 2 (restrict sunlight). Despite this, the oversteer did not function as expected

Screenshots Original setting: image Despite the settings being satisfied oversteer did not take control.

Setting "minimise sunset", here is the setting before deploying the flow: image After deploying the flow and re-entering the node the setting has changed itself to "maximise sunset": image

Expected behavior With original settings shown above (only in mode restrict sunlight) the oversteer will take effect and the blind will fully open.

System information (please complete the following information):

Additional context Add any other context about the problem here.

waynethomas69 commented 2 years ago

Deleted previous comment because it seemed to be an unrelated bug with node-red which was resolved when I restarted node-red. Original issue remains, with oversteer not taking effect when it should when using "only in mode restrict sunlight".

Hypnos3 commented 2 years ago

This works as intended. In the winter and the minimize mode if the sun is not in the window, the oversteer does not apply.

waynethomas69 commented 2 years ago

@Hypnos3 it's currently summer in the southern hemisphere (always the opposite of the northern hemisphere), so I believe the oversteer should be working. I also didn't realise that it actually paid attention to the season - I select winter or summer mode based upon the temperatures inside and out rather than relying on the date. If we are having a hot spring will summer mode not be active?

Hypnos3 commented 2 years ago

The oversteer works only if the sun is in the window (this is independent of the chosen mode). This is calculated by the given start/end azimuth for the window.

Maybe there is still a bug for the azimuth calculation for the southern hemisphere.

I have added an option to the oversteer rules that they can be active if the sun is not in the window in 2.0.6 version.

With this option the oversteer should be always active (if no time rule is active).

waynethomas69 commented 2 years ago

Thanks @Hypnos3. The sun is definitely in the window (or would be if there wasn't cloud). Everything else about the azimuth works despite being in the south. For instance I have set length on floor to 550mm and it works perfectly. It only seems to be oversteer that does nothing. Here is my sun control.Everything works 100% perfectly and I love the control it gives me. I reversed the start and end azimuth to deal with being in the southern hemisphere. image image

Here are my two oversteers. The first is for cloudy days, and the second is because the sun is completely blocked by the eave of my roof when the sun is high enough. Neither of them works, but everything else about sun control does. image

Hypnos3 commented 2 years ago

The problem with the southern hemisphere had been known for a longer time (#209), and to be honest, I had not yet dealt with it intensively.

GeorgeCastanza commented 1 year ago

So if my window faces west (say 270), and I live in Sydney (southern hemisphere), what would the entries be for sun restriction? I'm wanting to restrict sun on a west facing window. I seem to have figured it out for a north facing window, but am lost with the west windows.

I've tested a few, but it seems to even have sun control at 1am in the morning, when there is no sun here (obviously, 1am).

This has sun until about 1:30am (west facing window, 270°) image

waynethomas69 commented 1 year ago

Are your lat/long set correctly for that window? Regardless of whether the start and end are tweaked appropriately I would expect the sun elevation to be calculated correctly (well below the horizon) therefore you shouldn't see any sun control.

Other than that, try using negative values: put the start as -90 (no point setting it to -180 since the sun sets well before that), and set the end to -1.

I've not set up any west-facing windows, but you can see how I set up my east-facing windows in #209.

GeorgeCastanza commented 1 year ago

Thanks for the tips, I've just entered them as start -90, end -1. I'll see how it goes.

But yes, the latitude/longitude is set correctly, but for some reason, with start 179, end 359 (west facing window), it has sunlight right up until 1am (I'm in the Sydney region).

As an aside, I thought we were supposed to have 180° degree range for window start / end. Happy to be wrong.

waynethomas69 commented 1 year ago

None of my windows are set up with 180° range - when the sun is perfectly in line with your wall it can't actually shine in the window. My north facing window has a range of 170°, others are much less due to the sun being below the horizon beyond certain azimuths. At the moment in Auckland the sun is at 0° elevation when its at +/-110° so you might want to tweak the numbers to -120 and -1; but that will only really be an issue if you have nothing blocking the sun when it sets in the west.