[Support request] Yahoo weather doesn`work anymore

Free domotica! Forums Report a bug Yahoo weather doesn`work anymore

This topic contains 4 replies, has 2 voices, and was last updated by Avatar djandib 3 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12032
    Avatar
    djandib
    Participant

    Hi,
    my service yahoo weather doesn`t work since 4th of January.
    I already deleted the service and reinstalled it, but no change 🙁

    Has anybody an idea?

    Andi

    #12033
    Avatar
    LaplaceII
    Participant

    Hello, Yahoo stopped the free weather API on the 3rd of January. A Workaround for PS is needed….I informed PS responsibles some days ago. Without weather API a lot of home automation logics will not work…e.g. roller shutter in dependence of Sunrise…some home Automation Software calculate data like Sunrise Time by themselves only by giving GPS coordinates…this makes the home Automation software independet from external APIs…(just an idea 😉)

    #12034
    Avatar
    djandib
    Participant

    What about this?
    https://openweathermap.org/api/weather-map-2

    Maybe it`s possible to build a new service like PushOver with every users own API-Key etc..

    #12036
    Avatar
    djandib
    Participant

    Workaround (at least for “Sunset” & “Sunrise”)
    1) New Scene “sunset”: IF manually startet, THEN PHP-Block: file_put_contents(‘sunset’,date(“H:i”));
    2) Add in Prescene “_Variables”:
    $sunset = file_get_contents(‘sunset’, FILE_USE_INCLUDE_PATH);

    3) In all other scenes you can now work just with the variable $sunset
    4) IFTTT: IF WeatherUndergrund = Sunset, THEN make Webhook to Pulse-Station start Scene “sunset.xml”

    If you need more infos, give me a hint

    Andi

    #12041
    Avatar
    djandib
    Participant

    Hi there!
    I found a solution for using a weather API.

    1) register at https://openweathermap.org/
    2) you will get a API-key
    3) look for your loacal ID (e.g. Munich=2867714)
    4) use this code in a PHP-Blockly:
    $url = ‘http://api.openweathermap.org/data/2.5/weather?id=2867714&appid=YOUR_API-KEY&units=metric&lang=de’;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    ‘Accept json/html’, ‘Content-Type text/html’
    ));
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 90);
    $output = curl_exec($ch);
    curl_close($ch);
    $filename = ‘OpenWeather.json’;
    file_put_contents(“./”.$filename, $output);
    5) you will get a file OpenWeather.jason
    6) Use use this code in a PHP-Blockly for using the weather-datas:
    $filename = ‘OpenWeather.json’;
    $weather_json = file_get_contents(“./”.$filename);
    $weather = json_decode($weather_json);

    $weatherID = $weather->weather[0]->id;
    $weatherMain= $weather->weather[0]->main;
    $weatherDescription=$weather->weather[0]->description;

    //Umwandeln von Zeitstempel zu Stunden Minuten Sekunden
    $sunrise = date(‘H:i:s’, $weather->sys->sunrise);

    Good luck.

    If you can have any questions feel free to ask

    Andi

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.