Web Weather > Weather Web Site Help
Blake Larsen Sun Recorder to CMx
davidmc36:
Well it works just fine with CMx 4 and Sunshine recorder hosted on the PC.
I put: http://192.168.5.88:8998/C:\Users\david\Desktop\Sun Recorder\SRsunshine.dat for the URL to fetch.
I put: C:\Users\david\Downloads\CumulusMXDist4088\CumulusMX\SRsunshine.dat for the destination.
CMx fetches the .dat file.
I don't see all the options to do this in the CMx 3 on RPi.
davidmc36:
Well Holy Howdy Doody!
It seemed that the experiment with having CMx4 fetch the .dat file within the PC ended up with a blank file. Showed updated time-stamp always, but always empty.
So I started hunting around for some automation that may FTP the file to the CMx3 on RPi. Windows Task Scheduler running a script appeared on the radar.
So. WinSCP has a feature to generate a script to transfer files. Good 'ol Copy/Paste comes in to play. I fire up PowerShell ISE in Administrator mode and run the .ps1 file.
POOF! File is in the CMX folder on the Pi.
I know it is using the file because when I ticked the BL Sun option in CMx, the hours today changed from the 1.5 calculated to 1.1 of the Sun Recorder.
The last hurdle I suppose will be to have it run every 5 minutes initiated by Task Scheduler. The permission thing may be tricky yet for an automated task?????
mcrossley:
--- Quote from: davidmc36 on April 11, 2025, 07:05:18 PM ---Well it works just fine with CMx 4 and Sunshine recorder hosted on the PC.
I put: http://192.168.5.88:8998/C:\Users\david\Desktop\Sun Recorder\SRsunshine.dat for the URL to fetch.
I put: C:\Users\david\Downloads\CumulusMXDist4088\CumulusMX\SRsunshine.dat for the destination.
CMx fetches the .dat file.
--- End quote ---
It would be simpler to use the Extra Web Files feature. Just specify...
Local file = C:\Users\david\Desktop\Sun Recorder\SRsunshine.dat
Destination Filename = C:\Users\david\Downloads\CumulusMXDist4088\CumulusMX\SRsunshine.dat
Do NOT tick "upload" so MX performs a local copy.
Optionally tick "Realtime" for very frequent copies at your realtime interval
@davidmc36 can you map a drive (mount in Linux parlence) to your PC from the rPi? If so you could use the same mechanism to perform the copy.
Example of mounting a Windows shared drive on a rPi...
sudo mount.cifs //192.168.0.3/d /home/pi/winshare/d -o user=myusername,password=mypassword
davidmc36:
IC, Web Files. If I need it on PC I will set that up instead of URL.
My struggle now is automation. I can run script with PS or PS ISE in admin mode and all is well. I need it to run auto from Task Scheduler or whatever can initiate it every few minutes.
davidmc36:
--- Quote from: davidmc36 on April 12, 2025, 03:55:36 PM --- ... automation. ...
--- End quote ---
This is my script.
--- Code: ---# Needed for PowerShell 7.3 and newer
$PSNativeCommandArgumentPassing = "Legacy"
& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
/log="C:\Program Files (x86)\WinSCP\WinSCP.log" /ini=nul `
/command `
"open sftp://pi:5292@192.168.5.249/ -hostkey=`"`"ssh-ed25519 255 Tu1usm0aAdVpVLAhtV/Nlg1Xo7OXQkQxVhxOxiiN08Q`"`"" `
"lcd C:\Users\david\Desktop\SunRecorder" `
"cd /home/pi/CumulusMX" `
"put SRsunshine.dat" `
"exit"
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
Write-Host "Success"
}
else
{
Write-Host "Error"
}
exit $winscpResult
--- End code ---
So instead of exit can it wait a couple minutes and start over? Loop?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version