Virtual Davis VP2 console integration
Posted: Thu 11 Nov 2021 9:57 am
Following some research on other CUtils websites I wanted to add a virtual DavisVP2 console as an enhancement for my own local CUtils site. Initially I thought that it should be possible to do but I did not factor in the various trials and comparisons of scripts to find the final product, however I do have plenty of time. As ever Hans has been supportive of my efforts and gave some very useful coding and style tips.
The starting point for getting a virtual Davis console onto a CUtils site is the scripts folder on silveracorn.nz at https://silveracorn.nz/weather/wxscripts.php
There is a detailed how to set up the console within the download folder. I initially set up the virtual console as part of the CMX default website and then wasted time getting the CMX branding around the console, this proved to me that the virtual console worked and showed live data. I then linked this virtual console to CUtils through links in the CUsermenu, whilst this worked it was a bit clunky.
Following some advice from Hans I used an “iframe” to integrate the console into CUtils as follows:-
1. Create a davcon.txt file containing ” <iframe src="davconvp2CU.php" width="100%" frameborder="0" style="border:0;height:75vh;"></iframe> “.
2. The davcon.txt file was then added to the CUsermenu.txt using “ <span class='nav-link' onclick="LoadUtilsReport('davcon.txt');">Davis Console</span> ”
The result was a fully integrated virtual console on my CUtils site which looked much better, this was further enhanced by:-
1. Amending davconvp2CU.php to remove the attribution notes at the end of the page.
2. Amending davconvp2CU-inc.php to remove the content block which included the site name and coordinates.
3. Both the above amends got the virtual console cleanly integrated.
I have attached a screen shot of the current integrated virtual console and the two davcon php files for information.
The starting point for getting a virtual Davis console onto a CUtils site is the scripts folder on silveracorn.nz at https://silveracorn.nz/weather/wxscripts.php
There is a detailed how to set up the console within the download folder. I initially set up the virtual console as part of the CMX default website and then wasted time getting the CMX branding around the console, this proved to me that the virtual console worked and showed live data. I then linked this virtual console to CUtils through links in the CUsermenu, whilst this worked it was a bit clunky.
Following some advice from Hans I used an “iframe” to integrate the console into CUtils as follows:-
1. Create a davcon.txt file containing ” <iframe src="davconvp2CU.php" width="100%" frameborder="0" style="border:0;height:75vh;"></iframe> “.
2. The davcon.txt file was then added to the CUsermenu.txt using “ <span class='nav-link' onclick="LoadUtilsReport('davcon.txt');">Davis Console</span> ”
The result was a fully integrated virtual console on my CUtils site which looked much better, this was further enhanced by:-
1. Amending davconvp2CU.php to remove the attribution notes at the end of the page.
2. Amending davconvp2CU-inc.php to remove the content block which included the site name and coordinates.
3. Both the above amends got the virtual console cleanly integrated.
I have attached a screen shot of the current integrated virtual console and the two davcon php files for information.