meteotemplate php 8.0/8.1

Gerrit
Observer
Observer
Posts: 39
Joined: Wed Feb 06, 2019 1:31 pm
Station model: Vantage pro 2 plus
Software: Meteobridge
Contact:

Re: meteotemplate php 8.0/8.1

Post by Gerrit » Sat Oct 15, 2022 5:20 pm

@Gerrit
I think you still have the original climateIndices.php file try substituting with the attached one ( uncompress it in the pages/station directory )
Unfortunately still problems, could it be that I am overlooking more files?
https://www.waskolkweer.nl/meteotemplat ... ndices.php

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Oct 15, 2022 5:54 pm

@Gerrit
I upgraded PHP to 8.1.11 as I was having a log issue with 8.0 and I have the same issue with two pages

https://hurricanepub.com/pages/forecast/index.php



Deprecated: Function date_sunrise() is deprecated in E:\hurricanepub\header.php on line 141 Deprecated: Function date_sunset() is deprecated in E:\hurricanepub\header.php on line 142 Deprecated: Implicit conversion from float 2551442.8610880002 to int loses precision in E:\hurricanepub\scripts\functions.php on line 1218 Deprecated: Implicit conversion from float 2551442.8610880002 to int loses precision in E:\hurricanepub\scripts\functions.php on line 1218 Deprecated: Function date_sunrise() is deprecated in E:\hurricanepub\header.php on line 313 Deprecated: Function date_sunset() is deprecated in E:\hurricanepub\header.php on line 314 Warning: file_get_contents(https://api.openweathermap.org/data/2.5 ... cab1cf11d5): Failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in E:\hurricanepub\pages\forecast\index.php on line 77 Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in E:\hurricanepub\pages\forecast\index.php:109 Stack trace: #0 {main} thrown in E:\hurricanepub\pages\forecast\index.php on line 109

I am still getting this error 3 days after changing the key What am I missing

Code: Select all

{"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}
https://hurricanepub.com/pages/station/ ... ndices.php

Deprecated: Function date_sunrise() is deprecated in E:\hurricanepub\header.php on line 141 Deprecated: Function date_sunset() is deprecated in E:\hurricanepub\header.php on line 142 Deprecated: Implicit conversion from float 2551442.8610880002 to int loses precision in E:\hurricanepub\scripts\functions.php on line 1218 Deprecated: Implicit conversion from float 2551442.8610880002 to int loses precision in E:\hurricanepub\scripts\functions.php on line 1218 Deprecated: Function date_sunrise() is deprecated in E:\hurricanepub\header.php on line 313 Deprecated: Function date_sunset() is deprecated in E:\hurricanepub\header.php on line 314 Fatal error: Uncaught Error: Call to a member function format() on bool in E:\hurricanepub\pages\station\climateIndices.php:338 Stack trace: #0 {main} thrown in E:\hurricanepub\pages\station\climateIndices.php on line 338

I have changed the api key in main setup
Last edited by spd2612 on Tue Oct 18, 2022 12:32 pm, edited 3 times in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sun Oct 16, 2022 7:17 pm

It fixed it somewhat for me once I remembered to also change to openweathers api key which I did/Have and changed in Main Setup and then hit the refresh cache at the lower right of the of the outlook page. No errors come up on https://www.nicomaparkwx.com/wx/pages/f ... php?errors

@David. When I change to php 8.0 or 8.1 is when my site stops updating the Db. When I switch back to php 7.4 everything works fine. I can not find what the problem is and IONOS host is no help.

Will send credentials in private.
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Wed Oct 19, 2022 7:41 pm

Well got rid of the 401 from openweathermap error, but still not able to access
https://hurricanepub.com/pages/forecast/index.php or
https://hurricanepub.com/pages/station/ ... ndices.php
Everything else works, Im on PHP 8.1.11
the forcast index and climateindices are the newest ones that @davidefa has put out and its changed to openweathermap in main setup
I am guessing this is just how its going to be
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Wed Oct 19, 2022 9:35 pm

@davidefa

Well I found where the fatal error is but dont know how to fix it in Forcast/Index

Meteotemplate is calling

Code: Select all

https://api.openweathermap.org/data/2.5/onecall?lat=26.4648&lon=-81.8274&units=metric&appid=d652ede98033478481c733f05bc4a54a
Which returns a

Code: Select all

{"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}
In the browser, If I call

Code: Select all

https://api.openweathermap.org/data/2.5/weather?lat=26.4648&lon=81.8274&appid=d652ede98033478481c733f05bc4a54a
In the browser It returns data

So I changed

Code: Select all

$fIOURL = "https://api.openweathermap.org/data/2.5/onecall?lat=".$stationLat."&lon=".$stationLon."&units=metric&appid=".$fIOKey;
TO

Code: Select all

$fIOURL = "https://api.openweathermap.org/data/2.5/weather?lat=".$stationLat."&lon=".$stationLon."&units=metric&appid=".$fIOKey;
Its not pretty but the fatal error is gone
Still have multiple "Warning: Undefined array key "data" in"
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Thu Oct 20, 2022 9:27 pm

This is not pretty but it does get my climateindices.php to load
Of course there are still Deprecated: Function's but it will load I am not sure if some of these issues are comming with PHP 8.1.11 or not
At least im not getting a blank page

climateindices cause for fatal error commented out

Code: Select all

$temporary = round(array_sum($firstFrostDays)/count($firstFrostDays));
		$averageFirstFrost = DateTime::createFromFormat('z', $temporary);
		//$averageFirstFrostDay = $averageFirstFrost->format('j');
		//$averageFirstFrostMonth = $averageFirstFrost->format('n');
		//$averageFirstFrost = $averageFirstFrostDay." ".lang('month'.$averageFirstFrostMonth,'c');
	}
	if(count($lastFrosts)>0){
		foreach($lastFrosts as $start){
			$lastFrostDays[] = date("z",strtotime($start));
		}
		$temporary = round(array_sum($lastFrostDays)/count($lastFrostDays));
		$averageLastFrost = DateTime::createFromFormat('z', $temporary);
		//$averageLastFrostDay = $averageLastFrost->format('j');
		//$averageLastFrostMonth = $averageLastFrost->format('n');
		//$averageLastFrost = $averageLastFrostDay." ".lang('month'.$averageLastFrostMonth,'c');
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Fri Oct 21, 2022 5:12 pm

I got it all working except MPDF generation
pdf fails with this error, I can not find the reason why

Code: Select all

Fatal error: Uncaught TypeError: Mpdf\Mpdf::__construct(): Argument #1 ($config) must be of type array, string given, called in E:\hurricanepub\pages\forecast\forecastPDF.php on line 851 and defined in E:\hurricanepub\scripts\mpdf80\mpdf\mpdf\src\Mpdf.php:1032 Stack trace: #0 E:\hurricanepub\pages\forecast\forecastPDF.php(851): Mpdf\Mpdf->__construct() #1 {main} thrown in E:\hurricanepub\scripts\mpdf80\mpdf\mpdf\src\Mpdf.php on line 1032
Could this have something to do with me having metotemplate in the root without a template folder
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Fri Oct 21, 2022 8:21 pm

@ spd2612

When I access your page and run the cache reload icon at bottom right

https://hurricanepub.com/pages/forecast ... Cache=true

It seems to fix your page for awhile.

I had the same issue but still when I check a few hours later the issue is back.
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Fri Oct 21, 2022 9:11 pm

@ andyk1
@ davidefa
When I access your page and run the cache reload icon at bottom right

https://hurricanepub.com/pages/forecast ... Cache=true

It seems to fix your page for awhile.
The page seems to work but it will not create a PDF

Also the forcast on the mobile page is wrong only shows 32 deg for everthing
Last edited by spd2612 on Thu Oct 27, 2022 6:06 pm, edited 1 time in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Oct 22, 2022 2:47 am

Yep, for me either.
Image

juppie
Newbie
Newbie
Posts: 5
Joined: Wed Sep 13, 2017 5:40 pm
Station model: Davis Pro 2
Software: Weatherlink

Re: meteotemplate php 8.0/8.1

Post by juppie » Sat Nov 19, 2022 11:15 am

Hello Gerrit
Today I updated you to 8.1 php.
It works very well :)
Thank you very much
Hello juppie

juppie
Newbie
Newbie
Posts: 5
Joined: Wed Sep 13, 2017 5:40 pm
Station model: Davis Pro 2
Software: Weatherlink

Re: meteotemplate php 8.0/8.1

Post by juppie » Sat Nov 19, 2022 12:53 pm

Hi
I took the php8_1.0.zip for the first update,
and then on the second update with php8_1.1.zip it worked :)

http://wetter-lehmschlenke.de/template/indexDesktop.php
Last edited by juppie on Sat Nov 19, 2022 7:08 pm, edited 2 times in total.

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 1:11 pm

Im running PHP 8.1.11 and yes I have some warnings but my whole site works just fine
All plugins and blocks are not going to work correctly but you just have to decode what you can be happy with
Some of the plugins and blocks are so old that they should be removed as they are no longer updated
Dave has created a very nice add on that incorporates the block and plugin directory into the control panel unofficial blocks and plugins
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 2:26 pm

PHP 8.1.11 works for me also of many months of tinkering. Some block and plugins don't work for me (warningsUSRegions, ecowittModules and some minor) but overall I beat the Dec 31st deadline unless somethings change. You need to search (Upper right) through these treads to find the right answers to your problem.
Image

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 2:37 pm

@ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 2:53 pm

I will look and see what version im running
Im not home right now so it will be later
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 10:29 pm

andyk1 wrote: Sat Nov 19, 2022 2:37 pm @ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
warningsUSRegions.zip
(4.1 KiB) Downloaded 37 times
Unzip this to your homepage/blocks to see if it helps you its version 7
It is working on mine with PHP Ver. 8.1.11
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 10:43 pm

Andy You can see the warnings and it works as described on my site
but here is my page setup (NOW IM CONFUSED), It should not even be on my page, I did add it to the bottom as a test and it showed there to...

menuBlock(nws)
menuBlock(current)
menuBlock(stationData)
menuBlock(summary)
menuBlock(wind)
multipleBlock(webcam,50;videos,50)
multipleBlock(stationStatus,50;blank,50)
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 10:59 pm

spd2612 wrote: Sat Nov 19, 2022 10:29 pm
andyk1 wrote: Sat Nov 19, 2022 2:37 pm @ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
warningsUSRegions.zip

Unzip this to your homepage/blocks to see if it helps you its version 7
It is working on mine with PHP Ver. 8.1.11
Hi and Thank you. I just installed it and it's working. Not to just get my ecowitt Module working.

Oh My host is now using PHP 8.1.12. Not sure what the difference is.

THANK YOU.
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 11:03 pm

andyk1 wrote: Sat Nov 19, 2022 2:37 pm @ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
nws is a modified NWS Alerts - Saratoga Script it has to be edited but works flawlessly Im sure I replaced region warnings with it for that reason There are some notes in the zip

What you are seeing is my NWS BLOCK
nws.zip
(415.73 KiB) Downloaded 40 times
menuBlock(nws)
Last edited by spd2612 on Sat Nov 19, 2022 11:15 pm, edited 1 time in total.
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 11:06 pm

spd2612 wrote: Sat Nov 19, 2022 10:43 pm
but here is my page setup (NOW IM CONFUSED), It should not even be on my page, I did add it to the bottom as a test and it showed there to...

I just noticed that. Check you see if you have two different versions installed as a block. Shouldn't be able to be used twice without modification.

Also your live cam is now dead.
Image

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 11:08 pm

spd2612 wrote: Sat Nov 19, 2022 11:03 pm
andyk1 wrote: Sat Nov 19, 2022 2:37 pm @ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
What you are seeing is my NWS BLOCK
OK Got cha. I like your NWS better. Thanks again.
Image

andyk1
Professional
Professional
Posts: 431
Joined: Tue Feb 27, 2018 10:56 pm
Location: OKLAHOMA, USA
Station model: Ecowitt WS90
Software: Meteobridge/GW2000B
Contact:

Re: meteotemplate php 8.0/8.1

Post by andyk1 » Sat Nov 19, 2022 11:27 pm

Yeah I'm still trying to figure out your nws block as it's modified for your location. Reading through the read me now.
Image

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 11:37 pm

Thats always the problem I have so many modified scripts and programs I loose track when they just always work
I can look if you cant find it
I just had to write a script to read 80500 jason files to extract just the data i needed from the logs in mailwarebytes premium
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

spd2612
Forecaster
Forecaster
Posts: 165
Joined: Thu Jan 23, 2020 4:00 pm
Location: Fort Myers
Station model: WS-5000/GW1100
Software: ECOWITT Plugin
Contact:

Re: meteotemplate php 8.0/8.1

Post by spd2612 » Sat Nov 19, 2022 11:43 pm

spd2612 wrote: Sat Nov 19, 2022 11:03 pm
andyk1 wrote: Sat Nov 19, 2022 2:37 pm @ spd2612 I noticed your US regional warning block working. Mind sharing how you got it?
nws is a modified NWS Alerts - Saratoga Script it has to be edited but works flawlessly Im sure I replaced region warnings with it for that reason There are some notes in the zip

What you are seeing is my NWS BLOCK nws.zip

menuBlock(nws)
ok in NWS-ALERTS-CONFIG You will see what you need to change make sure you comment out Lee an Miami Dade unless you want my warnings

// ZONE CODES & COUNTY CODES CAN BE FOUND AT https://alerts.weather.gov/
// LOCATION|Z CODE|C CODE
// Note: this array will be overridden by the Settings.php $SITE['NWSalertsCodes'] entry if using the Saratoga Base-USA template set


$myZC = array(
"Lee County FL Details|FLC071",
"Miami-Dade FL Details|FLC086",
//"Cecil County|MDZ008|MDC015",
//"Harford County (Southeast)|MDZ508|MDC025",
//"Harford County (Northwest)|MDZ507|MDC025",
//"Kent County|MDZ012|MDC029",
//"New Castle County|DEZ001|DEC003",
//"Chester County (Eastern)|PAZ102|PAC029",
//"Lancaster County|PAZ066|PAC071",
//"Chesapeake Bay north of Pooles Island MD|ANZ530",
//"Chester County (Western)|PAZ101|PAC029"
);

make sure in main settings sections your path's are correct
Image

Ambient Weather WS-5000
Ultrasonic Anemometer
Thermo-Hygrometer Sensor WH31E
Soil Moisture Sensor WH31SM
Lightning Detection WH31L

Post Reply