-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request/Enhancement: Azimuth (or direction) #25
Comments
I started working on adding azimuth, and it became a much harder task than I expected. I put the work aside and haven't had a chance to get back to it. |
Well, if it it were to happen, I'd appreciate it. I'm not well-versed in astronomy, but I can code. :) |
👍 azimuth sensor! |
fyi: azimuth calculation is part of the normal |
@pyrrolizin, yes, this is true. However, people who use my sun2 custom integration (I would think) don't usually also use the built-in sun integration. These two integrations take different approaches. The built-in sun integration simply calculates attribute values on a periodic basis, where the period is adjusted throughout the day, on a pretty fixed schedule. My custom integration attempts to determine the time between each update, such that the value changes on a consistent basis (e.g., by 0.1 increments.) That is a much harder thing to do (at least, when based on the astral package.) And, unfortunately, it is much harder with azimuth than elevation, which is why I never finished the azimuth implementation. But, yes, if anyone needs azimuth (even if they're using this custom integration), they'll probably need to use the built-in sun integration to get it. |
@pnbruckner ah, I see. Thank you for the clarification.
Yes, that is true. I have now read a little deeper into the calculation and your code and can understand your decision very well. |
So I was looking around for an azimuth calculation and stumbled upon this paper: A solar azimuth formula that renders circumstantial treatment unnecessary without compromising mathematical rigor: Mathematical setup, application and extension of a formula based on the subsolar point and atan2 function I have not looked into any code, as I am not a programmer, but the paper presents a method to calculate the azimuth based on only lat/lon and time using Would this be helpful for sun2? |
@backcountrymountains, thanks, but the astral Python package (which both this custom integration and the standard built-in integration use) already contains a method to return the azimuth at a given time and location. That's not the issue. My integration wouldn't just get the azimuth value at some periodic rate. Rather it would attempt to determine when the azimuth will reach incremental values. In essence, it needs to do the inverse of the usual function -- i.e., calculate time based on azimuth, not azimuth based on time. And given the nature of the azimuth curve, the technique I used when doing the same for elevation doesn't work very well, and I've never taken the time to try something else. I understand that this is a gaping hole in this integration, but I guess I've just not been up to the task when it comes to azimuth. |
I found this integration because I need to obtain elevation and azimuth for two different locations, but the built-in integration can only be used once, for the default location of HA.
This is not possible when the built-in integration is used to track a location and this other integration is used to track a different location, isn't it? As a workaround, could be possible to have an azimuth based on time while the preferred implementation is not finished? Thanks for the great work! |
Yes, I suppose that's a reasonable thing to do. I'll see if I can find some time to work on that. |
@cdeharo, et al, A basic implementation is available in beta release 2.4.0b0. Let me know if you try it and how it works for you. |
Thank you for implementing so quickly. I have just installed the beta release 2.4.0b0 and it is working as expected! |
@cdeharo is it still working ok? If so, I'll go ahead and fully release. |
Yes, everything is still working fine. Thank you for your hard work on this. I'm happy to give you the green light to fully release it. |
Thank you for your work on this. Very hand so far. I would like certain automations to differ based on where the sun is coming from (for example, if it is pouring in through the side that has windows, or if it is behind the garage). Is it a lot of work to get azimuth or direction? Thank you for considering it.
The text was updated successfully, but these errors were encountered: