Skip to content

Commit

Permalink
fix: homeassistant doesn't accept the conversion from lux to w/m²
Browse files Browse the repository at this point in the history
  • Loading branch information
lhw committed Jun 1, 2024
1 parent cef681f commit fedb00e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
13 changes: 0 additions & 13 deletions aiocloudweather/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ def in_to_mm(length: float) -> float:
return length * 25.4


@unit(UnitOfIrradiance.WATTS_PER_SQUARE_METER)
def lux_to_wm2(lux: float) -> float:
"""Convert lux to watts per square meter (W/m²)."""
return lux * 0.0079


@unit(UnitOfSpeed.METERS_PER_SECOND)
def mph_to_ms(speed: float) -> float:
"""Convert miles per hour (mph) to meters per second (m/s)."""
Expand All @@ -68,13 +62,6 @@ def mm_to_in(length: float) -> float:
"""Convert millimeters (mm) to inches."""
return length * 0.0393701


@unit(LIGHT_LUX)
def wm2_to_lux(lux: float) -> float:
"""Convert watts per square meter (W/m²) to lux."""
return lux * 127


@unit(UnitOfSpeed.MILES_PER_HOUR)
def ms_to_mph(speed: float) -> float:
"""Convert meters per second (m/s) to miles per hour (mph)."""
Expand Down
2 changes: 0 additions & 2 deletions aiocloudweather/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ class WeathercloudRawSensor:
UnitOfPressure.INHG: inhg_to_hpa,
UnitOfTemperature.FAHRENHEIT: fahrenheit_to_celsius,
UnitOfPrecipitationDepth.INCHES: in_to_mm,
LIGHT_LUX: lux_to_wm2,
UnitOfSpeed.MILES_PER_HOUR: mph_to_ms,
}

METRIC_TO_IMPERIAL: Final = {
UnitOfPressure.HPA: hpa_to_inhg,
UnitOfTemperature.CELSIUS: celsius_to_fahrenheit,
UnitOfPrecipitationDepth.MILLIMETERS: mm_to_in,
UnitOfIrradiance.WATTS_PER_SQUARE_METER: wm2_to_lux,
UnitOfSpeed.METERS_PER_SECOND: ms_to_mph,
}

Expand Down

0 comments on commit fedb00e

Please sign in to comment.