Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

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 »

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 »

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 »

Hi Ray,
I had added but for some reason when i restarted cumulus i got the php index error
Beau
BigOkie
Posts: 272
Joined: Tue 28 May 2013 1:06 am
Weather Station: Davis VP2 Plus
Operating System: Raspian Buster (RPi 3b)
Location: Tulsa, OK

Re: PHP Notice: Undefined index?

Post by BigOkie »

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: 3828
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Notice: Undefined index?

Post by PaulMy »

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
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm
Image
BigOkie
Posts: 272
Joined: Tue 28 May 2013 1:06 am
Weather Station: Davis VP2 Plus
Operating System: Raspian Buster (RPi 3b)
Location: Tulsa, OK

Re: PHP Notice: Undefined index?

Post by BigOkie »

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