Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.2.3 build 3059 - 04 December 2019.
    Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

    See the Wiki for downloading either version.

    PHP Notice: Undefined index?

    Discussion of Ken True's web site templates

    Moderator: saratogaWX

    Post Reply
    n9mfk
    Posts: 845
    Joined: Sun 10 May 2009 8:52 pm
    Weather Station: davis vp2 Serial datalogger
    Operating System: Windows 7 64-bit
    Location: Springfield, IL

    PHP Notice: Undefined index?

    Post by n9mfk » Sat 18 May 2013 2:03 am

    Hi,
    how do I avoid this error when I restart cumulus

    Code: Select all

    PHP Notice:  Undefined index: txbattery channel=1 
    

    Code: Select all

    $vpissstatus = $WX['txbattery channel=1'];
    
    thanks Beau

    gemini06720
    Posts: 1700
    Joined: Mon 10 Aug 2009 10:16 pm
    Weather Station: No weather station
    Operating System: No operating system
    Location: World...

    Re: PHP Notice: Undefined index?

    Post by gemini06720 » Sat 18 May 2013 9:15 am

    In order to produce the result you want, you will need to create a new tag (variable) in the 'CUtags.txt' template as such:

    Code: Select all

    vpissstatus|<#txbattery channel=1>:|:
    The reason you cannot use the 'channel=1' option with the '$WX['txbattery']' is that the variable has already been assigned a value (ie: 'TX Battery Status: 1-ok 2-ok 3-ok 4-ok 5-ok 6-ok 7-ok 8-ok ').

    If you do not want to add a new tag to the 'CUtags.txt' template, then you will have to use 'explode' function and/or other functions to extract the individual values contained - although not fancy, I used the following two steps:

    Code: Select all

    list( $txbs, $results ) = explode( ':', $WX['txbattery'] );
    list( $tx1, $tx2, $tx3, $tx4, $tx5, $tx6, $tx7, $tx8 ) = explode( '   ', $results );
    
    The '$txbs' variable contains the 'TX Battery Status' message, the '$results' contains the '1-ok 2-ok 3-ok 4-ok 5-ok 6-ok 7-ok 8-ok' data, and finally, the '$tx1' to '$tx8' variables contain the data from the possible 8 transmitters.

    n9mfk
    Posts: 845
    Joined: Sun 10 May 2009 8:52 pm
    Weather Station: davis vp2 Serial datalogger
    Operating System: Windows 7 64-bit
    Location: Springfield, IL

    Re: PHP Notice: Undefined index?

    Post by n9mfk » Sun 19 May 2013 2:08 pm

    Hi Ray,
    I had added but for some reason when i restarted cumulus i got the php index error
    Beau

    BigOkie
    Posts: 213
    Joined: Tue 28 May 2013 1:06 am
    Weather Station: Davis VP2
    Operating System: Raspian Jessie
    Location: Tulsa, OK

    Re: PHP Notice: Undefined index?

    Post by BigOkie » Sat 01 Jun 2013 7:07 pm

    I know I'm about two weeks late to the party here, but I've used Ken's templates before when I used WD. I got a VP2 station earlier this month and have been using Cumulus (and like it). What I did to add station specific status for the ISS was put this in the CUtags.txt file

    Code: Select all

    DavisISS1|<#txbattery channel=1>:|:
    then in the CUDefs.php file tied a variable I named $dvisschan1 to that by this line:

    Code: Select all

    $dvisschan1 = $WX['DavisISS1'];
    After that, it worked just fine. You could theoretically just continue to add the channels in the def and txt file so you wouldn't have to worry about using the explode function in PHP.

    Just a thought.

    User avatar
    PaulMy
    Posts: 2009
    Joined: Sun 28 Sep 2008 11:54 pm
    Weather Station: Davis Vantage Pro 2+ w/Envoy USB
    Operating System: Windows-8
    Location: Komoka, ON Canada
    Contact:

    Re: PHP Notice: Undefined index?

    Post by PaulMy » Sun 02 Jun 2013 4:04 pm

    BigOkie good to see you here and your 1st post, and looks like you are enjoying your new Davis. I have been following the recent discussions at wxforum.net on tornados in your area and wish you safe weather watching and being safe from the disasters and tragedies that have been occurring there.

    Paul

    BigOkie
    Posts: 213
    Joined: Tue 28 May 2013 1:06 am
    Weather Station: Davis VP2
    Operating System: Raspian Jessie
    Location: Tulsa, OK

    Re: PHP Notice: Undefined index?

    Post by BigOkie » Sun 02 Jun 2013 7:58 pm

    PaulMy wrote:BigOkie good to see you here and your 1st post, and looks like you are enjoying your new Davis. I have been following the recent discussions at wxforum.net on tornados in your area and wish you safe weather watching and being safe from the disasters and tragedies that have been occurring there.

    Paul
    It has been a wild couple of weeks here for sure. I have, however, lived here my whole life and understand the dangers of the weather here. Just keeps us Okies on our toes. Still horrible what has happened here. My immediate location really has been spared (except for Broken Arrow, about 6 miles to my SE).

    Thanks for the concern.

    Post Reply