Extending extra sensor table

Post Reply
davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Extending extra sensor table

Post by davidefa » Thu May 13, 2021 10:14 pm

ver 1.0

I have extended the support of extra sensor of meteotemplate to 8 sensors of the following ( it was limited to 4 ) :
T1-8 ( extra temperature )
H1-8 ( extra humidity )
TS1-8 ( soil temperature )
SM1-8 ( soil moisture )
LW1-8 ( leaf wettness )
LT1-8 ( leaf temperature )
CO2_1-8
NO2_1-8
SO2_1-8
O3_1-8
CO_1-8
PP1-8 ( particulate pollution )
If you want to save in the database more than 4 extra temperature sensors ( for example to graph these sensors ) this is for you.
You don't need this mod if you only need the 'last value' of these extra sensors as this is already available through the file meteotemplateLive.txt ( many blocks use this )

Simply expand the file in the root folder of meteotemplate ( it will overwrite the files api.php, update/apiSetup.php and update/saveAPISettings.php )

ver 1.1a

Minor update: corrected LD/LT saving in update/apiSettings.txt and added an option ( $logGetPost on line 33 ) to enable logging of the api.php call with get/post parameters ( cache/apiReqLog.txt )

ver 1.1b

Minor update: added ET ( evapotranspiration ) to extra sensor table
Attachments
sensors8_1.1b.zip
(17.97 KiB) Downloaded 132 times
sensors8_1.1a.zip
(17.82 KiB) Downloaded 101 times
sensors8_1.0.zip
(17.61 KiB) Downloaded 91 times
Last edited by davidefa on Fri Dec 10, 2021 2:28 pm, edited 1 time in total.
Image

MJW
Advisor
Advisor
Posts: 60
Joined: Sun Dec 24, 2017 2:22 pm
Station model: AW WS-2000ish
Software: Meteobridge/OIP/GW-1000
Contact:

Re: Extending extra sensor table

Post by MJW » Sat Jul 17, 2021 11:45 pm

Thanks, using these now, I'll see how it goes.
So many trees in NJ!

Image

mchd17
Forecaster
Forecaster
Posts: 188
Joined: Sat Mar 17, 2018 2:01 am
Location: Illinois
Station model: Davis Pro2 Plus
Software: Meteobridge

Re: Extending extra sensor table

Post by mchd17 » Wed Dec 01, 2021 12:06 am

Thanks for sharing
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: Extending extra sensor table

Post by andyk1 » Tue Aug 30, 2022 12:44 am

Hi David!!!

I seem to be having a slight problem with the 8 extra sensor update as it's only showing 7 temp and hum sensors. Number 8 is missing from the api viewer and the extra sensor data base. Looked through all the updated php files and not sure where else to look.

If you look at my site www.nicomaparkwx.com Indoor Sensors block toward the bottom center block you'll see num 8 indoor temp and hum are missing which is labeled NorthEast Crawlspace is not showing but that's because it's also not in the extra data base.

It added the extra sensors T1-T7 and H1-H7 but not number 8.

Any help would be appreciated.
Attachments
extradatabase1
extradatabase1
extradatabase1.png (22.78 KiB) Viewed 1934 times
Extrasensors
Extrasensors
Extrasensors.png (91.39 KiB) Viewed 1934 times
Apiviewer
Apiviewer
APIVIEWER.png (55.62 KiB) Viewed 1934 times
Image

User avatar
Dehatter
Professional
Professional
Posts: 349
Joined: Sun Jan 07, 2018 5:11 am
Location: Matthews, NC, USA
Station model: Ecowitt WH80
Software: Ecowitt GW1000
Contact:

Re: Extending extra sensor table

Post by Dehatter » Tue Aug 30, 2022 6:53 pm

Did you try sensor H0 and T0?

I think, and I could be totally wrong, but the first sensor is 0, so the 8 would be 0-7 or (0 1 2 3 4 5 6 7).

Tom
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: Extending extra sensor table

Post by andyk1 » Tue Aug 30, 2022 10:09 pm

Hi Tom!

And you know what...I thought of that but was afraid to change it due to rearranging the sensor inputs and throwing the Db's out of wack. Need to find a way to test it but like you I'm no where close to a PHP expert... yet :)

I used to know how to back up the Db's on 1and1's side but it's been awhile and tricky.

I'll try that somehow but would like someone with more knowledge in PHP and to chime in but good catch TOM.

My more serious concern is changing to php 8.0 or 8.1 before Dec 31th as I have had no luck so far. Stuck on 7.4 and updated blocks and plugin's as I go and reading what I can here but it's so scattered out it's hard to find the info I need.

Working on a way I can gather what I find and consolidate it in a new section to help everyone but of course I need Jachym to chime in before I start on that.

Update @ 9:38pm 8-30-2022

I have no idea what I did or changed as I've updated, modified, changed, installed numerious api.php, blocls and plugin's files and even changed back to previous versions but my 8th indoor Ecowitt WH31 is now working on MT.

Wish I'd remember what I changed but I don't. My best guess is David's AMAZING mods and work

Now only thing is look at when it started and try to remember what I was doing. If I figure it out I will post an update.
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: Extending extra sensor table

Post by andyk1 » Wed Aug 31, 2022 3:10 am

OK as I said before... I have the 8th WH31 working but noticed in the db and MT it is out of order.
Top Header
Top Header
tableEditExtra.php_2022-08-30 215327.png (30.95 KiB) Viewed 1918 times
Bottom Header
Bottom Header
tableEditExtra.php-2-2022-08-30 215619.png (14.47 KiB) Viewed 1918 times
It has been years since I've messed with rearranging the header but does anyone know how I can move the T8 and H8 into the proper order (next to T7-H7)?

If anyone is wondering why I only captured one line at the bottom is because I didn't have Save in database on in the /update/apiSetup.php Located in the (Control Panel under Extra sensors) because I didn't know it was working.
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Extending extra sensor table

Post by davidefa » Wed Aug 31, 2022 10:11 pm

Not sure your T8/H8 sensor are ( always ) sent ( to api.php ) as they do not appear in cache/apiLog.txt ( checked several times, but no T8/H8 data was present ).
My extra t/h sensors are battery powered, so I'd say check batteries ( if yours are battery powered too ), check power connectors or other causes that may, sometime, block the sensor.

Regarding rearranging fields order you can do it in phpmyadmin ( select table, structure->move columns ).
DateTime field ( the primary key field ) should be the first ( for performance reason ).
The other fields should be ordered by importance/requests ( the most requested first, but with meteotemplate, I think, all sensors have same importance/requests )

Code: Select all

2022-08-31 15:42:30
INFOS:
Authorized access.
Current date/time: 2022-08-31 15:42:30
api called by http
update U: 1661978098
update SW: meteobridge
update T: 32.6
update TMX: 32.6
update TMN: 32.6
update H: 50
update P: 1016.4
update W: 5.4
update G: 5.4
update B: 8
update R: 0.0
update RR: 0.0
update S: 474.0
update UV: 5.0
update TIN: 22.2
update HIN: 51
update T1: 21.3
update H1: 54
update T2: 22.0
update H2: 51
update T3: 21.7
update H3: 57
update T4: 22.5
update H4: 62
update T5: 25.4
update H5: 49
update T6: 21.9
update H6: 86
update T7: 18.1
update H7: 77
update SM1: 35.0
update SM2: 33.0
Begin of common part of api script
Start handling live data
Checking if extra sensors should be logged
Extra sensors data to save in db: TIN, HIN, UV, L, LD, LT, ET, T1, H1, SM1, PP1, T2, H2, T3, H3, T4, H4, T5, H5, T6, H6, T7, H7, T8, H8
add live data: L: 0
add live data: LD: 1
add live data: LT: 1661817695
add live data: PP1: 6
add live data: WBAT: 3
add live data: RBAT: 
add live data: LBAT: 5
add live data: PP1BAT: 
add live data: SM1BAT: 1.5
add live data: SM2BAT: 1.5
add live data: T1BAT: OK
add live data: T2BAT: OK
add live data: LTime: 1661978520
add live data: LDTime: 1661978520
add live data: LTTime: 1661978520
add live data: PP1Time: 1661978520
add live data: WBATTime: 1661978520
add live data: RBATTime: 1661978520
add live data: LBATTime: 1661978520
add live data: PP1BATTime: 1661978520
add live data: SM1BATTime: 1661978520
add live data: SM2BATTime: 1661978520
add live data: T1BATTime: 1661978520
add live data: T2BATTime: 1661978520
add live data: D: 20.9
add live data: DTime: 1661978547
add live data: A: 35.3
add live data: ATime: 1661978547
calculated D: 20.9
calculated A: 35.6
Save meteotemplateLive.txt: {"U":1661978098,"SW":"meteobridge","T":32.6,"TMX":32.6,"TMN":32.6,"H":50,"P":1016.4,"W":5.4,"G":5.4,"B":8,"R":0,"RR":0,"S":474,"UV":5,"TIN":22.2,"HIN":51,"T1":21.3,"H1":54,"T2":22,"H2":51,"T3":21.7,"H3":57,"T4":22.5,"H4":62,"T5":25.4,"H5":49,"T6":21.9,"H6":86,"T7":18.1,"H7":77,"SM1":35,"SM2":33,"UTime":1661978550,"SWTime":1661978550,"TTime":1661978550,"TMXTime":1661978550,"TMNTime":1661978550,"HTime":1661978550,"PTime":1661978550,"WTime":1661978550,"GTime":1661978550,"BTime":1661978550,"RTime":1661978550,"RRTime":1661978550,"STime":1661978550,"UVTime":1661978550,"TINTime":1661978550,"HINTime":1661978550,"T1Time":1661978550,"H1Time":1661978550,"T2Time":1661978550,"H2Time":1661978550,"T3Time":1661978550,"H3Time":1661978550,"T4Time":1661978550,"H4Time":1661978550,"T5Time":1661978550,"H5Time":1661978550,"T6Time":1661978550,"H6Time":1661978550,"T7Time":1661978550,"H7Time":1661978550,"SM1Time":1661978550,"SM2Time":1661978550,"L":0,"LD":1,"LT":1661817695,"PP1":6,"WBAT":3,"RBAT":"","LBAT":5,"PP1BAT":"","SM1BAT":1.5,"SM2BAT":1.5,"T1BAT":"OK","T2BAT":"OK","LTime":1661978520,"LDTime":1661978520,"LTTime":1661978520,"PP1Time":1661978520,"WBATTime":1661978520,"RBATTime":1661978520,"LBATTime":1661978520,"PP1BATTime":1661978520,"SM1BATTime":1661978520,"SM2BATTime":1661978520,"T1BATTime":1661978520,"T2BATTime":1661978520,"D":20.9,"DTime":1661978550,"A":35.6,"ATime":1661978550}
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: Extending extra sensor table

Post by andyk1 » Wed Aug 31, 2022 10:34 pm

Well number 8 sensor works. It is the( NorthEast Crawlspace 8) and yes I know there out of order but difficult to get under there to just rearrange them.

https://www.ecowitt.net/home/share?authorize=H9CBAM

The only thing I changed was the ecowitt blocks and plugins (Previous versions) around the time it stopped sending num 8 to the extras db testing why php 8.0 and 8.1 do not work on my host. I failed to check and didn't realize it they stopped working.

Good catch and thanks for letting me know. Do you know any php error debugging tools to see what's going on?

I'm getting a headache over this hehehe.
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: Extending extra sensor table

Post by andyk1 » Wed Aug 31, 2022 10:58 pm

Changed back to ecowittModule 1.5 block and stopped working.
No Sensor 8 in apisetup.php

Changed back to ecowitt plugin 3.0 and not working.

Extra sensor num 8 shows up in extra sensors db and apiSetup.php again and adding to database.

I'm going to guess it's in one of the ecowitt plug in but not seeing the problem.

I am using an Ecowitt WS90 and GW2000... could that have anything to do with it?

If you look at my site (lower right side) you can see the Ecowitt block. Not reading correctly.
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: Extending extra sensor table

Post by davidefa » Wed Aug 31, 2022 11:09 pm

Now I see you are using 2 different calls:
1) meteobridge ( calling directly api.php ) lot of sensors, no T8/H8 sensors
2) ecowitt plugin ( which in turn calls api.php ) lot of sensors, including T8/H8, using gw1100 gateway

If the meteobridge sends only sensor already included in the ecowitt plugin call, it can be disabled

P.S.
The gw2000 you where previously using had only a limited number of sensors

P.P.S.
Now your ecowitt module block works as expected you have only to change the main sensor setting
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: Extending extra sensor table

Post by andyk1 » Wed Aug 31, 2022 11:42 pm

I deleted the ecowitt blocks and plugins for now to see if it was bumping heads with the meteobridge. I did like the ecowitt block so I could keep an eye on signal and battery levels.

I'll probably loss sensor #8 again but it never registered anyway the passed sever years.
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: Extending extra sensor table

Post by andyk1 » Wed Aug 31, 2022 11:57 pm

Strange. It shows up in MB
MeteoBridge 08-31-2022
MeteoBridge 08-31-2022
Meteobridge_2022-08-31 185011.png (64.01 KiB) Viewed 1897 times
But not in MT
ExtraSensorsAPI
ExtraSensorsAPI
Extrasensors.png (91.39 KiB) Viewed 1897 times
Not going to mess with it for now.

More pressing issue is getting PHP 8.0 or 8.1 to work. No luck so far.
Image

Post Reply