Adding Additional Sensors to the Extra Table Setup

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

Adding Additional Sensors to the Extra Table Setup

Post by MJW » Sun Jan 26, 2020 5:56 pm

Hello,

I upgraded my weather station to a hybrid model that supports 8 extra temp/humidity sensors through 3 separate devices (Ambient Weather ObserverIP, AW WS-2000, and Ecowitt GW-1000, the GW-1000 is what is used by my DIY Meteobridge currently, which powers the Meteotemplate), and unfortunately the Extra Table only supports 4 extra temp & humidity sensors. Can this be modified to support 8, or added as a new feature when the next version is released? I have 5 sensors now, and only the first 4 make it into the table to be displayed.

thx

Mike
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Fri Jan 31, 2020 1:04 am

Good Question. I have the 8 extra T/H sensors but only 4 read. I'd like to see this added as well. Ecowitt Soil sensor also.
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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Fri Feb 07, 2020 3:52 am

Ok, I figured out how to do this! Attached is a zip file with 2 files in it, I have edited then to allow for 8 extra temp sensors, and 8 extra humidity sensors :)

If you look at my site, http://weather.westfamilynj.net/meteo/indexDesktop.php, the bottom right has my extra Temp & Humidity readings.

*** api.php - put in / folder, I edited line 805 from "//$for($g=1;$g<=4;$g++)" to "//$for($g=1;$g<=8;$g++)" to change the max number of sensors per type from 4 to 8

*** apisetup.php - put in /update folder, I added T5 through T8 starting online 41, then H5 through H8 right below (you can tell by looking at the file where the H* goes). Then I edited line 530 for extra temp sensors from "($i=1;$i<=4;$i++)" to "($i=1;$i<=8;$i++)", then line 568 the same way to enable up to 8 humidity sensors. I didn't change soil temp (line 606), soil moisture (644), leaf wetness (682), leaf temp (720), CO2 (918), NO2 (956), CO (994), SO2 (1032), Ozone (1070), or particulate (1108), but you can the exact same way. If you do adjust any of those, make sure you go back and edit the lines at the top of this file to add the appropriate entries for the extra sensors (like I did for T5-T8 & H5-H8).
extraapifix.zip
edited api.php and apisetup.php files
(15.54 KiB) Downloaded 100 times
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Fri Feb 07, 2020 6:15 am

Hi MJW!!!

I really, really appreciate you doing this. I've looked at the php code several times but you apparently know php way better than I do.

I have played around with it and looking at my api.php and the other I noticed I did have 7 T/H sensors working and the Soil Moisture are reading in my api plugin but not the api.php. Not sure why the 8th is not reading yet. I must not have waited the 5 minutes for the api cache to update and gave up is my guess. Not your mods but mine I am talking about.

I will incorporate your mods as soon as I do a good backup before changing anything.

One thing. Any chance I can get a copy of your PM 2.5 and your extra temp/hum blocks to save me the time. I would gratefully appreciate those also.

Andy
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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Fri Feb 07, 2020 1:38 pm

Hi Andy,

My PHP editing skills are very rudimentary :) You should see my failures/works in progress, the forum has a few of them littered around. I am using the stock extra temp/hum blocks that are available from the main block installation page and didn't have to make any adjustments to those, they will display whatever the API puts in the database. I attached the PM 2.5 block in a zip file on my post over in the Blocks area of the forum, if it doesn't show up over there let me know. That one is based on the extra humidity block, since no calculation is required to change units.

thx

Mike
andyk1 wrote: Fri Feb 07, 2020 6:15 am Hi MJW!!!

...

One thing. Any chance I can get a copy of your PM 2.5 and your extra temp/hum blocks to save me the time. I would gratefully appreciate those also.

Andy
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Sun Feb 09, 2020 3:53 am

Weird, my last message didn't go through.

I again thanked you and don't remember all the questions I asked. If you look at my site I incorporated your mods to the bottom right side of my page for now. How did you get the Temp/Humidity in one block like yours shows? I like that.

I am using the GW1000 like you I am guessing for the PM2.5 sensor and can't find the formula how they are converting ug/m3 to AQI reading. I need to do a lot more reading obviously.

Also I am still not able to get all 8 extra sensors to read, only 7. There is actually 9 using the GW1000 which includes one indoor reading I am using for living room. The meteobridge is using my first extra sensor (1) as the indoor (Den) reading. Not finding the reason it's not reading T/H num 8 which is my East Crawlspace. I'm wondering if that is in the meteobridge output.

Thoughts?

Again thanks for your efforts.

Andy
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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Sun Feb 09, 2020 11:24 pm

Hi Andy,

For the temp/humidity, it is actually 2 blocks put together, "multipleBlock(extraT,50;extraH,50)". Too easy.

When I look at my meteobridge output, the sensor id it uses for indoor is different than the extra sensors. I can confirm this by using the WS View app, and the live data page from my meteobridge. The indoor reading comes from the sensor physically built into the GW1000. I have 5 other temp/humidity sensors, and they are all read correctly and show up in the extraT/H blocks. I bounce this against the meteotemplatelive.txt file to double check everything is making it into the database properly.

Meteotemplate live - {"U":xxxxx,"SW":"meteobridge","T":-0.1,"TMX":-0.1,"TMN":-0.1,"H":85,"P":1028.2,"W":0,"G":0,"B":273,"R":0.5,"RR":0,"S":9.5,"UV":0,"TIN":18.4,"HIN":44,"T1":9,"H1":57,"T2":17.8,"H2":40,"T3":19.8,"H3":37,"T4":18.1,"H4":32,"T5":18.8,"H5":33,"PP1":35.5,"UTime":1581285983,"SWTime":1581285983,"TTime":1581285983,"TMXTime":1581285983,"TMNTime":1581285983,"HTime":1581285983,"PTime":1581285983,"WTime":1581285983,"GTime":1581285983,"BTime":1581285983,"RTime":1581285983,"RRTime":1581285983,"STime":1581285983,"UVTime":1581285983,"TINTime":1581285983,"HINTime":1581285983,"T1Time":1581285983,"H1Time":1581285983,"T2Time":1581285983,"H2Time":1581285983,"T3Time":1581285983,"H3Time":1581285983,"T4Time":1581285983,"H4Time":1581285983,"T5Time":1581285983,"H5Time":1581285983,"PP1Time":1581285983,"D":-2.4,"DTime":1581285983,"A":-2.4,"ATime":1581285983}

T and H are the outdoor temp/humidity, TIN and HIN are the indoor temp/humidity readings, T1-T5 and H1-H5 are the extra sensors. PP1 is the PM2.5.

If you go into your site Control Panel and select "Edit Data Extra Sensors", what are the sensor codes that show up? It should be TIN, HIN, PP1, T1, H1, T2, H2, T3, H3 (on down the line to T8, H8 - if you have all sensors enabled).

If you want to paste your meteotemplatelive.txt (found on your server in the default area, same as your indexdesktop.php file) I can look at that, and if you attach your api.php and apisetup.php files, I can take a look and see if I can figure out why you are not seeing all 8 of your extra sensors.

Mike

andyk1 wrote: Sun Feb 09, 2020 3:53 am Weird, my last message didn't go through.

I again thanked you and don't remember all the questions I asked. If you look at my site I incorporated your mods to the bottom right side of my page for now. How did you get the Temp/Humidity in one block like yours shows? I like that.

I am using the GW1000 like you I am guessing for the PM2.5 sensor and can't find the formula how they are converting ug/m3 to AQI reading. I need to do a lot more reading obviously.

Also I am still not able to get all 8 extra sensors to read, only 7. There is actually 9 using the GW1000 which includes one indoor reading I am using for living room. The meteobridge is using my first extra sensor (1) as the indoor (Den) reading. Not finding the reason it's not reading T/H num 8 which is my East Crawlspace. I'm wondering if that is in the meteobridge output.

Thoughts?

Again thanks for your efforts.

Andy
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Sun Feb 09, 2020 11:34 pm

There is a good AQI info at https://www.epa.gov/sites/production/fi ... ll-aqi.pdf, the actual calculation is on page 25.
andyk1 wrote: Sun Feb 09, 2020 3:53 am
I am using the GW1000 like you I am guessing for the PM2.5 sensor and can't find the formula how they are converting ug/m3 to AQI reading. I need to do a lot more reading obviously.

Again thanks for your efforts.

Andy
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Mon Feb 10, 2020 3:41 pm

Yeah I got something going on I didn't notice before.

My meteotemplateLive.txt is

{"U":158134XXXX,"SW":"meteobridge","T":0.1,"TMX":0.1,"TMN":0.1,"H":73,"P":1019.7,"W":8.6,"G":13,"B":359,"R":0,"RR":0,"S":149,"UV":1,"TIN":22,"HIN":45,"T1":22,"H1":45,"T2":22.5,"H2":46,"T3":23.4,"H3":44,"T4":24.9,"H4":40,"T5":26.5,"H5":34,"T6":11.3,"H6":65,"T7":26.2,"H7":36,"SM1":32,"PP1":13,"UTime":1581347820,"SWTime":1581347820,"TTime":1581347820,"TMXTime":1581347820,"TMNTime":1581347820,"HTime":1581347820,"PTime":1581347820,"WTime":1581347820,"GTime":1581347820,"BTime":1581347820,"RTime":1581347820,"RRTime":1581347820,"STime":1581347820,"UVTime":1581347820,"TINTime":1581347820,"HINTime":1581347820,"T1Time":1581347820,"H1Time":1581347820,"T2Time":1581347820,"H2Time":1581347820,"T3Time":1581347820,"H3Time":1581347820,"T4Time":1581347820,"H4Time":1581347820,"T5Time":1581347820,"H5Time":1581347820,"T6Time":1581347820,"H6Time":1581347820,"T7Time":1581347820,"H7Time":1581347820,"SM1Time":1581347820,"PP1Time":1581347820,"D":-4.2,"DTime":1581347820,"A":-4.1,"ATime":1581347820}

My meteobridge is reading the gw1000 Indoor "TIN/HIN" from the T1/H1. My UV is also not showing min/max on the steelgauges.

Only showing t1-t7 not all 8 extra t/h gauges. Is showing the outdoor lawn moisture gauge SM1.

Looking at my updateLog.txt in the cache folder:

Authorized access.

Current date/time: 2019-11-15 07:54:39

logdata from update/update.php

Generating log file cache/updateLog.txt


ERRORS:

The update settings file does not exist

It's been a while since I made changes I forgot where to find this and how to change it to generate updateLog.txt or even how this got messed up. Looks like I opened a can of worms so to speak.

Andy
Last edited by andyk1 on Sun Feb 16, 2020 11:32 am, edited 1 time in total.
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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Sun Feb 16, 2020 11:31 am

Hi MJW!!!
here's my latest metrotemplateLive.txt

{"U":XXXX,"SW":"meteobridge","T":5,"TMX":5,"TMN":5,"H":85,"P":1015.5,"W":0,"G":0,"B":184,"R":0,"RR":0,"S":0,"UV":0,"TIN":24.1,"HIN":47,"T1":22.3,"H1":48,"T2":22.1,"H2":51,"T3":22.9,"H3":48,"T4":24.3,"H4":43,"T5":26.9,"H5":35,"T6":13.6,"H6":63,"T7":25.7,"H7":42,"SM1":31,"PP1":15,"UTime":1581837479,"SWTime":1581837479,"TTime":1581837479,"TMXTime":1581837479,"TMNTime":1581837479,"HTime":1581837479,"PTime":1581837479,"WTime":1581837479,"GTime":1581837479,"BTime":1581837479,"RTime":1581837479,"RRTime":1581837479,"STime":1581837479,"UVTime":1581837479,"TINTime":1581837479,"HINTime":1581837479,"T1Time":1581837479,"H1Time":1581837479,"T2Time":1581837479,"H2Time":1581837479,"T3Time":1581837479,"H3Time":1581837479,"T4Time":1581837479,"H4Time":1581837479,"T5Time":1581837479,"H5Time":1581837479,"T6Time":1581837479,"H6Time":1581837479,"T7Time":1581837479,"H7Time":1581837479,"SM1Time":1581837479,"PP1Time":1581837479,"D":2.7,"DTime":1581837479,"A":3.4,"ATime":1581837479}

It's seeing my 7 sensors, not the 8. The last number (8) is not being seen. Not sure what the deal is but it's working. The .../wx/plugins/apiViewer/index.php can see the first seven but in .../wx/update/apiSetup.php can see them also but not update the database. It looks like it adds them after the save but a screen refresh shows it's not adding the 4 extra sensors.

You did mention your added them right? I've searched high and low but can't find the problem. Anyway, you can see my meteotemplateLive.txt file.

Also on my site, the sensors read as you can see in the extra T&H blocks along with my PM2.5 and soil moisture sensor in the APIviewer but just won't add to the DB. I don't know MySQL well enough to manually add it as it is difficult to work with if you don't know it.
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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Mon Feb 17, 2020 6:02 am

OK, I solved one of my problems.

In apiSetup.php line numbers, 1168 and 1195 also needed to be changed to "for($i=1;$i<=8;$i++){" excluding quote marks.
Without the changes, the extra sensors won't be appended to the DB files.

Still can't figure out why extra temp/hum sensors #8 can't be read. I Even looked at Meteobridge but can't find the reason.

Andy.
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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Mon Feb 17, 2020 10:37 pm

Hi Andy,

Does the live data tab of your Meteobridge show Extra sensor #8 in either the "Live Data" area in the center, or down below in the Historical Data area?

Mike
andyk1 wrote: Mon Feb 17, 2020 6:02 am OK, I solved one of my problems.

In apiSetup.php line numbers, 1168 and 1195 also needed to be changed to "for($i=1;$i<=8;$i++){" excluding quote marks.
Without the changes, the extra sensors won't be appended to the DB files.

Still can't figure out why extra temp/hum sensors #8 can't be read. I Even looked at Meteobridge but can't find the reason.

Andy.
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Wed Feb 19, 2020 12:34 pm

MJW wrote: Mon Feb 17, 2020 10:37 pm Hi Andy,

Does the live data tab of your Meteobridge show Extra sensor #8 in either the "Live Data" area in the center, or down below in the Historical Data area?

Mike
andyk1 wrote: Mon Feb 17, 2020 6:02 am OK, I solved one of my problems.

In apiSetup.php line numbers, 1168 and 1195 also needed to be changed to "for for "$i=1;$i<=4;$i++){" excluding quote marks.
Without the changes, the extra sensors won't be appended to the DB files.

Still can't figure out why extra temp/hum sensors #8 can't be read. I Even looked at Meteobridge but can't find the reason.

Andy.
Yes it does show up in meteobridge live window. I have other PHP files to modify In /wx/admin/import.php, importExtra.php, importExtraFile.php and so on.

Those needed the for "$i=1;$i<=8;$i++){" added but I also need to go back to "$i=1;$i<=4;$i++){" after so it does not look for or add the Soil, Co2, So2 etc. Not sure what I'm doing wrong. May need a tab (4) spaces when I add the "for $i=1;$i<=4;$i++){" back in to correct it back to original. It works but the save option hangs telling me there's an error in the php code and doesn't save the needed txt files.

My meteotemplateLive.txt looks like:

{"U":1582073251,"SW":"meteobridge","T":6.7,"TMX":6.7,"TMN":6.7,"H":53,"P":1025.6,"W":6.5,"G":7.2,"B":38,"R":0,"RR":0,"S":0,"UV":0,"TIN":24.1,"HIN":47,"T1":23,"H1":48,"T2":22.8,"H2":50,"T3":23.3,"H3":48,"T4":25,"H4":43,"T5":26.3,"H5":40,"T6":17.2,"H6":63,"T7":27,"H7":39,"SM1":28,"PP1":10,"UTime":1582073253,"SWTime":1582073253,"TTime":1582073253,"TMXTime":1582073253,"TMNTime":1582073253,"HTime":1582073253,"PTime":1582073253,"WTime":1582073253,"GTime":1582073253,"BTime":1582073253,"RTime":1582073253,"RRTime":1582073253,"STime":1582073253,"UVTime":1582073253,"TINTime":1582073253,"HINTime":1582073253,"T1Time":1582073253,"H1Time":1582073253,"T2Time":1582073253,"H2Time":1582073253,"T3Time":1582073253,"H3Time":1582073253,"T4Time":1582073253,"H4Time":1582073253,"T5Time":1582073253,"H5Time":1582073253,"T6Time":1582073253,"H6Time":1582073253,"T7Time":1582073253,"H7Time":1582073253,"SM1Time":1582073253,"PP1Time":1582073253,"D":-2.3,"DTime":1582073253,"A":3.2,"ATime":1582073253}

It's working and adding to the Db file just fine. There are a lot of php files interlinked that need tweaking.

I need to figure out how to add the ($i=1;$i<=4;$i++) back in without generating the (line error)

Also if I manually add the "H8" to the needed txt files it stripes it out the next update in the 5 minute period.

Andy
Last edited by andyk1 on Wed Feb 19, 2020 1:24 pm, edited 1 time in total.
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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Wed Feb 19, 2020 12:59 pm

Also, if my site is not updating I am working on the test site at https://www.nicomaparkwx.com/wx2/indexDesktop.php
You can see the extra indoor sensors in extraT, extraH and extraPP working but my East Crawlspace #8 does not show up in the block either. Probably because MT is not seeing it. And again, yes it shows up on Meteobridge Live tab.
Image
Attachments
MtSS.png
MtSS.png (38.99 KiB) Viewed 6365 times
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: Adding Additional Sensors to the Extra Table Setup

Post by MJW » Wed Feb 19, 2020 9:07 pm

Andy,

It is good that the Extra #8 shows up in the Meteobridge live areas, but then I would expect it to show up in Meteotemplatelive.txt. I need to do some testing, I don't know if the meteotemplatelive text is created showing all data received via the meteobridge process before meteotemplate posts anything to the database, or if the file is created showing what was posted to the database. That would help narrow down if extra#8 data is actually being sent by the meteobridge at all, or if it is but meteotemplate ingress is dumping that data and not pushing it to the database.

Mike
So many trees in NJ!

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: Adding Additional Sensors to the Extra Table Setup

Post by andyk1 » Thu Feb 20, 2020 10:01 am

Yeah, I was thinking the same. My thought is, it's not being sent by MB or MT is thinking the indoor sensor from the GW1000 is counted as #1. I need to finish cleaning up the code I redid in the other test site to optimize the way it outputs. There are so many php files interlinked and it's tough following them. One change in one also needs to be changed in the other associated code or errors out or freezes but I'm sure you know what I mean.

One way I'm going to test that theory is to find and ignore the Indoor sensor to see if then it finds/reads #8 extra indoor.

Like you working on too many things at once.
Image

Post Reply