briis / hass-weatherflow2mqtt

WeatherFlow to MQTT for Home Assistant. Use UDP to get local weather data in to Home Assistant using MQTT Discovery
MIT License
129 stars 29 forks source link

Add azimuth value #172

Open WhistleMaster opened 2 years ago

WhistleMaster commented 2 years ago

New Feature

HI !

Thanks for the great work ! Would it be possible to add the azimuth value to the list of sensors ?

Kind regards, WM

Additional context

No response

briis commented 2 years ago

We will look into it.

GlennGoddard commented 1 year ago

I did calculate these here but I have them deeply embedded in the Solar Elevation formula.

Here is a quick breakout:

def solar_azimuth(solar_elevation, solar_hour_angle, latitude):
    elev = math.radians(solar_elevation)
    ha = math.radians(solar_hour_angle)
    lat = math.radians(latitude)
    az = math.degrees(math.asin( math.sin(ha) * math.sin(lat) / math.cos(elev) ))
    return az
GlennGoddard commented 1 year ago

I also have hour angle embedded, forgot to pull that out. I'll do that later if needed here if not in a PR.