petergridge / openweathermaphistory

A home assistant sensor that uses the OpenWeatherMap API to get forecast, current obs and history data
57 stars 5 forks source link

Units setting? #20

Closed loopy321 closed 9 months ago

loopy321 commented 1 year ago

Again, thanks for the work on this. In an effort to help troubleshoot, I have noticed that the units are not correct. See below with sensor set to "in" but apparently reporting "mm" (this is on v.2.08): 2023-06-08 19_55_18-Developer Tools – Home Assistant

petergridge commented 1 year ago

The attributes of the sensor are metric. But if you create a new sensor {{ day2rain }} for example and set the type 'precipitation' it will present as imperial on the sensor.

I am assuming you have the rainfactor calculation it probably should not be set to the device class of precipitation as it is only a factor, % to apply.

loopy321 commented 1 year ago

Thanks for the suggestion. I tried that, but the "type" does not set - I tried re-editing it and saving as precipitation, but does not work (keeps making it blank): 2023-06-08 20_08_53-Settings – Home Assistant

petergridge commented 1 year ago

Try adding a new sensor, rather than editing the existing one, I will check what is happening on the modify.

loopy321 commented 1 year ago

As a side note - the "add ons" disappeared from my "settings" home assistant menu with the most recent v2.08. Not sure why.

petergridge commented 1 year ago

I haven't experienced that. I just updated two devices rpi's to the version with no impact on the settings. Maybe a restart is required?

josephny commented 1 year ago

I am unable to get results to show in imperial either.

petergridge commented 1 year ago

Hi @josephny ,

I hope this helps:

All data is captured in metric measurements.

To see the information in your local unit of measure:

Note Unit of measure is not applied to attributes, it is applied only to the sensor state. Attribute values are supplied as metric values. HA recommends that rapidly changing attributes are not used on sensors as this impact the history capture, instead create multiple sensors.

petergridge commented 1 year ago

Hi, I'm after opinions/requests for the next release of this. No promises on a timeline though. This is just a requirements, wish list exercise at the moment.

This is what I am proposing:

  1. Allow the selection of, rain, snow, min, max... to automatically create sensors for the number of days configured. This will limit the configuration required to only the complex but could blow out the number of sensors exposed on your system. This will also resolve the unit of measure being metric in the attributes.
  2. Modify the custom card to display based on the created sensors - I haven't thought the UI through yet so this is a little aspirational as I am not a good UI developer.

Are there any request that I can add to the backlog, happy to consider, but can't promise on delivery 😄