Lovelace: Weather card with chart

haha, not necessary, you can see any location using that service

just enter your location, scroll down a bit and click the


option

then use that as image for your generic camera card

  - type: picture-entity
    card_mod:
      style: |
        ha-card {
          {{'filter: invert(90%)' if is_state('binary_sensor.dark_outside','on')
             else 'filter: none'}} ;
        }
    show_state: false
    show_name: false
    entity: camera.weer_roosendaal
    hold_action:
      action: url
      url_path: https://www.yr.no/en/forecast/graph/2-2747930/Netherlands/North%20Brabant/Roosendaal/Roosendaal
1 Like

Yeah, thanks I was only kidding. I have set it up for London and will think of some other custom stuff in the meantime :smile:

I put together something similar with apex charts. Not perfect, as it slides around the ticks of the days, but thatā€™s how far I could get it.

type: custom:apexcharts-card
graph_span: 6d
span:
  start: hour
  offset: '-0h'
header:
  show: true
  title: Wetterorhersage
  show_states: false
all_series_config:
  stroke_width: 5
  group_by:
    func: last
    duration: 1d
now:
  show: false
apex_config:
  legend:
    show: false
  xaxis:
    labels:
      format: ddd
    tooltip:
      enabled: false
  tooltip:
    x:
      format: ddd dd. MMM.
yaxis:
  - id: temp
    min: ~0
    max: ~30
    decimals: 0
series:
  - entity: weather.home
    name: min.
    yaxis_id: temp
    unit: Ā°C
    type: line
    color: green
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.templow];
      });
    show:
      datalabels: false
  - entity: weather.home
    name: max.
    yaxis_id: temp
    unit: Ā°C
    type: line
    color: red
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.temperature];
      });
    show:
      datalabels: false
  - entity: weather.home
    name: Regen
    yaxis_id: mm
    unit: mm
    type: column
    color: blue
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.precipitation];
      });
    show:
      datalabels: true

grafik

2 Likes

This is really good. Thanks!!

Why does Weather-Chart-Card works fine in Edge and Mobile-app, but not in Firefox ?

Because it has not been updated for a year.

haha, yeah i know, thou it was mend from a technical perspective :wink: ā€¦ it must have been some ā€œupdateā€ here in ha, that caused it to fail ( or FF update, what do i know )

:man_shrugging: I donā€™t know enough about web browsers to say. If I did Iā€™d fork it and fixit.

1 Like

I just manage to get it back in Firefox 110

Not sure exactly what step did it, so if someone wanna give it a try this is my little findings:

  1. First of all, i use a fork by " greendog99 (Mike Fischer) Ā· GitHub "
  2. before editing any file, do a full history-clear ( browsing, download, cache )
  3. if nothing change, then check whether you have only 1 place for the ā€œjs-fileā€ , somehow in FF debugger, i had an ā€œadditionalā€ outside /hacs-files , and that was /local/comā€¦ ( Thou that was not what the ā€œResources in Lovelaceā€ said ), there i only had /hacsfiles/ā€¦
  4. in that file i edited 2nd row, as it appeared that in my case, it only said ā€œWEATHER-CHARTā€ so i change to WEATHER-CHART-CARD

first

Id added and modded to my satisfaction :slight_smile:

apexchart

1 Like

looks way better :smiley:
would you mind, sharing the yaml?

1 Like

well i actually combined it with a part of weather-chart-card, but i guess you could use another, then you just have to figure out how/where to hide the elements yo dont want :slight_smile: ā€¦ itā€™s not an optimal ā€œsolutionā€, itā€™s more like a dirty Trick N Cheat :slight_smile:

EDIT: i changed the span:start and the offset: as well

type: custom:apexcharts-card
graph_span: 5d
span:
  start: day
  offset: +1d
header:
  show: false
  show_states: false
all_series_config:
  stroke_width: 3
  group_by:
    func: last
    duration: 1d
now:
  show: true
apex_config:
  plotOptions:
    bar:
      columnWidth: 30%
  legend:
    show: true
  xaxis:
    labels:
      format: ddd
    tooltip:
      enabled: false
  tooltip:
    x:
      format: ddd dd. MMM.
yaxis:
  - id: temp
    min: auto
    max: auto
    decimals: 0
series:
  - entity: weather.forecast_home
    name: min.
    yaxis_id: temp
    unit: Ā°C
    type: line
    color: green
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.templow];
      });
    show:
      datalabels: false
  - entity: weather.forecast_home
    name: max.
    yaxis_id: temp
    unit: Ā°C
    type: line
    color: '#FFBF00'
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.temperature];
      });
    show:
      datalabels: false
  - entity: weather.forecast_home
    name: Precip
    yaxis_id: mm
    unit: mm
    type: column
    color: '#6495ED'
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.precipitation];
      });
    show:
      datalabels: true

Here are Hourly, for current day( or itā€™s a actually 24hours-view ā€œ-1hā€ ), with wind-speed instead of temp-low

hourly

1 Like

Dude, make a github repo for this, I love it!

Well the Credit should go to @PulsarFX above, as i first installed apex-charts after seeing his example above, so my ā€œcontributionā€ comes down to just a little fiddling around, in settings. but it also have to be adapted to the other cards in ones view ( as it is now, with the weather-chart-card, in bottom )
The Hourly part is ā€œstand alone apex-chartā€ ā€¦ also based upon PulsarFX work

type: custom:apexcharts-card
graph_span: 24h
span:
  start: hour
  offset: '-1h'
hours_12: false
header:
  show: false
  show_states: false
all_series_config:
  stroke_width: 3
  group_by:
    func: raw
    duration: 30m
now:
  show: true
apex_config:
  plotOptions:
    bar:
      columnWidth: 30%
  legend:
    show: true
  xaxis:
    labels:
      format: hhh
    tooltip:
      enabled: false
  tooltip:
    x:
      format: ddd dd. hhh. mmm.
yaxis:
  - id: temp
    min: auto
    max: auto
    decimals: 0
series:
  - entity: weather.forecast_home_hourly
    name: Wind m/s
    yaxis_id: wind_speed
    unit: m/s
    type: line
    color: green
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.wind_speed];
      });
    show:
      legend_value: false
      datalabels: false
  - entity: weather.forecast_home_hourly
    name: Temp Ā°C
    yaxis_id: temp
    unit: Ā°C
    type: line
    color: '#FFBF00'
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.temperature];
      });
    show:
      legend_value: false
      datalabels: false
  - entity: weather.forecast_home_hourly
    name: Precip mm
    yaxis_id: mm
    unit: mm
    type: column
    color: '#6495ED'
    data_generator: |
      return entity.attributes.forecast.map((entry) => 
      {
        var date = new Date(entry.datetime);
        
        return [date, entry.precipitation];
      });
    show:
      legend_value: false
      datalabels: false

ā€¦ and i really donā€™t know how to make a ā€œrepoā€, i did ā€œforkā€ some i was interested in/using ( also went through your weather-chart-fork ) :wink:

Ah didnā€™t notice that this was apex-charts based. Thought it was still somehow based on the original card. Nice that we have some options as the original card is getting hard to maintain.

1 Like

We have the Share your projects! Category for this. Donā€™t let it get buried in this abandoned topic please.

Do you also show the days in vertical columns like the former card did? Personally I always try to take out those horizontal grid lines but itā€™s hard using apex in a clean way for me.
Maybe you canā€¦

I just started with this apex-chart, thou i will look into it, im sure it should be easy to remove the horizontals lineā€¦ im about to combine both, in a vertical-stack, and use ha-native met.no_ weather-home ( instead of weather-chart-card ) for the ā€œconditionsā€ ā€¦ i could post it in ā€œShare your Projectā€ now that you mention it ā€¦ currently still struggling with ā€œurlā€ to external icons for the native " Met.no weather-home"

apex_config:
  grid:
    borderColor: none

remove lines ...

    apex_config:
      grid:
        xaxis:
          lines:
            show: Boolean
        yaxis:
          lines:
            show: false
vertical lines


PS: itā€™s not ā€œtodays hourlyā€ anymore , i changed it to 24hours ahead -1h

apex_config:
   grid:
     strokeDashArray: 0 

Full-lines instead of dots !

wonderful!

now add column titles (days/dates) and itsā€™ perfect :wink:

thank you!!