Giter Club home page Giter Club logo

Comments (6)

Nardol avatar Nardol commented on May 31, 2024 1

Look like API have changed, see home-assistant/core#92197 (comment)
It also breaks météo France Home Assistant integration.

from meteofrance-api.

jpty avatar jpty commented on May 31, 2024 1

The Meteo France archives site can also be used to get vigilances:
http://storage.gra.cloud.ovh.net/v1/AUTH_555bdc85997f4552914346d4550c421e/gra-vigi6-archive_public/2023/07/08/
for today. Data is in the API format.
It was announced here : https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=305&id_rubrique=50

from meteofrance-api.

pzim-devdata avatar pzim-devdata commented on May 31, 2024 1

Here is my script in Bash :

  1. Go there :https://portail-api.meteofrance.fr/devportal --> Application to make a OAuth2 Key token
  2. Use your OAuth2 key :
    key="put_your_OAUth2_key_here"
    get_token=$(curl -k -X POST https://portail-api.meteofrance.fr/token -d "grant_type=client_credentials" -H "Authorization: Basic $key")
  3. Read token :
    IFS='"' read -ra token <<< "$get_token"
    ${token[3]}
  4. Get vigilance :
    curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H "accept: /" -H "Authorization: Bearer ${token[3]}"

Example for "Eure-et-loir" :

department=28
key="put_your_OAUth2_key_here"

get_token=$(curl -k -X POST https://portail-api.meteofrance.fr/token -d "grant_type=client_credentials" -H "Authorization: Basic $key")
IFS='"' read -ra token <<< "$get_token"
${token[3]}

title=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep).bloc_title')

dpt=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep).domain_name')

Risk :
a=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep) | .bloc_items[].text_items[].term_items[].risk_name')

Text : 
b=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep) | .bloc_items[].text_items[].term_items[].subdivision_text[].text[]')

Get a notification

#!/bin/bash
department=28
key="xxxxxxxxxxxxxxxxxxxxxxxxxx"
get_token=$(curl -k -X POST https://portail-api.meteofrance.fr/token -d "grant_type=client_credentials" -H "Authorization: Basic $key")

IFS='"' read -ra token <<< "$get_token"

title=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep).bloc_title')

dpt=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep).domain_name')

a=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep) | .bloc_items[].text_items[].term_items[].risk_name')

b=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}" | jq --arg dep "$department" '.product.text_bloc_items[] | select(.domain_id==$dep) | .bloc_items[].text_items[].term_items[].subdivision_text[].text[]')

#c=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}"| jq '.product.text_bloc_items[25].bloc_items[1].text_items[0].term_items[0].subdivision_text[0].text')

#d=$(curl -X GET "https://public-api.meteofrance.fr/public/DPVigilance/v1/textesvigilance/encours" -H  "accept: */*" -H  "Authorization: Bearer ${token[3]}"| jq '.product.text_bloc_items[25].bloc_items[2].text_items[0].term_items[0].subdivision_text[0].text')

IFS=',' str="$(echo -e "\nVIGILANCE POUR AUJOURD'HUI : \n\nRisque : "${a[@]} '\n'${b[@]})"
str=${str//[/}
str=${str//]/}
str=${str/ /  /}
str=${str//'"'/}
str=${str//null/}
str=${str//$'\n\n\n'/}
str=${str//$'. '/$'.\n\n'}

titre="$(echo $title en $dpt)"
titre=${titre//'"'/}
titre=${titre//'*'/}
titre=${titre//$'\n'/}

if [[ ( -z "${a[@]}" || "${a[@]}" == "null" ) && ( -z "${b[@]}" || "${b[@]}" == "null" ) ]]; then
    str="Pas de vigilance aujourd'hui"
fi


zenity --info --title "$titre" --text $str --icon-name weather-severe-alert-symbolic --ok-label "C'est bon, merci :-)"

from meteofrance-api.

pzim-devdata avatar pzim-devdata commented on May 31, 2024

I have the same problem :
alert=client.get_warning_full(domain="75")
alert.end_validity_time
1680667200 --> Wednesday, April 5, 2023 4:00:00 GMT
alert.update_time
1680595200 --> Tuesday, April 4, 2023 8:00:00 GMT

And today is June 12, 2023

from meteofrance-api.

bsegault avatar bsegault commented on May 31, 2024

I'd be willing to take a look at using the API v2 if no one is actually working on it.

I'll update this thread once I start to have something. Let me know if you have any other info or suggestions.

For now, I guess the first question is how to properly handle the token generation if it needs an account to be regularly re-generated...
I don't think that's an issue to request user credential from this library/API. But I don't know about the HA integration, I've never done it, so it would take me a while...

from meteofrance-api.

Quentame avatar Quentame commented on May 31, 2024

Does using API v3 is solving the issue ?
#680

from meteofrance-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.