Skip to content
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

sensor values get cast to int #186

Open
dc6jn opened this issue Feb 26, 2025 · 1 comment
Open

sensor values get cast to int #186

dc6jn opened this issue Feb 26, 2025 · 1 comment
Labels
in progress Is beeing investigated or worked on

Comments

@dc6jn
Copy link

dc6jn commented Feb 26, 2025

Version of home_assistant

2025.2.1 (but version independent)

Version of the custom_component

INTEGRATION_VERSION = "2.1.28"
daily

Describe the bug

In connector.py the values for dew_point and temp get rounded and cast to int:
309: ATTR_FORECAST_NATIVE_DEW_POINT: int(round(dew_point - 273.1, 0))
322: ATTR_FORECAST_NATIVE_TEMP: int(round(temp_max - 273.1, 0))

475: ATTR_FORECAST_NATIVE_DEW_POINT: int(round(dew_point - 273.1, 0))
487: ATTR_FORECAST_NATIVE_TEMP: int(round(temp_max - 273.1, 0))
490: ATTR_FORECAST_NATIVE_TEMP_LOW: int(round(temp_min - 273.1, 0))

My suggestion would be to replace it with this:

309: ATTR_FORECAST_NATIVE_DEW_POINT: round(dew_point - 273.1, 1)
322: ATTR_FORECAST_NATIVE_TEMP: round(temp_max - 273.1, 1)

475: ATTR_FORECAST_NATIVE_DEW_POINT: round(dew_point - 273.1, 1)
487: ATTR_FORECAST_NATIVE_TEMP: round(temp_max - 273.1, 1)
490: ATTR_FORECAST_NATIVE_TEMP_LOW: round(temp_min - 273.1, 1)

btw: It would be nice to calculate missing values from the forecast, i.e. calculate humidity and absolute_humidity (both missing from dwd forecast) from dew_point and temperature? I can provide formulas if needed.

@FL550
Copy link
Owner

FL550 commented Mar 2, 2025

Hi @dc6jn
I once made the decision to round, because after all it remains a forecast and temperature values with fractions implies a false accuracy. What is your use-case in needing the fractions of degrees?

Regarding your hint with humidity: I wondered why you were writing this, because the relative humidity is already calculated. However I noticed after checking, that these were not included in the forecast and only in the sensors. I fixed this and will release this soon. And do you really need the absolute humidity? I mean, I can include them, however I don't think many users need them and this will only increase the list of optional forecast attributes.

@FL550 FL550 added the in progress Is beeing investigated or worked on label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Is beeing investigated or worked on
Projects
None yet
Development

No branches or pull requests

2 participants