allebb / pirrot

A radio repeater controller (supporting both simplex and duplex operation modes) for the RaspberryPi.
https://pirrot.hallinet.com
57 stars 13 forks source link

Fix Weather Reports Don't Updated #47

Closed pantgr closed 2 years ago

pantgr commented 2 years ago

If the Pirrot service start, update the weather as expected , but never look for weather updates , play's forever the same weather mp3, with this change works as expected , tested and works on my local rpi , please check if my change is correct, i have no idea of php programing at all :P. Big Thanks for this project i love it :)

pantgr commented 2 years ago

Thanks again for the good work

allebb commented 2 years ago

Hey @pantgr thanks for this PR too... I'll have to investigate further before merging this one specifically though as it should work fine -I'm concerned that this could be caused by something else (potentially a red herring) I will investigate and sort it this weekend.

Thanks for your kind words regarding the project - I'm pleased to hear you love it! 👯

pantgr commented 2 years ago

hi allebb i agree with your opinion , also if helps, working on the first install if reboot the rpi and not stop start the pirrot services , next stop working compliantly ( only the weather ). Reboot and notice that the service start to early as a resold the networking is down, May 19 19:27:03 raspberrypi pirrot[429]: sh: 1: echo: echo: I/O error May 19 19:27:03 raspberrypi pirrot[431]: sh: 1: echo: echo: I/O error May 19 19:27:03 raspberrypi pirrot[451]: sh: 1: echo: echo: I/O error May 19 19:27:03 raspberrypi pirrot[460]: sh: 1: echo: echo: I/O error May 19 19:27:03 raspberrypi pirrot[351]: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for api.openweathermap.org failed: Temporary failure in name resolution in /opt/pirrot/app/Services/WeatherService.php on line 60 May 19 19:27:03 raspberrypi pirrot[351]: PHP Warning: file_get_contents(https://api.openweathermap.org/data/2.5/weather?q=Kastoria,GR}&units=metric&appid=*****): Failed to open stream: php_network_getaddresses: getaddrinfo for api.openweathermap.org failed: Temporary failure in name resolution in /opt/pirrot/app/Services/WeatherService.php on line 60 May 19 19:27:04 raspberrypi dhcpcd[326]: eth0: carrier acquired then add a "sleep 20" in /etc/init.d/pirrot , fix the weather to start on boot , but repeat the same weather mp3 file. This message in daemon log exist only if reboot (with stop start services is ok no errors but play's the same file) : sh: 1: echo: echo: I/O error sh: 1: echo: echo: I/O error sh: 1: echo: echo: I/O error sh: 1: echo: echo: I/O error

Then start try to reinstall, reconfigure everything, but nothing. After lot of testing and play with the config files, start to explore the php :P , add a custom log to see what is going wrong...

this is a example how works, after add this pach

        if ($broadcastWeather) {
            // $this->writeln($this->getCurrentLogTimestamp() . ' REPORT 0 ');
            $customWxFile = $this->announceWeather();

    if (file_exists($filename)) {

    // $this->writeln($this->getCurrentLogTimestamp() . ' REPORT 1 ');

    return $filename;
    }

    // $this->writeln($this->getCurrentLogTimestamp() . ' REPORT 2 ');

    $output = $ttsService->download($report);
    file_put_contents($filename, $output);
    return $filename;

2022-05-21T09:15:10+03:00 - REPORT 0 2022-05-21T09:15:11+03:00 - REPORT 1 2022-05-21T09:16:37+03:00 - REPORT 0 2022-05-21T09:16:37+03:00 - REPORT 1 2022-05-21T09:18:04+03:00 - REPORT 0 2022-05-21T09:18:04+03:00 - REPORT 1 2022-05-21T09:19:31+03:00 - REPORT 0 2022-05-21T09:19:31+03:00 - REPORT 1 2022-05-21T09:20:57+03:00 - REPORT 0 2022-05-21T09:20:58+03:00 - REPORT 1 2022-05-21T09:22:24+03:00 - REPORT 0 2022-05-21T09:22:24+03:00 - REPORT 1 2022-05-21T09:23:51+03:00 - REPORT 0 2022-05-21T09:23:51+03:00 - REPORT 1 2022-05-21T09:25:18+03:00 - REPORT 0 2022-05-21T09:25:18+03:00 - REPORT 2

The REPORT 0 - REPORT 2 show only ones with out this pach if the parrot services stop start. Test is on rpi 2 with pi-hole dns server only installed.

best regards pantelis

pantgr commented 2 years ago

Hello again, now run's half a day and working perfect , but i notice something else on my weather web log and is possible help you, the last weather file on rpi have time 15:35:40, file not change from open weather host but the web report the same time on both columns (Reported - Broadcast) 16:06 and this is the time to play live.

(Fixted with manymiles pach)

best regards pantelis

pantgr commented 2 years ago

hello again, close the pull now works as expected, the problem is on "Text-To-Speech Template" looking working but has bug, same time's the weather files came's in /opt/pirrot/storage/tts as 0 files size .... that trigger me to change the txt message (from "Καιρικές συνθήκες {description}. θερμοκρασία είναι {temp_c} βαθμοί Κελσίου. άνεμοι είναι στα {wind_mph} μίλια την ώρα με κατεύθυνση {wind_dir_cardinal}. Η υγρασία είναι {humidity} τοις εκατό . Η πίεση είναι {pressure} εκτοπασκάλια. " to "Καιρικές συνθήκες.{description}.θερμοκρασία είναι.{temp_c}.Bαθμοί Κελσίου.Aνεμοι είναι στα.{wind_kph}.Xιλιόμετρα την ώρα με κατεύθυνση.{wind_dir_cardinal}.Η υγρασία είναι.{humidity}.Tοίς εκατό.Η πίεση είναι.{pressure}.Eκτοπασκάλια." and fixted