After instaling the new update (v3.0) for the uvForecast block, I have noticed that it displays "OWN" (what would mean that it is displayng the UV value from my station).
It also shows a zero value all the time, instead of the forecasted darksky value, that should be displayed for stations without UV hardware.
I looked at the script, and I think that the problem is here:
Code: Select all
$apiData = file_get_contents("../../../meteotemplateLive.txt");
$apiData = json_decode($apiData, true);
if(array_key_exists("UV", $apiData)){
$uv = $apiData['UV'];
echo "own";
}
else{
$fIOURL = "https://api.darksky.net/forecast/".$fIOKey."/".$stationLat.",".$stationLon."?units=si&lang=".$fIOLanguage;
I had already noticed exactly the same problem with the currentBlock where the UV icon also shows up, displaying a permanent zero.
I checked the Meteotemplate setup where there is an option to tell if we have solar sensor (Yes or No), looking if I had missed to select any UV option (Yes or No), but there was no such option.
I only managed to solve the problem after removing the UV part from the currentBlock script.
Most probably the problem is this:
When Cumulus realtime.txt has the field UV=0, it is not possible to determine if this is a realtime UV value, or if it simply means that the station has no UV sensor.
Unfortunatelly, the API is going to read it as a realtime value and assume that the station has UV sensor.
This is the reason why MT is displaying the permanent zero value, both in currentBlock and in uvForecastBlock (and probably in other parts of MT).
Is there any way to solve this problem, other than removing the UV part from the scripts?
(The easiest way seems to be adding a UV Yes or No option in MT config, to complement the solar option it already has)






