Weather34 TEMPLATE

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

weatherist34
Platinum Boarder
Platinum Boarder
Posts: 1693
Joined: Tue Mar 28, 2017 6:57 am

Re: Weather34 TEMPLATE

Post by weatherist34 »

hmm Turkish beer is not good its all out of a tin or bottle ...German , English or European beer from the barrel is bliss and not about quantity but quality.. ..

thanks it was another one of my oversights for non metric forgot to check ..sorry for the inconvenience ..Brian
Simple Update February 2023 for Weather34 Aurora MKII
https://www.mediafire.com/file/jk4lj3mq ... 2.zip/file

Weather34 Master Download Aurora MKII
https://download.meteobridge.com/files/Weather34.zip
User avatar
prestwickwx
Platinum Boarder
Platinum Boarder
Posts: 510
Joined: Sat Aug 23, 2014 3:28 pm
Location: Myrtle Beach, SC USA
Contact:

Re: Weather34 TEMPLATE

Post by prestwickwx »

Brian,

All fixed. Ah yes - German Beer - the best. :D. Spent good times there years ago.

Chuck
Image
https://myrtleweather.com/
Myrtle Beach WX @ Prestwick
User avatar
prestwickwx
Platinum Boarder
Platinum Boarder
Posts: 510
Joined: Sat Aug 23, 2014 3:28 pm
Location: Myrtle Beach, SC USA
Contact:

Re: Weather34 TEMPLATE

Post by prestwickwx »

Hi Brian,

One more minor issue. The Air Quality module seems to be getting the wrong word for AQI >50. I looked at the file and Language, but did not see anything. Also, reads correct in the Portrait view Module.

Capture.PNG
Capture.PNG (9.46 KiB) Viewed 3712 times
Capture1.PNG
Capture1.PNG (19.04 KiB) Viewed 3710 times

Best wishes,

Chuck
Image
https://myrtleweather.com/
Myrtle Beach WX @ Prestwick
RABrand
Junior Boarder
Junior Boarder
Posts: 21
Joined: Thu Dec 26, 2019 3:54 am
Location: Tacoma, WA. USA
Contact:

Re: Weather34 TEMPLATE

Post by RABrand »

Brian,

I like the addition of the AQI module which supports PM2.5 monitors using slot 175 of the Meteobridge API.

However, it looks like the module is displaying the particle count, and not the AQI value.
I also have to map air0!0pm to air0pm for it to work at all.
The Meteobridge mapping seems to indicate that air0pm is PM10, and air1pm is PM2.5.....
Not sure that really makes any difference as long as it is working.

Any chance that the module might also be released in the larger size (similar to the Davis module) so that air quality can be displayed on a smartphone?

Air Quality on the US West Coast has been horrible, I am in the Pacific Northwest.

We have seen outdoor PM2.5 AQI values exceeding 300!! It would be convenient to have AQI in a 'portable' form.

Ron B.
Last edited by RABrand on Fri Oct 09, 2020 4:27 pm, edited 1 time in total.
weatherist34
Platinum Boarder
Platinum Boarder
Posts: 1693
Joined: Tue Mar 28, 2017 6:57 am

Re: Weather34 TEMPLATE

Post by weatherist34 »

Good Morning

ok reworked Air Quality modules and removed the PM 2.5 default word , just replaced with AQI as I have no idea what particle matter is being used for primary so this is relatively easy to compile without having another option to setup.

Yes I have just added a large module to the MB assigned aq sensor to appear in mobile view the setup option now has the additional file
weather34-airquality-mod-mb.php so there are now three large modules supporting Air quality

weather34-airquality-mod.php is the original purple air/luftdaten module
weather34-airqualitydavis-mod.php is the Davis airlink module
weather34-airquality-mod-mb.php is the meteobridge assigned to use position 175 in the API..

@Chuck fixed another one of stupid silly oversights ..

the update 09-10-2020 contains

(*Update for 9th October 06:50)
* Adds newer option to use Air Quality in mobile view ref Ron B.
* Air Quality description anomaly fix ref Chuck
* Adds new large Air Quality for Air Quality MB assigned sensor
* Rework Air Quality layouts to match each other
* Wind Indicator non metric (mph) fix ref Chuck
* Adds setup option + new small module for meteobridge assigned Air Quality

screenshots of Air Quality options...have a cool and a relaxing weekend ...


airq.jpg
airq.jpg (152.66 KiB) Viewed 3684 times
Simple Update February 2023 for Weather34 Aurora MKII
https://www.mediafire.com/file/jk4lj3mq ... 2.zip/file

Weather34 Master Download Aurora MKII
https://download.meteobridge.com/files/Weather34.zip
User avatar
prestwickwx
Platinum Boarder
Platinum Boarder
Posts: 510
Joined: Sat Aug 23, 2014 3:28 pm
Location: Myrtle Beach, SC USA
Contact:

Re: Weather34 TEMPLATE

Post by prestwickwx »

Brian,

Working fine. :D

Best wishes,

Chuck
Image
https://myrtleweather.com/
Myrtle Beach WX @ Prestwick
RABrand
Junior Boarder
Junior Boarder
Posts: 21
Joined: Thu Dec 26, 2019 3:54 am
Location: Tacoma, WA. USA
Contact:

Re: Weather34 TEMPLATE

Post by RABrand »

Yes, it works nicely, and is (I think) displaying particle count... Not AQI.

I think I confused the issue when I brought up PM2.5 and PM10....
It seems as though the Meteobridge API position 175 always contains the PM2.5 particle count from an Ecowitt PM2.5 unit. (What I have)

To convert the particle count in slot 175 to the actual Air Quality Index (AQI) requires conversion....

I am not familiar with php code, but I believe the code below performs the conversion from particle count to AQI??
I took this snippet from one of the modules 'weather34-airquality.php'.

Code: Select all

// PURPLE AIR additional conversion script included by Andrew Billits 24 April 2018
function pm25_to_aqi($pm25)
{
    if ($pm25 > 500.5) {
        $aqi = 500;
    } elseif ($pm25 > 350.5 && $pm25 <= 500.5) {
        $aqi = map($pm25, 350.5, 500.5, 400, 500);
    } elseif ($pm25 > 250.5 && $pm25 <= 350.5) {
        $aqi = map($pm25, 250.5, 350.5, 300, 400);
    } elseif ($pm25 > 150.5 && $pm25 <= 250.5) {
        $aqi = map($pm25, 150.5, 250.5, 200, 300);
    } elseif ($pm25 > 55.5 && $pm25 <= 150.5) {
        $aqi = map($pm25, 55.5, 150.5, 150, 200);
    } elseif ($pm25 > 35.5 && $pm25 <= 55.5) {
        $aqi = map($pm25, 35.5, 55.5, 100, 150);
    } elseif ($pm25 > 12 && $pm25 <= 35.5) {
        $aqi = map($pm25, 12, 35.5, 50, 100);
    } elseif ($pm25 > 0 && $pm25 <= 12) {
        $aqi = map($pm25, 0, 12, 0, 50);
    }
    return $aqi;
}
function map($value, $fromLow, $fromHigh, $toLow, $toHigh)
{
    $fromRange = $fromHigh - $fromLow;
    $toRange = $toHigh - $toLow;
    $scaleFactor = $toRange / $fromRange;

    // Re-zero the value within the from range
    $tmpValue = $value - $fromLow;
    // Rescale the value to the to range
    $tmpValue *= $scaleFactor;
    // Re-zero back to the to range
    return $tmpValue + $toLow;
}
I cannot express how appreciative I am of the effort, time, and quick responses you provide to this project!

Thanks!

Ron B.

https://hillsdale-98404.com
Last edited by RABrand on Fri Oct 09, 2020 6:44 pm, edited 1 time in total.
weatherist34
Platinum Boarder
Platinum Boarder
Posts: 1693
Joined: Tue Mar 28, 2017 6:57 am

Re: Weather34 TEMPLATE

Post by weatherist34 »

Hello yes :-) ive been running it with my new Davis Unit I set up yesterday as the Davis is only outputting PM values as it is designed so I added that script to now reflects a relative value to my other unit and also a relative value to a local municipality unit installed 7km away .so something for next week
as I will also compile charts for day,month,year now its in front of me but I need to build a waterproof seal to the power input..


if you cant wait and feel confident of editing the 2 new files simply add/replace

weather34-airquality-mb.php
weather34-airquality-mod-mb.php

simply replace this

Code: Select all

<?php  include('livedata.php');
date_default_timezone_set($TZ);
    ####################################################################################################
    #	CREATED FOR HOMEWEATHERSTATION MB SMART TEMPLATE 											   #
    # https://weather34.com/homeweatherstation/index.html 											   #
    # 	                                                                                               #
    # 	Revised: October 2020					Air Qulaity                                            #
    # 	                                                                                               #
    #   https://www.weather34.com 	                                                                   #
    ####################################################################################################
    $w34aqi     = $meteobridgeapi[175];
?>

with

Code: Select all

<?php  include('livedata.php');
date_default_timezone_set($TZ);
    ####################################################################################################
    #	CREATED FOR HOMEWEATHERSTATION MB SMART TEMPLATE 											   #
    # https://weather34.com/homeweatherstation/index.html 											   #
    # 	                                                                                               #
    # 	Revised: October 2020       			  	                                                   #
    # 	                                                                                               #
    #   https://www.weather34.com 	                                                                   #
    ####################################################################################################
// AIR QUALITY based on original additional conversion script by Andrew Billits 24 April 2018
function pm25_to_aqi($pm25)
{
    if ($pm25 > 500.5) {
        $aqi = 500;
    } elseif ($pm25 > 350.5 && $pm25 <= 500.5) {
        $aqi = map($pm25, 350.5, 500.5, 400, 500);
    } elseif ($pm25 > 250.5 && $pm25 <= 350.5) {
        $aqi = map($pm25, 250.5, 350.5, 300, 400);
    } elseif ($pm25 > 150.5 && $pm25 <= 250.5) {
        $aqi = map($pm25, 150.5, 250.5, 200, 300);
    } elseif ($pm25 > 55.5 && $pm25 <= 150.5) {
        $aqi = map($pm25, 55.5, 150.5, 150, 200);
    } elseif ($pm25 > 35.5 && $pm25 <= 55.5) {
        $aqi = map($pm25, 35.5, 55.5, 100, 150);
    } elseif ($pm25 > 12 && $pm25 <= 35.5) {
        $aqi = map($pm25, 12, 35.5, 50, 100);
    } elseif ($pm25 > 0 && $pm25 <= 12) {
        $aqi = map($pm25, 0, 12, 0, 50);
    }
    return $aqi;
}
function map($value, $fromLow, $fromHigh, $toLow, $toHigh)
{
    $fromRange = $fromHigh - $fromLow;
    $toRange = $toHigh - $toLow;
    $scaleFactor = $toRange / $fromRange;

    // Re-zero the value within the from range
    $tmpValue = $value - $fromLow;
    // Rescale the value to the to range
    $tmpValue *= $scaleFactor;
    // Re-zero back to the to range
    return $tmpValue + $toLow;
}
$w34aqi     = number_format(pm25_to_aqi($meteobridgeapi[175]), 1);
//$w34aqi     = $meteobridgeapi[175];
?>
Simple Update February 2023 for Weather34 Aurora MKII
https://www.mediafire.com/file/jk4lj3mq ... 2.zip/file

Weather34 Master Download Aurora MKII
https://download.meteobridge.com/files/Weather34.zip
RABrand
Junior Boarder
Junior Boarder
Posts: 21
Joined: Thu Dec 26, 2019 3:54 am
Location: Tacoma, WA. USA
Contact:

Re: Weather34 TEMPLATE

Post by RABrand »

Thanks Brian!!

As I said, I am NOT a php programmer, but have done some assembly and coding with various forms of BASIC.

I shouldn't have any trouble trying out your fix... Your speedy reply is amazingly quick!

I looked at my post, and realized I had left the 'map' function out of the snippet.
By the time corrected it and re-posted, you had already replied with the fix!
I am looking forward to the 'official' update...

Thanks again for your exceptional effort!

Have a great weekend,

Ron B.

https://hillsdale-98404.com
Last edited by RABrand on Fri Oct 09, 2020 9:19 pm, edited 1 time in total.
RABrand
Junior Boarder
Junior Boarder
Posts: 21
Joined: Thu Dec 26, 2019 3:54 am
Location: Tacoma, WA. USA
Contact:

Re: Weather34 TEMPLATE

Post by RABrand »

I made the edits (after doing a backup!), and it works great!

Thanks again.... :D 👍

Ron B.

https://hillsdale-98404.com
xray77
Gold Boarder
Gold Boarder
Posts: 182
Joined: Sat Mar 07, 2020 11:54 pm
Location: Buedelsdorf, SH Germany
Contact:

Luftdaten-Sensor don't work..

Post by xray77 »

Hello, Brian,
Today I started using the Air-Quality Sensor from "Luftdaten.info" i.

particulate matter sensor SDS011
Sensor ID: 50525 (show on card)
Last update: 09.10.2020, 19:55:43
Fine dust 10 µm: 4.43 µg/m³
Fine dust 2.5 µm: 2.10 µg/m³

So it works and also sends data to the sensor network of "Luftdaten.info..
Only on your template it will not work.
Bildschirmfoto 2020-10-09 um 20.33.24.png
Bildschirmfoto 2020-10-09 um 20.33.24.png (76.46 KiB) Viewed 3605 times
Bildschirmfoto 2020-10-09 um 20.33.13.png
Bildschirmfoto 2020-10-09 um 20.33.13.png (48.02 KiB) Viewed 3605 times
Bildschirmfoto 2020-10-09 um 20.01.40.png
Bildschirmfoto 2020-10-09 um 20.01.40.png (42.32 KiB) Viewed 3605 times
Bildschirmfoto 2020-10-09 um 20.01.28.png
Bildschirmfoto 2020-10-09 um 20.01.28.png (289.41 KiB) Viewed 3605 times
What i have do wrong? Latest Update is installed (Oct 9, 2020)
In some other Templates (Leuuven, older W34 NANO SD-Template) it works fine with similar setup.
Have succesfully integrated the sensor to my MeteoBridge (additional Station #1), but with the airquality-mb-module it also don't work.. :-(
Thanks for your advice,
best regards
weatherist34
Platinum Boarder
Platinum Boarder
Posts: 1693
Joined: Tue Mar 28, 2017 6:57 am

Re: Weather34 TEMPLATE

Post by weatherist34 »

Good morning

I just tested the luftdaten stuff with your ID 50525 in my demo and everything is fine. NO changes have been made to LUFTDATEN scripts for months however that said I don't use luftdaten but numerous users do but I have not seen any reports or issues raised for months last I recall was a API url change.

could be something as simple as a hidden space on the end of the ID in the setup , commonly happens when copy and paste is used .seen it numerous times with things like API keys etc ..

your data returned in the API call made this morning for demo stored in the file jsondata/luftdaten.txt

Code: Select all

[{"sensordatavalues":[{"value":"2.10","value_type":"P1","id":4715340293},{"value":"0.57","value_type":"P2","id":4715340317}],"location":{"longitude":"9.66316223145","altitude":"13.2","country":"DE","latitude":"54.32018412738","exact_location":1,"id":36474,"indoor":0},"timestamp":"2020-10-10 05:17:33","sensor":{"sensor_type":{"manufacturer":"Nova Fitness","name":"SDS011","id":14},"pin":"1","id":[b]50525[/b]},"sampling_rate":null,"id":2183545621},{"sensordatavalues":[{"value":"1.63","value_type":"P1","id":4715292269},{"value":"0.90","value_type":"P2","id":4715292270}],"location":{"longitude":"9.66316223145","altitude":"13.2","country":"DE","latitude":"54.32018412738","exact_location":1,"id":36474,"indoor":0},"timestamp":"2020-10-10 05:15:08","sensor":{"sensor_type":{"manufacturer":"Nova Fitness","name":"SDS011","id":14},"pin":"1","id":50525},"sampling_rate":null,"id":2183523534}]
see also and live example https://www.ilfracombeweather.net/console/index.php that is using luftdaten for Air Quality

screenshot of data your data
50525.jpg
50525.jpg (71.27 KiB) Viewed 3556 times
Simple Update February 2023 for Weather34 Aurora MKII
https://www.mediafire.com/file/jk4lj3mq ... 2.zip/file

Weather34 Master Download Aurora MKII
https://download.meteobridge.com/files/Weather34.zip
xray77
Gold Boarder
Gold Boarder
Posts: 182
Joined: Sat Mar 07, 2020 11:54 pm
Location: Buedelsdorf, SH Germany
Contact:

Re: Weather34 TEMPLATE

Post by xray77 »

Good Morning Brian,
I do not have the file "luftdaten.txt" in my json directory in the template on my server. I have also looked 10x in the setup, no spaces in the ID... What can I do now? Should I maybe download the last update again and have it installed, maybe something went wrong?
I'm a bit helpless :( , it seems as if a file in the template-folder is missing for execution?

i can retrieve the json-data from the sensor itself in my local network:

Code: Select all

{"software_version": "NRZ-2020-129", "age":"73", "sensordatavalues":[{"value_type":"SDS_P1","value":"5.90"},{"value_type":"SDS_P2","value":"1.15"},{"value_type":"BME280_temperature","value":"7.89"},{"value_type":"BME280_pressure","value":"101340.47"},{"value_type":"BME280_humidity","value":"84.90"},{"value_type":"samples","value":"4330474"},{"value_type":"min_micro","value":"33"},{"value_type":"max_micro","value":"20073"},{"value_type":"signal","value":"-83"}]}
unfortunately also after the Update from 10.10.2020 it don't works for me :-(

Best regards
Michael
weatherist34
Platinum Boarder
Platinum Boarder
Posts: 1693
Joined: Tue Mar 28, 2017 6:57 am

Re: Weather34 TEMPLATE

Post by weatherist34 »

think your answered your own question ..file doesnt exists .. either create an empty file called luftdaten.txt or check server config for creating a file that doesnt exist. stationcron.php is the primary file for calling external api data. todays update does nothing for luftdaten data it just fixes an alignment in german sunrise,set .. you need to create the file luftdaten.txt and wait for the stationcron.php to run then you will be ok.

another example of luftdaten working fine http://ringwoodweather.ddns.net/Weather34/index.php note he has multiple air quality sensors but the aqi icon produces a luftdaten screen..
Simple Update February 2023 for Weather34 Aurora MKII
https://www.mediafire.com/file/jk4lj3mq ... 2.zip/file

Weather34 Master Download Aurora MKII
https://download.meteobridge.com/files/Weather34.zip
xray77
Gold Boarder
Gold Boarder
Posts: 182
Joined: Sat Mar 07, 2020 11:54 pm
Location: Buedelsdorf, SH Germany
Contact:

Re: Weather34 TEMPLATE

Post by xray77 »

Brian,
Now I copied an empty "luftdaten.txt" into the jsondata directory on my server. I'm curious if it will work after the next call of stationcron. 8)
I will report it, thank you for your advice!
regards
Mike
Post Reply