Woooah that was quick, amazing work, you are my role model Mariano
I really gotta learn this Edge stuff and Lua
(EDGE Driver-Mc): Aplicaciones Virtuales Mc (virtual Switch Mirror, Virtual Calendar and virtual Switch Board...)
Woooah that was quick, amazing work, you are my role model Mariano
Monitor it to see how it works in your location.
Let’s see if I can get the Azimuth calculation to work well.
Amazing work @Mariano_Colmenarejo
I have managed to get the Azimuth calculation function to work correctly.
It seems that there are users who use it to lower or raise blinds, awnings or curtains depending on the orientation, azimuth, and elevation of the Sun.
The displayed Azimuth value corresponds to the navigation, orientation or compass standard, with a angular movement of 15.05º/h in an East to West direction, with values from 0º to 360º:
- The Solar Azimuth will indicate the South (180º) at solar noon in the Northern Hemisphere
- The Solar Azimuth will indicate North (0º) at solar noon in the Southern Hemisphere
- At Sunrise the azimuth will always show East (90º +/15º), 90º at the solar equinox
- The Sunset always the azimuth will show the West (270º +/15º), 270º in the solar equinox.
I have modified the code published on this page, by Edi Budimilic, and from the link posted by @GSzabados.
The necessary modifications for it to work correctly are in this link, In case someone needs it
The original calculation needs a different correction for E and W longitudes and N and S latitudes.
The calculation function makes 2 direction changes in the calculated azimuth, one at solar noon and another 12 hours later at night. Instead of calculating from 0º to 360º, it calculates from 0º to 180º and returns from 180º to 0º.
The function code, which only needs receive the latitude, longitude, and UTC time, with os.time().
The azimuth value is calculated 2 times:
- The first with the current UTC time and the values returned altitude and azimuth are saved
- The second is calculated by the function with UTC time - 60 sec
- The returned values confirm the direction of the azimuth increase (increasing, UP or decreasing DOWN).
- Depending on whether the trend is UP or DOWN, the azimuth of the LOCAL time is corrected by subtracting it from 360º depending on whether the location is in the NE, NW, SE or SW quadrant.
I have tested and checked it with 4 locations in the four quadrants, Beijing (NE), Melbourne (SE), New York (NW) and Rio de Janeiro (SW)
It works with a precision of +/- 0.5º with respect to an online calculator Calculadora en línea: Acimut y ángulo de elevación solar
This is the new driver version
It will be updated automatically and could need delete cache in android app
─────────────────────────────────────────────────── Name Aplicaciones Virtuales Mc Version 2023-02-16T12:28:03.382506938 ───────────────────────────────────────────────────
For the last few days the virtual calendar keeps resetting the UTC offset to 0. I have changed it back to -7 probably 5 times. Any suggestions?
I don’t know why that happens to you.
I have it installed and it will never reset.
The value is saved in permanent memory and that memory is only reset when the driver is changed, but it is kept when a reboot is done, or the hub is turned off or a driver update.
But I can no longer guarantee anything, since things change when it seems to them without warning
I just tested it with my hub v3 turned off, with firmware 46.10 and the value is maintained perfectly
I just looked and found my UTC offsets set to 0 for both locations instead of -5. I know I had this set up for both locations.
Also the latitude and longitude of my 2nd location were both set to 0.1 and 0.1. It is possible that I never set this up for my 2nd location. My primary location was fine.
I changed both and they are holding.
My utc has reverted to 0 offset also. I first noticed yesterday and thought maybe it had something to do with the new features. I reset it to -5, now reading this thread I go check an it’s 0 again.
My location is unchanged.
I don’t understand anything, could someone send a log of when a local time offset value is set to see what happens to them?
I have created 6 virtual calendars, with different locations and times and they are all fine for more than a week since I have been testing the new functions. I have updated the driver with changes during the tests more than 100 times and it has never been deleted
I have no idea when it changes. I set it yesterday at 1500, today I checked it at 1600 and it was 0. I do not know when it reverted or what happened to make it revert.
I looked through the main ST log for any hints.
Tuesday 14:57 noticed offset at 0, reset to -5
Tuesday 19:00 it logs the correct sunrise/sunset/length of day.
Wednesday 19:00 it logs the correct sunrise/sunset/length of day.
Thursday 19:00 it logs the sunrise/sunset/length of day for offset 0.
I had no interaction with the device other than reading it for rules. I did not even look at the UI.
Mine reset yesterday some time. I noticed as I had a number of Routines that didn’t fire as expected. In my case accessing the device in ST app was giving me the ‘This device hasn’t updated all of it’s …’ I’d had that on other devices and reinstalling the driver resolved that and it has on this device too. I reset the offset after reinstalling the driver and it’s held since.
Something strange has happened in some hubs these days, I don’t know why
I wonder if it had anything to do with the android app update that I received late yesterday. I am now on 126.96.36.199
I’m on ios, so probably more of a back-end thing. I’ve got other rules that are only partially running too.
V2 Hubs here. I haven’t even touched the Calendar device in months, but I’m seeing 0 as well on both Hubs. I reset the Calendar on one of my Hub’s using Android, and the other Hub using my iPad. Hopefully it sticks.
Here my ‘-5’ has remained present since the day I set it up… but just to clarify: when we set the ‘offset’, we do not have the option (on iOS) to input a ‘-’. Personally I just copy paste it from another app…. I don’t know how others have input there '-‘ but maybe it’s not properly saved into the field for some…
Thank for the sun level @Mariano_Colmenarejo !!!
Yes, same here. My offset was reset to 0 sometimes today or yesterday. Long and Lat settings have not changed. I have set it again and will try to keep a watch.
Moreover, “range” in local hour not working as expected, have to set local hour 2 for range.
This ‘0’ setting happened about a week ago since my Disarmed Automation for Wintertime hasn’t been running since Tuesday. At least now I know why. It was because I was using the Calendar local hour offset as a pre-condition.
So far it’s still set since yesterday, and I even rebooted one of my V2 Hubs.
It must have been in this last process of updating the firmware of the hub.
Value is only reset to 0 when the value stored in permanent memory is a null value, as is the case when the device is created. The values in permanent memory should not be erased on updates or reboots, but something weird must have happened.