aukedejong / lovelace-windrose-card

Home Assistant Lovelace Windrose Card
102 stars 3 forks source link

Calculates the wind direction only on changes #64

Closed seg-on closed 1 month ago

seg-on commented 4 months ago

It calculates the wind direction only if the wind direction changes. So if there was a change of wind two times in the average day and N blew 23h and NW 1h in the graph it will be shown as N 50% and NW 50%. The wind direction is stored in the form of letters.

Last 24h Direction: image

Windorse card: image

It is possible to fix it?

aukedejong commented 2 months ago

I understand the problem. Maybe switching the matching-strategy from direction-frist (default) to speed-first. It also depends on how much speed updates your sensor reports.

seg-on commented 2 months ago

Hi @aukedejong, I'm scraping data from the website and it only stores changes. The database only stores data when the direction or speed is changed. Changing the match strategy won't solve the problem because the wind speed is stored in the same way.

aukedejong commented 2 months ago

Thanks for explaining. To support this, we need an new matching strategy.
A strategy that determines for every times step the last known values. The time step size and how far back in time can be configured. Now I think about it, maybe this strategy wil create the better graphs.

I hope I can find time to work in this.

aukedejong commented 1 month ago

I added the time_frame match strategy in version 1.10.0. Can you let me know what the result are?

seg-on commented 1 month ago

Hi Thank you. I changed the matching strategy but now it does not give me any result. image

I may have done something wrong in my configuration:

type: custom:windrose-card
title: 24h
data_period:
  hours_to_show: 24
max_width: 600
refresh_interval: 300
windspeed_bar_location: bottom
windspeed_bar_full: false
wind_direction_entity:
  entity: sensor.shmu_pn_smer
  direction_unit: letters
  direction_letters: SVJZX
  use_statistics: false
windspeed_entities:
  - entity: sensor.shmu_pn_vietor
    name: rýchlosť
    speed_unit: mps
    use_statistics: true
output_speed_unit: mps
input_speed_unit: mps
speed_range_beaufort: false
cardinal_direction_letters: SVJZ
matching_strategy: time-frame
center_calm_percentage: false
speed_range_max: 20
speed_range_step: 1
aukedejong commented 1 month ago

Justed tested it with an 'letters' sensor. Normally I use the 'degrees' sensor. There seams to be a bug related to letter sensors... Sorry, I will fix this.

aukedejong commented 1 month ago

Fixed in version 1.11.0 Can you try again?

seg-on commented 1 month ago

Great. Looks like it works. Thank you :) image image