Paragliding Weather API into sensor - sharing for others to use and improvement!

Hi
While the overlap between paragliding and home assistant is probably small I thought I’d share a little viz I did, connecting the paraglidable API to a home assistant sensor. I am very new to HA and have done little with JSON so ideas on how to improve would be great - but it works :slight_smile:

The end result is a little widget that sits on top of my weather cards:

or a bigger version here

This corresponds to the paraglideable ‘can I fly’ metric provided by the API for a defined location (in the API - in my case near my house) i.e. 100% is a perfect day and 50% is marginal. The idea is that this sits on my HA wall panel and acts as a prompt to go and look at more info (and take the day off!)

I feel like I ought to be able to combine the sensors into a single chart - but this is beyond me if anyone has a steer on this part!

Step 1:
Create the API on the paraglideable website for the location you want - paraglideable provides in XML or JSON format. jsonpathfinder is very helpful for unpicking the template

Step 2:
Create rest sensors in home assistant.

Mine is setup so my config.yaml contains

sensor: !include sensor.yaml

And the sensors are then set up in sensor.yaml as shown below. There is one sensor each for today and the following 3 days

Today:

- platform: rest
  name: Paraglidable API Sensor Today
  resource: https://paraglidable.com/apps/api/get.php?key=YOURAPIKEY&format=JSON&version=1
  value_template: "{{ (value_json[(as_timestamp(now())) | timestamp_custom('%Y-%m-%d', true)][0].forecast.fly * 100) | round(0) }}"
  json_attributes:
    - date
    - forecast
    - name
  scan_interval: 300

And three with an offset to pick up the following days (repeated x 3 with the name and the offset (86400 in this example) changed :

- platform: rest
  name: Paraglidable API Sensor +1
  resource: https://paraglidable.com/apps/api/get.php?key=YOURAPIKEY&format=JSON&version=1
  value_template: "{{ (value_json[(as_timestamp(now()) + 86400) | timestamp_custom('%Y-%m-%d', true)][0].forecast.fly * 100) | round(0) }}"
  json_attributes:
    - date
    - forecast
    - name
  scan_interval: 300

Step 3:
Create the lovelace card - I’ve used mushroom cards for this (which is excellent) and mushroom chips for the small version

type: custom:mushroom-template-card
secondary: '{{ states("sensor.paraglidable_api_sensor_today") }} %'
icon: |-
  {% if states('sensor.paraglidable_api_sensor_today')|float(0) > 90 %}
    mdi:numeric-9-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 80 %}
    mdi:numeric-8-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 70 %}
    mdi:numeric-7-circle                        
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 60 %}
    mdi:numeric-6-circle  
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 50 %}
    mdi:numeric-5-circle                            
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 40 %}
    mdi:numeric-4-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 30 %}
    mdi:numeric-3-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 20 %}
    mdi:numeric-2-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 10 %}
    mdi:numeric-1-circle
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 0 %}
    mdi:numeric-0-circle               
  {% else %}                                                              
    mdi:battery-outline                                                 
  {% endif %}  
icon_color: |-
  {% if states('sensor.paraglidable_api_sensor_today')|float(0) > 90 %}
    green
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 80 %}
    green
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 70 %}
    green                       
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 60 %}
    green 
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 50 %}
    amber
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 40 %}
    amber
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 30 %}
    amber
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 20 %}
    red
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 10 %}
    red
  {% elif states('sensor.paraglidable_api_sensor_today')|float(0) > 0 %}
    red           
  {% else %}                                                              
    blue                                                 
  {% endif %}   
layout: vertical
multiline_secondary: true
primary: ''

Next steps (if anyone has any bright ideas!) - would love to combine into a single sensor so i can show as a chart, or similar, rather than 4 sensors and 4 cards.

Hope someone finds this helpful!

1 Like

This looks interesting and I’d like to do something similar in the UK. But I have no idea how to start.
Your step 1 has stumped me because I don’t know what “create an API” even means and your paraglideable website looks to cover France only.

I’ve seen these devices https://windcast.app/ that show it must be possible.

Can you provide some greater clues as to how I can get going. Once I’ve got the basic data into HA I could probably code what I want from there.