Creating multiple weather locations and cards in Lovelace - is this possible?

I have a nice dark sky weather card defined and working for my location. But, I’d like to monitor and graph the temperatures from two other cities against my location. Is this possible? I don’t see options for multiple locations in these integrations… any help appreciated.

Hello, you can have multiple darksky locations but be carefull not to go over 1000 updates a day for the same API key (1000 are free after you have to have a paid account)… In the following example, 5 minutes for 2 cards means 576 updates a day < 1000.

Here is an example for my HA (two darksky cards) extracted (and modified) from my configuration.yaml. In this example you have two entities created called “weather.what_ever_1” and “weather.what_ever_2”… You can display them using lovelace…

weather:
  - platform: darksky
    api_key: YOUR_KEY
    latitude: YOUR_1st_LATITUDE
    longitude: YOUR_1st_LONGITUDE
    name: WHAT_EVER_1
    units: si
    mode: daily
    scan_interval: '00:05:00'
  - platform: darksky
    api_key: YOUR_KEY
    latitude: YOUR_2nd_LATITUDE
    longitude: YOUR_2nd_LONGITUDE
    name: WHAT_EVER_2
    units: si
    mode: daily
    scan_interval: '00:05:00'

If you want to display temperature from these two entities in lovelace (and keep history of the temperature changes), you have to create two template sensors (one per weather entity) with the temperature extracted from those two entities. example:

sensor:
  - platform: template
    sensors:
      temperature_1:
        friendly_name: "Temperature in city 1"
        unit_of_measurement: 'degrees'
        value_template: "{{ state_attr('weather.what_ever_1', 'temperature') }}"

  - platform: template
    sensors:
      temperature_2:
        friendly_name: "Temperature in city 2"
        unit_of_measurement: 'degrees'
        value_template: "{{ state_attr('weather.what_ever_2', 'temperature') }}"

Let me know if this is answering your question…

2 Likes

Great info, and all the sensors now show up for my 2 cities so that works fine!

but I’m struggling to get any custom cards to show up in Lovelace, even DarkSky. I’ve added all the entries to the raw Lovelace editor but how do you get the card to show so I can add it? It’s not listed in the options and I don’t know where to specify it. When I try to add a new card, this is all I see:


Dark Sky isn’t there. What am I missing? It has to be something simple.

My config:

  - platform: darksky
    api_key: !secret darkskyapikey
    name: boise
    latitude: 43.6112472
    longitude: -116.2115822
    units: si
#    mode: daily
    scan_interval: '00:05:00'
    forecast:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
    monitored_conditions:
      - icon
      - summary
      - humidity
      - temperature
      - temperature_high
      - temperature_low
      - daily_summary
         
  - platform: template
    sensors:
      temperature_boise:
        friendly_name: "Temperature in Boise"
        unit_of_measurement: 'degrees'
        value_template: "{{ state_attr('weather.boise', 'temperature') }}"

If I try and use the weather forecast card I get this:

And the entity isn’t available. This is a real head scratcher…

Jeff

I don’t know if this is related, but I just installed HACS and a dark theme but it’s not taking effect. I can’t change the themes. Is it possible my Lovelace config is corrupted somehow?

To display a weather card in lovelace I am using the custom weather card, you can install it using HACS (simple and easy to updatewhen new version is released)…
Here is the documentation:

Did you follow the installation steps ? … like for example adding reference to the theme or any other instruction to have HA recognizing your theme (generally with HACS installing is not the only step, you have to add some references manually sometimes), this is documented in the repository of theme you installed… Please check

I finally got it figured out. I had created two named instances and needed to reference those names in my config…, hours later…

image