Re: [weewx-user] want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Graham Eddy
as well as doing nightly system backups (rsnapshot) to a separate on-site 
server, i also specifically save weewx.sdb *often* to on-site backup and 
nightly to off-site backup:
graham@messmate:~$ sudo -u weewx crontab -l
# local backup production weewx.sdb every 15 mins, rollover one hour
2-59/15 * * * * scp -Cq paperbark:/home/weewx/archive/weewx.sdb 
/srv/cache/weewx/weewx.sdb_$(date '+\%M')
# offsite backup production weewx.sdb every day - picked up in *its* backups to 
off-site storage
2 5 * * * scp -3Cq paperbark:/home/weewx/archive/weewx.sdb 
weather.geddy.id.au:backups/weewx.sdb
⊣ Graham Eddy ⊢

> On 13 Mar 2022, at 12:15 pm, Greg Troxel  wrote:
> 
> I also do backups every week.  Perhaps should be more often of the database.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/A427E7DA-1C72-4A6B-B5CD-7DFC23726786%40gmail.com.


Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread vince
Agree.   I have a couple pi that I run most things in ramdisk on but I 
don't care about logs on those pi.

Here's a snippet from /etc/fstab for the box I use to shoot weathercam 
snaps and timelapse into /mnt/ramdisk, with cron jobs on other systems to 
pull the results back onto something the weewx system that runs off 
spinning disk.

# run motion in ramdisk ---
# obviously do 'mkdir -p /mnt/ramdisk' before this can work
#
tmpfs /mnt/ramdisk tmpfs size=260M 0 0
#
# put logs and tmp in ramdisk ---
tmpfs   /tmptmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/logtmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/tmptmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0

Here's a similar one for a pi that used to run just nginx to serve up a 
webpage for my weewx system to grab via a custom extension.  I later 
switched to just publishing to MQTT but left the pi fstab alone since it 
was great for uptime.

tmpfs   /tmptmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/logtmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/log/nginx  tmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/tmptmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0
tmpfs   /var/www/html   tmpfs   
defaults,nosuid,mode=0755,nodev,noatime   0   0

Note - these are model-B that are particularly sensitive to power issues. 
 I've never had to do this on any pi that uses the micro SD card from the 
original zero all the way up to a current pi4.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/668ff2a9-71f6-4c31-96af-4ab2d9b8ca56n%40googlegroups.com.


Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Greg Troxel

vince  writes:

> Personally I wouldn't bother doing ramdisk on a pi3, pi3+ or pi4, and I'd 
> instead just shoot a backup of your /home/weewx tree once (to baseline it) 
> and then occasionally grab your archive and NOAA directories via cron or 
> something to another computer or dropbox or something.
>
> When you get down to it, all that is important is the archive and your 
> weewx.conf file - you can rebuild anything else in just a few minutes if it 
> ever becomes necessary.

While I see your point, I've done something in between, avoiding writes
while not going to the trouble of a sytem image that runs out of RAM
entirely after boot.

My setup is a RPI3 running NetBSD, with weewx installed in /usr/weewx,
on the uSD.

However, I have in /usr/weewx two symlinks

lrwxr-xr-x   1 gdt  wheel 16 May 22  2020 public_html -> /tmp/public_html
lrwxr-xr-x   1 gdt  wheel 23 May 22  2020 public_metric_html -> 
/tmp/public_metric_html

which means that while my software and my weewx database is on the uSD,
my generated html pages are in /tmp which is a RAM-type fs.   The html
pages are then rsynced to another machine for web access.

I also do backups every week.  Perhaps should be more often of the database.

Whether this is extending the life of my uSD card is a good question.
But it was easy and avoids a lot of writes every 5m cycle.  Certainly I
do not need to retain the gnerated html and graph files.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/rmi5yoid555.fsf%40s1.lexort.com.


signature.asc
Description: PGP signature


Re: [weewx-user] want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Graham Eddy
if you need a directory to exist (be created if necessary) on boot up (such as 
a subdirectory inside a ramdisk), i configure it in /etc/tmpfiles.d/.
in my case, running weewx as user ‘weewx’, i have a directory /run/weewx/ 
(/run/ is a ramdisk) owned by weewx for runtime stuff like pidfiles, so have 
file /etc/tmpfiles.d/weewx.conf containing
d  /run/weewx  0755 weewx weewx -
⊣ Graham Eddy ⊢

> On 13 Mar 2022, at 11:13 am, Eric K  wrote:
> 
> Vince, thanks for your idea of manually creating the 
> /home/weewx/public_html/json directory.
> I tried it and it did allow Belchertown to work with the first run of 
> wee_reports.
> 
> Later, I found if I ran wee_reports a 2nd time, the Belchertown skin 
> completes the creation of the web page in the ramdisk, because the first run 
> of wee_reports (that fails) creates the /home/weewx/public_html/json 
> directory.  That's good enough to succeed after that.
> 
> At present, the public_html directory is running inside a ramdisk.
> Since it works, I'm going to leave it like this.
> 
> I'm using the imagemagick package to add date/time info to each webcam grab.
> If nothing else, my webcam pictures are likely loading and processing faster.
> 
> Eric
[snip]

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/32CC02BF-2EB6-4CAE-AC04-2FA54B431051%40gmail.com.


Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Eric K
Vince, thanks for your idea of manually creating the 
/home/weewx/public_html/json directory.
I tried it and it did allow Belchertown to work with the first run of 
wee_reports.

Later, I found if I ran wee_reports a 2nd time, the Belchertown skin 
completes the creation of the web page in the ramdisk, because the first 
run of wee_reports (that fails) creates the /home/weewx/public_html/json 
directory.  That's good enough to succeed after that.

At present, the public_html directory is running inside a ramdisk.
Since it works, I'm going to leave it like this.

I'm using the imagemagick package to add date/time info to each webcam grab.
If nothing else, my webcam pictures are likely loading and processing 
faster.

Eric
On Saturday, March 12, 2022 at 5:10:05 PM UTC-6 Eric K wrote:

> No problem, Doug.  
> Your intention to share helpful information is appreciated!  
>
> On Saturday, March 12, 2022 at 5:00:15 PM UTC-6 do...@dougjenkins.com 
> wrote:
>
>> I am sorry, I didn't read the entire post. 
>>
>> On Sat, Mar 12, 2022, 5:33 PM Eric K  wrote:
>>
>>> Its' a Raspberry Pi 3B+ 
>>>
>>> On Saturday, March 12, 2022 at 4:25:00 PM UTC-6 do...@dougjenkins.com 
>>> wrote:
>>>
 Eric, if you have pi4 with firmware older than 09/2021, you can boot 
 from a usb3 drive. This is what I have been doing with my RPI as I have 
 lost 2 good sdcards due to write failures.

 On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:

> Hi Peter.
>
> Correct, extending the life of the SD card is my goal.
>
> I am currently rebuilding my weewx Raspberry Pi system because of a 
> suspected SD card failure.
> I had 2 local Linux users tell me that the symptoms are consistent 
> with an SD card corruption.
> The card is only 9 months old, and it's not bottom-of-the barrel 
> quality!
> I reached out for help 2 weeks ago and got zero responses.
> see:
>
> https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221
>
>
>
> On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com 
> wrote:
>
>> If you're wanting a ramdisk because SD cards are unreliable, I 
>> wouldn't bother. There is plenty of history of people running Weewx on 
>> Raspberry Pis for many years without a problem with corrupted SD cards. 
>>
>> On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:
>>
>>> I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
>>> directory exists when weewx tries to write it.
>>>
>>> I'd also add that doing it your way means your NOAA files will be 
>>> recreated every time it boots, which could take ages if you have many 
>>> years 
>>> of info like many of us do.
>>>
>>> One way would be to put something in your rc.local which runs after 
>>> things mount ala:
>>>
>>> if [ -d /home/weewx/public_html ]
>>> then
>>># prepopulate things here
>>>mkdir /home/weewx/public_html/forecast
>>> else
>>>logger "error - rc.local could not mkdir for weewx"
>>> fi
>>>
>>> You might run into timing issues if you do too much this way since 
>>> rc.local tends to run toward the end of the startup sequence, but a 
>>> quick 
>>> mkdir should work.
>>>
>>> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>>>
 Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the 
 Bullseye version of Raspberry Pi OS.
 For a Raspberry Pi (using a microSD card as the OS system drive) I 
 want to create a ramdisk for the /home/weewx/public_html directory.  
 I followed examples from various webpages on the ramdisk topic.  
 What I've tried thus far doesn't fully work.
 How are others implementing this?

 I started by renaming my /home/weewx/public_html directory to 
 /home/weewx/public_html_backup, so there would be no conflict when the 
 ramdisk was created at bootup.  
 Then, I put this line in the /etc/fstab file and rebooted.
 tmpfs   /home/weewx/public_html   tmpfs  
  defaults,noatime,size=100M   0 0
 I tested it with sudo mount -a and the new partition was visible by 
 using the df command.

 After a reboot, a /home/weewx/public_html directory was created as 
 a tmpfs volume.
 To test the functionality, I manually ran wee_reports to force the 
 webpage to be created.
 When wee_reports ran, the process crashed with errors, because some 
 of the files don't exist from previous runs of wee_reports.

 pi@rpi3b:/home/weewx $ sudo bin/wee_reports
 Using configuration file /home/weewx/weewx.conf
 Generating for all time
 Traceback (most recent call last):
   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
 get

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Eric K
No problem, Doug.  
Your intention to share helpful information is appreciated!  

On Saturday, March 12, 2022 at 5:00:15 PM UTC-6 do...@dougjenkins.com wrote:

> I am sorry, I didn't read the entire post. 
>
> On Sat, Mar 12, 2022, 5:33 PM Eric K  wrote:
>
>> Its' a Raspberry Pi 3B+ 
>>
>> On Saturday, March 12, 2022 at 4:25:00 PM UTC-6 do...@dougjenkins.com 
>> wrote:
>>
>>> Eric, if you have pi4 with firmware older than 09/2021, you can boot 
>>> from a usb3 drive. This is what I have been doing with my RPI as I have 
>>> lost 2 good sdcards due to write failures.
>>>
>>> On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:
>>>
 Hi Peter.

 Correct, extending the life of the SD card is my goal.

 I am currently rebuilding my weewx Raspberry Pi system because of a 
 suspected SD card failure.
 I had 2 local Linux users tell me that the symptoms are consistent with 
 an SD card corruption.
 The card is only 9 months old, and it's not bottom-of-the barrel 
 quality!
 I reached out for help 2 weeks ago and got zero responses.
 see:

 https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221



 On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com 
 wrote:

> If you're wanting a ramdisk because SD cards are unreliable, I 
> wouldn't bother. There is plenty of history of people running Weewx on 
> Raspberry Pis for many years without a problem with corrupted SD cards. 
>
> On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:
>
>> I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
>> directory exists when weewx tries to write it.
>>
>> I'd also add that doing it your way means your NOAA files will be 
>> recreated every time it boots, which could take ages if you have many 
>> years 
>> of info like many of us do.
>>
>> One way would be to put something in your rc.local which runs after 
>> things mount ala:
>>
>> if [ -d /home/weewx/public_html ]
>> then
>># prepopulate things here
>>mkdir /home/weewx/public_html/forecast
>> else
>>logger "error - rc.local could not mkdir for weewx"
>> fi
>>
>> You might run into timing issues if you do too much this way since 
>> rc.local tends to run toward the end of the startup sequence, but a 
>> quick 
>> mkdir should work.
>>
>> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>>
>>> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the 
>>> Bullseye version of Raspberry Pi OS.
>>> For a Raspberry Pi (using a microSD card as the OS system drive) I 
>>> want to create a ramdisk for the /home/weewx/public_html directory.  
>>> I followed examples from various webpages on the ramdisk topic.  
>>> What I've tried thus far doesn't fully work.
>>> How are others implementing this?
>>>
>>> I started by renaming my /home/weewx/public_html directory to 
>>> /home/weewx/public_html_backup, so there would be no conflict when the 
>>> ramdisk was created at bootup.  
>>> Then, I put this line in the /etc/fstab file and rebooted.
>>> tmpfs   /home/weewx/public_html   tmpfs  
>>>  defaults,noatime,size=100M   0 0
>>> I tested it with sudo mount -a and the new partition was visible by 
>>> using the df command.
>>>
>>> After a reboot, a /home/weewx/public_html directory was created as a 
>>> tmpfs volume.
>>> To test the functionality, I manually ran wee_reports to force the 
>>> webpage to be created.
>>> When wee_reports ran, the process crashed with errors, because some 
>>> of the files don't exist from previous runs of wee_reports.
>>>
>>> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
>>> Using configuration file /home/weewx/weewx.conf
>>> Generating for all time
>>> Traceback (most recent call last):
>>>   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
>>> get_extension_list
>>> with open(forecast_file, "wb+") as file:
>>> FileNotFoundError: [Errno 2] No such file or directory: 
>>> '/home/weewx/public_html/json/forecast.json'
>>>
>>> During handling of the above exception, another exception occurred:
>>>
>>> Traceback (most recent call last):
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
>>> obj.start()
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
>>> self.run()
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
>>> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in 
>>> generate
>>> ngen += self.generate(section[subsection], gen_ts)
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in 
>>> ge

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Doug Jenkins
I am sorry, I didn't read the entire post.

On Sat, Mar 12, 2022, 5:33 PM Eric K  wrote:

> Its' a Raspberry Pi 3B+
>
> On Saturday, March 12, 2022 at 4:25:00 PM UTC-6 do...@dougjenkins.com
> wrote:
>
>> Eric, if you have pi4 with firmware older than 09/2021, you can boot from
>> a usb3 drive. This is what I have been doing with my RPI as I have lost 2
>> good sdcards due to write failures.
>>
>> On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:
>>
>>> Hi Peter.
>>>
>>> Correct, extending the life of the SD card is my goal.
>>>
>>> I am currently rebuilding my weewx Raspberry Pi system because of a
>>> suspected SD card failure.
>>> I had 2 local Linux users tell me that the symptoms are consistent with
>>> an SD card corruption.
>>> The card is only 9 months old, and it's not bottom-of-the barrel quality!
>>> I reached out for help 2 weeks ago and got zero responses.
>>> see:
>>>
>>> https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221
>>>
>>>
>>>
>>> On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com
>>> wrote:
>>>
 If you're wanting a ramdisk because SD cards are unreliable, I wouldn't
 bother. There is plenty of history of people running Weewx on Raspberry Pis
 for many years without a problem with corrupted SD cards.

 On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:

> I would try 'mkdir /home/weewx/public_html/forecast' so the parent
> directory exists when weewx tries to write it.
>
> I'd also add that doing it your way means your NOAA files will be
> recreated every time it boots, which could take ages if you have many 
> years
> of info like many of us do.
>
> One way would be to put something in your rc.local which runs after
> things mount ala:
>
> if [ -d /home/weewx/public_html ]
> then
># prepopulate things here
>mkdir /home/weewx/public_html/forecast
> else
>logger "error - rc.local could not mkdir for weewx"
> fi
>
> You might run into timing issues if you do too much this way since
> rc.local tends to run toward the end of the startup sequence, but a quick
> mkdir should work.
>
> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>
>> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye
>> version of Raspberry Pi OS.
>> For a Raspberry Pi (using a microSD card as the OS system drive) I
>> want to create a ramdisk for the /home/weewx/public_html directory.
>> I followed examples from various webpages on the ramdisk topic.
>> What I've tried thus far doesn't fully work.
>> How are others implementing this?
>>
>> I started by renaming my /home/weewx/public_html directory to
>> /home/weewx/public_html_backup, so there would be no conflict when the
>> ramdisk was created at bootup.
>> Then, I put this line in the /etc/fstab file and rebooted.
>> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M
>>  0 0
>> I tested it with sudo mount -a and the new partition was visible by
>> using the df command.
>>
>> After a reboot, a /home/weewx/public_html directory was created as a
>> tmpfs volume.
>> To test the functionality, I manually ran wee_reports to force the
>> webpage to be created.
>> When wee_reports ran, the process crashed with errors, because some
>> of the files don't exist from previous runs of wee_reports.
>>
>> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
>> Using configuration file /home/weewx/weewx.conf
>> Generating for all time
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/user/belchertown.py", line 1390, in
>> get_extension_list
>> with open(forecast_file, "wb+") as file:
>> FileNotFoundError: [Errno 2] No such file or directory:
>> '/home/weewx/public_html/json/forecast.json'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
>> obj.start()
>>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
>> self.run()
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
>> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in
>> generate
>> ngen += self.generate(section[subsection], gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in
>> generate
>> ngen += self.generate(section[subsection], gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in
>> generate
>> searchList = self._getSearchList(encoding, timespan,
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in
>> _getSearchList
>> s

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread vince
Personally I wouldn't bother doing ramdisk on a pi3, pi3+ or pi4, and I'd 
instead just shoot a backup of your /home/weewx tree once (to baseline it) 
and then occasionally grab your archive and NOAA directories via cron or 
something to another computer or dropbox or something.

When you get down to it, all that is important is the archive and your 
weewx.conf file - you can rebuild anything else in just a few minutes if it 
ever becomes necessary.

On Saturday, March 12, 2022 at 2:33:23 PM UTC-8 Eric K wrote:

> Its' a Raspberry Pi 3B+ 
>
> On Saturday, March 12, 2022 at 4:25:00 PM UTC-6 do...@dougjenkins.com 
> wrote:
>
>> Eric, if you have pi4 with firmware older than 09/2021, you can boot from 
>> a usb3 drive. This is what I have been doing with my RPI as I have lost 2 
>> good sdcards due to write failures.
>>
>> On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:
>>
>>> Hi Peter.
>>>
>>> Correct, extending the life of the SD card is my goal.
>>>
>>> I am currently rebuilding my weewx Raspberry Pi system because of a 
>>> suspected SD card failure.
>>> I had 2 local Linux users tell me that the symptoms are consistent with 
>>> an SD card corruption.
>>> The card is only 9 months old, and it's not bottom-of-the barrel quality!
>>> I reached out for help 2 weeks ago and got zero responses.
>>> see:
>>>
>>> https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221
>>>
>>>
>>>
>>> On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com 
>>> wrote:
>>>
 If you're wanting a ramdisk because SD cards are unreliable, I wouldn't 
 bother. There is plenty of history of people running Weewx on Raspberry 
 Pis 
 for many years without a problem with corrupted SD cards. 

 On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:

> I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
> directory exists when weewx tries to write it.
>
> I'd also add that doing it your way means your NOAA files will be 
> recreated every time it boots, which could take ages if you have many 
> years 
> of info like many of us do.
>
> One way would be to put something in your rc.local which runs after 
> things mount ala:
>
> if [ -d /home/weewx/public_html ]
> then
># prepopulate things here
>mkdir /home/weewx/public_html/forecast
> else
>logger "error - rc.local could not mkdir for weewx"
> fi
>
> You might run into timing issues if you do too much this way since 
> rc.local tends to run toward the end of the startup sequence, but a quick 
> mkdir should work.
>
> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>
>> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye 
>> version of Raspberry Pi OS.
>> For a Raspberry Pi (using a microSD card as the OS system drive) I 
>> want to create a ramdisk for the /home/weewx/public_html directory.  
>> I followed examples from various webpages on the ramdisk topic.  
>> What I've tried thus far doesn't fully work.
>> How are others implementing this?
>>
>> I started by renaming my /home/weewx/public_html directory to 
>> /home/weewx/public_html_backup, so there would be no conflict when the 
>> ramdisk was created at bootup.  
>> Then, I put this line in the /etc/fstab file and rebooted.
>> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M  
>>  0 0
>> I tested it with sudo mount -a and the new partition was visible by 
>> using the df command.
>>
>> After a reboot, a /home/weewx/public_html directory was created as a 
>> tmpfs volume.
>> To test the functionality, I manually ran wee_reports to force the 
>> webpage to be created.
>> When wee_reports ran, the process crashed with errors, because some 
>> of the files don't exist from previous runs of wee_reports.
>>
>> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
>> Using configuration file /home/weewx/weewx.conf
>> Generating for all time
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
>> get_extension_list
>> with open(forecast_file, "wb+") as file:
>> FileNotFoundError: [Errno 2] No such file or directory: 
>> '/home/weewx/public_html/json/forecast.json'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
>> obj.start()
>>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
>> self.run()
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
>> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in 
>> generate
>

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Eric K
Its' a Raspberry Pi 3B+ 

On Saturday, March 12, 2022 at 4:25:00 PM UTC-6 do...@dougjenkins.com wrote:

> Eric, if you have pi4 with firmware older than 09/2021, you can boot from 
> a usb3 drive. This is what I have been doing with my RPI as I have lost 2 
> good sdcards due to write failures.
>
> On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:
>
>> Hi Peter.
>>
>> Correct, extending the life of the SD card is my goal.
>>
>> I am currently rebuilding my weewx Raspberry Pi system because of a 
>> suspected SD card failure.
>> I had 2 local Linux users tell me that the symptoms are consistent with 
>> an SD card corruption.
>> The card is only 9 months old, and it's not bottom-of-the barrel quality!
>> I reached out for help 2 weeks ago and got zero responses.
>> see:
>>
>> https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221
>>
>>
>>
>> On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com 
>> wrote:
>>
>>> If you're wanting a ramdisk because SD cards are unreliable, I wouldn't 
>>> bother. There is plenty of history of people running Weewx on Raspberry Pis 
>>> for many years without a problem with corrupted SD cards. 
>>>
>>> On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:
>>>
 I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
 directory exists when weewx tries to write it.

 I'd also add that doing it your way means your NOAA files will be 
 recreated every time it boots, which could take ages if you have many 
 years 
 of info like many of us do.

 One way would be to put something in your rc.local which runs after 
 things mount ala:

 if [ -d /home/weewx/public_html ]
 then
# prepopulate things here
mkdir /home/weewx/public_html/forecast
 else
logger "error - rc.local could not mkdir for weewx"
 fi

 You might run into timing issues if you do too much this way since 
 rc.local tends to run toward the end of the startup sequence, but a quick 
 mkdir should work.

 On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:

> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye 
> version of Raspberry Pi OS.
> For a Raspberry Pi (using a microSD card as the OS system drive) I 
> want to create a ramdisk for the /home/weewx/public_html directory.  
> I followed examples from various webpages on the ramdisk topic.  
> What I've tried thus far doesn't fully work.
> How are others implementing this?
>
> I started by renaming my /home/weewx/public_html directory to 
> /home/weewx/public_html_backup, so there would be no conflict when the 
> ramdisk was created at bootup.  
> Then, I put this line in the /etc/fstab file and rebooted.
> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M  
>  0 0
> I tested it with sudo mount -a and the new partition was visible by 
> using the df command.
>
> After a reboot, a /home/weewx/public_html directory was created as a 
> tmpfs volume.
> To test the functionality, I manually ran wee_reports to force the 
> webpage to be created.
> When wee_reports ran, the process crashed with errors, because some of 
> the files don't exist from previous runs of wee_reports.
>
> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
> Using configuration file /home/weewx/weewx.conf
> Generating for all time
> Traceback (most recent call last):
>   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
> get_extension_list
> with open(forecast_file, "wb+") as file:
> FileNotFoundError: [Errno 2] No such file or directory: 
> '/home/weewx/public_html/json/forecast.json'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
> obj.start()
>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
> self.run()
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in 
> generate
> ngen += self.generate(section[subsection], gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in 
> generate
> ngen += self.generate(section[subsection], gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in 
> generate
> searchList = self._getSearchList(encoding, timespan,
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in 
> _getSearchList
> searchList += obj.get_extension_list(timespan, db_lookup)
>   File "/home/weewx/bin/user/belchertown.py", line 1399, in 
> get_extension_list
> raise Warning

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Doug Jenkins
Eric, if you have pi4 with firmware older than 09/2021, you can boot from a
usb3 drive. This is what I have been doing with my RPI as I have lost 2
good sdcards due to write failures.

On Sat, Mar 12, 2022, 4:46 PM Eric K  wrote:

> Hi Peter.
>
> Correct, extending the life of the SD card is my goal.
>
> I am currently rebuilding my weewx Raspberry Pi system because of a
> suspected SD card failure.
> I had 2 local Linux users tell me that the symptoms are consistent with an
> SD card corruption.
> The card is only 9 months old, and it's not bottom-of-the barrel quality!
> I reached out for help 2 weeks ago and got zero responses.
> see:
>
> https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221
>
>
>
> On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com wrote:
>
>> If you're wanting a ramdisk because SD cards are unreliable, I wouldn't
>> bother. There is plenty of history of people running Weewx on Raspberry Pis
>> for many years without a problem with corrupted SD cards.
>>
>> On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:
>>
>>> I would try 'mkdir /home/weewx/public_html/forecast' so the parent
>>> directory exists when weewx tries to write it.
>>>
>>> I'd also add that doing it your way means your NOAA files will be
>>> recreated every time it boots, which could take ages if you have many years
>>> of info like many of us do.
>>>
>>> One way would be to put something in your rc.local which runs after
>>> things mount ala:
>>>
>>> if [ -d /home/weewx/public_html ]
>>> then
>>># prepopulate things here
>>>mkdir /home/weewx/public_html/forecast
>>> else
>>>logger "error - rc.local could not mkdir for weewx"
>>> fi
>>>
>>> You might run into timing issues if you do too much this way since
>>> rc.local tends to run toward the end of the startup sequence, but a quick
>>> mkdir should work.
>>>
>>> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>>>
 Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye
 version of Raspberry Pi OS.
 For a Raspberry Pi (using a microSD card as the OS system drive) I want
 to create a ramdisk for the /home/weewx/public_html directory.
 I followed examples from various webpages on the ramdisk topic.
 What I've tried thus far doesn't fully work.
 How are others implementing this?

 I started by renaming my /home/weewx/public_html directory to
 /home/weewx/public_html_backup, so there would be no conflict when the
 ramdisk was created at bootup.
 Then, I put this line in the /etc/fstab file and rebooted.
 tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M
  0 0
 I tested it with sudo mount -a and the new partition was visible by
 using the df command.

 After a reboot, a /home/weewx/public_html directory was created as a
 tmpfs volume.
 To test the functionality, I manually ran wee_reports to force the
 webpage to be created.
 When wee_reports ran, the process crashed with errors, because some of
 the files don't exist from previous runs of wee_reports.

 pi@rpi3b:/home/weewx $ sudo bin/wee_reports
 Using configuration file /home/weewx/weewx.conf
 Generating for all time
 Traceback (most recent call last):
   File "/home/weewx/bin/user/belchertown.py", line 1390, in
 get_extension_list
 with open(forecast_file, "wb+") as file:
 FileNotFoundError: [Errno 2] No such file or directory:
 '/home/weewx/public_html/json/forecast.json'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
 obj.start()
   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
 self.run()
   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
 ngen = self.generate(gen_dict[section_name], self.gen_ts)
   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in
 generate
 ngen += self.generate(section[subsection], gen_ts)
   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in
 generate
 ngen += self.generate(section[subsection], gen_ts)
   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in
 generate
 searchList = self._getSearchList(encoding, timespan,
   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in
 _getSearchList
 searchList += obj.get_extension_list(timespan, db_lookup)
   File "/home/weewx/bin/user/belchertown.py", line 1399, in
 get_extension_list
 raise Warning(
 Warning: Error writing forecast info to
 /home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file
 or directory: '/home/weewx/public_html/json/forecast.json'

 I found that if I copy the contents of my
 /home/weewx/public

Re: [weewx-user] Re: weewx stopped logging

2022-03-12 Thread Ed Wilts
Thanks Vince - you got me on the right track.  I added a network block in
my router to prevent my Pi from connecting to the 5Ghz network and now that
they're on the same 2.4Ghz network, I'm getting weather data via UDP again.

Now that it's getting data and it's updating the local web page and my
externally-facing website, I just need to get the updates to the weatherpi
page on the local display.  I've got the fields on the display but not the
data.  I don't know what that's about but I'll work on that some more later.

Thanks again for your help,
   .../Ed

On Sat, Mar 12, 2022 at 12:09 PM vince  wrote:

> I've never heard of the UDP not working.   Typically the mistake folks
> make is trying to put the hub on a IoT network and they forget that the
> weewx box has to be on that network too because they forget that broadcasts
> don't route. Make sure your weewx/sniffer/listener boxes are really on the
> same wifi network as the hub.
>
> If your hub is on the same network as weewx and your sniffer(s) and that
> doesn't help, then I guess get WF support involved via their forums.
>
> I'm guessing your guest LAN is a different subnet than your regular LAN
> (?) so you could try 'traceroute -n' to the ip of the hub and see if it's a
> straight shot or if it's routing through your ASUS router.
>
> But if you have them all on your normal LAN and they worked, and moved
> them and it broke, it's 'likely' that one box isn't on the same network as
> the other.
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/weewx-user/hT4aoA3t_wg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/64dd7ee2-4f57-43b4-96f4-c2cc7aff64can%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CA%2BfaV%3DLhp8TdqAuCu_W_2pWaYuHoQ5%2BgXJhcBF-Uknhdr%3DFeSA%40mail.gmail.com.


Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Eric K
Hi Peter.

Correct, extending the life of the SD card is my goal.

I am currently rebuilding my weewx Raspberry Pi system because of a 
suspected SD card failure.
I had 2 local Linux users tell me that the symptoms are consistent with an 
SD card corruption.
The card is only 9 months old, and it's not bottom-of-the barrel quality!
I reached out for help 2 weeks ago and got zero responses.
see:
https://forums.raspberrypi.com/viewtopic.php?p=1979221&hilit=kernel+panic#p1979221



On Saturday, March 12, 2022 at 3:35:06 PM UTC-6 peterq...@gmail.com wrote:

> If you're wanting a ramdisk because SD cards are unreliable, I wouldn't 
> bother. There is plenty of history of people running Weewx on Raspberry Pis 
> for many years without a problem with corrupted SD cards. 
>
> On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:
>
>> I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
>> directory exists when weewx tries to write it.
>>
>> I'd also add that doing it your way means your NOAA files will be 
>> recreated every time it boots, which could take ages if you have many years 
>> of info like many of us do.
>>
>> One way would be to put something in your rc.local which runs after 
>> things mount ala:
>>
>> if [ -d /home/weewx/public_html ]
>> then
>># prepopulate things here
>>mkdir /home/weewx/public_html/forecast
>> else
>>logger "error - rc.local could not mkdir for weewx"
>> fi
>>
>> You might run into timing issues if you do too much this way since 
>> rc.local tends to run toward the end of the startup sequence, but a quick 
>> mkdir should work.
>>
>> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>>
>>> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye 
>>> version of Raspberry Pi OS.
>>> For a Raspberry Pi (using a microSD card as the OS system drive) I want 
>>> to create a ramdisk for the /home/weewx/public_html directory.  
>>> I followed examples from various webpages on the ramdisk topic.  
>>> What I've tried thus far doesn't fully work.
>>> How are others implementing this?
>>>
>>> I started by renaming my /home/weewx/public_html directory to 
>>> /home/weewx/public_html_backup, so there would be no conflict when the 
>>> ramdisk was created at bootup.  
>>> Then, I put this line in the /etc/fstab file and rebooted.
>>> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M   0 
>>> 0
>>> I tested it with sudo mount -a and the new partition was visible by 
>>> using the df command.
>>>
>>> After a reboot, a /home/weewx/public_html directory was created as a 
>>> tmpfs volume.
>>> To test the functionality, I manually ran wee_reports to force the 
>>> webpage to be created.
>>> When wee_reports ran, the process crashed with errors, because some of 
>>> the files don't exist from previous runs of wee_reports.
>>>
>>> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
>>> Using configuration file /home/weewx/weewx.conf
>>> Generating for all time
>>> Traceback (most recent call last):
>>>   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
>>> get_extension_list
>>> with open(forecast_file, "wb+") as file:
>>> FileNotFoundError: [Errno 2] No such file or directory: 
>>> '/home/weewx/public_html/json/forecast.json'
>>>
>>> During handling of the above exception, another exception occurred:
>>>
>>> Traceback (most recent call last):
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
>>> obj.start()
>>>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
>>> self.run()
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
>>> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
>>> ngen += self.generate(section[subsection], gen_ts)
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
>>> ngen += self.generate(section[subsection], gen_ts)
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in generate
>>> searchList = self._getSearchList(encoding, timespan,
>>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in 
>>> _getSearchList
>>> searchList += obj.get_extension_list(timespan, db_lookup)
>>>   File "/home/weewx/bin/user/belchertown.py", line 1399, in 
>>> get_extension_list
>>> raise Warning(
>>> Warning: Error writing forecast info to 
>>> /home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file 
>>> or directory: '/home/weewx/public_html/json/forecast.json'  
>>>
>>> I found that if I copy the contents of my /home/weewx/public_html_backup 
>>> folder into the /home/weewx/public_html ramdisk, then wee_reports completes 
>>> and creates the fully populated /home/weewx/public_html directory.
>>>
>>> Is everyone else populating the ramdisk with a backup of the puclic_html 
>>> folder at bootup time?
>>>
>>> Thanks,
>>> Eric
>>>
>> -- 
>> You received this mess

Re: [weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread p q
If you're wanting a ramdisk because SD cards are unreliable, I wouldn't
bother. There is plenty of history of people running Weewx on Raspberry Pis
for many years without a problem with corrupted SD cards.

On Sat, Mar 12, 2022 at 12:55 PM vince  wrote:

> I would try 'mkdir /home/weewx/public_html/forecast' so the parent
> directory exists when weewx tries to write it.
>
> I'd also add that doing it your way means your NOAA files will be
> recreated every time it boots, which could take ages if you have many years
> of info like many of us do.
>
> One way would be to put something in your rc.local which runs after things
> mount ala:
>
> if [ -d /home/weewx/public_html ]
> then
># prepopulate things here
>mkdir /home/weewx/public_html/forecast
> else
>logger "error - rc.local could not mkdir for weewx"
> fi
>
> You might run into timing issues if you do too much this way since
> rc.local tends to run toward the end of the startup sequence, but a quick
> mkdir should work.
>
> On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:
>
>> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye
>> version of Raspberry Pi OS.
>> For a Raspberry Pi (using a microSD card as the OS system drive) I want
>> to create a ramdisk for the /home/weewx/public_html directory.
>> I followed examples from various webpages on the ramdisk topic.
>> What I've tried thus far doesn't fully work.
>> How are others implementing this?
>>
>> I started by renaming my /home/weewx/public_html directory to
>> /home/weewx/public_html_backup, so there would be no conflict when the
>> ramdisk was created at bootup.
>> Then, I put this line in the /etc/fstab file and rebooted.
>> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M   0 0
>> I tested it with sudo mount -a and the new partition was visible by using
>> the df command.
>>
>> After a reboot, a /home/weewx/public_html directory was created as a
>> tmpfs volume.
>> To test the functionality, I manually ran wee_reports to force the
>> webpage to be created.
>> When wee_reports ran, the process crashed with errors, because some of
>> the files don't exist from previous runs of wee_reports.
>>
>> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
>> Using configuration file /home/weewx/weewx.conf
>> Generating for all time
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/user/belchertown.py", line 1390, in
>> get_extension_list
>> with open(forecast_file, "wb+") as file:
>> FileNotFoundError: [Errno 2] No such file or directory:
>> '/home/weewx/public_html/json/forecast.json'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
>> obj.start()
>>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
>> self.run()
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
>> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
>> ngen += self.generate(section[subsection], gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
>> ngen += self.generate(section[subsection], gen_ts)
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in generate
>> searchList = self._getSearchList(encoding, timespan,
>>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in
>> _getSearchList
>> searchList += obj.get_extension_list(timespan, db_lookup)
>>   File "/home/weewx/bin/user/belchertown.py", line 1399, in
>> get_extension_list
>> raise Warning(
>> Warning: Error writing forecast info to
>> /home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file
>> or directory: '/home/weewx/public_html/json/forecast.json'
>>
>> I found that if I copy the contents of my /home/weewx/public_html_backup
>> folder into the /home/weewx/public_html ramdisk, then wee_reports completes
>> and creates the fully populated /home/weewx/public_html directory.
>>
>> Is everyone else populating the ramdisk with a backup of the puclic_html
>> folder at bootup time?
>>
>> Thanks,
>> Eric
>>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/71a87cdb-be9b-4cfc-b67b-e72802faceean%40googlegroups.com
> 
> .
>


-- 
Peter Quinn
(415)794-2264

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an e

[weewx-user] Re: want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread vince
I would try 'mkdir /home/weewx/public_html/forecast' so the parent 
directory exists when weewx tries to write it.

I'd also add that doing it your way means your NOAA files will be recreated 
every time it boots, which could take ages if you have many years of info 
like many of us do.

One way would be to put something in your rc.local which runs after things 
mount ala:

if [ -d /home/weewx/public_html ]
then
   # prepopulate things here
   mkdir /home/weewx/public_html/forecast
else
   logger "error - rc.local could not mkdir for weewx"
fi

You might run into timing issues if you do too much this way since rc.local 
tends to run toward the end of the startup sequence, but a quick mkdir 
should work.

On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote:

> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye 
> version of Raspberry Pi OS.
> For a Raspberry Pi (using a microSD card as the OS system drive) I want to 
> create a ramdisk for the /home/weewx/public_html directory.  
> I followed examples from various webpages on the ramdisk topic.  
> What I've tried thus far doesn't fully work.
> How are others implementing this?
>
> I started by renaming my /home/weewx/public_html directory to 
> /home/weewx/public_html_backup, so there would be no conflict when the 
> ramdisk was created at bootup.  
> Then, I put this line in the /etc/fstab file and rebooted.
> tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M   0 0
> I tested it with sudo mount -a and the new partition was visible by using 
> the df command.
>
> After a reboot, a /home/weewx/public_html directory was created as a tmpfs 
> volume.
> To test the functionality, I manually ran wee_reports to force the webpage 
> to be created.
> When wee_reports ran, the process crashed with errors, because some of the 
> files don't exist from previous runs of wee_reports.
>
> pi@rpi3b:/home/weewx $ sudo bin/wee_reports
> Using configuration file /home/weewx/weewx.conf
> Generating for all time
> Traceback (most recent call last):
>   File "/home/weewx/bin/user/belchertown.py", line 1390, in 
> get_extension_list
> with open(forecast_file, "wb+") as file:
> FileNotFoundError: [Errno 2] No such file or directory: 
> '/home/weewx/public_html/json/forecast.json'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
> obj.start()
>   File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
> self.run()
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
> ngen = self.generate(gen_dict[section_name], self.gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
> ngen += self.generate(section[subsection], gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
> ngen += self.generate(section[subsection], gen_ts)
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in generate
> searchList = self._getSearchList(encoding, timespan,
>   File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in 
> _getSearchList
> searchList += obj.get_extension_list(timespan, db_lookup)
>   File "/home/weewx/bin/user/belchertown.py", line 1399, in 
> get_extension_list
> raise Warning(
> Warning: Error writing forecast info to 
> /home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file 
> or directory: '/home/weewx/public_html/json/forecast.json'  
>
> I found that if I copy the contents of my /home/weewx/public_html_backup 
> folder into the /home/weewx/public_html ramdisk, then wee_reports completes 
> and creates the fully populated /home/weewx/public_html directory.
>
> Is everyone else populating the ramdisk with a backup of the puclic_html 
> folder at bootup time?
>
> Thanks,
> Eric
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/71a87cdb-be9b-4cfc-b67b-e72802faceean%40googlegroups.com.


[weewx-user] want to have /home/weewx/public_html in a ramdisk

2022-03-12 Thread Eric K
Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye 
version of Raspberry Pi OS.
For a Raspberry Pi (using a microSD card as the OS system drive) I want to 
create a ramdisk for the /home/weewx/public_html directory.  
I followed examples from various webpages on the ramdisk topic.  
What I've tried thus far doesn't fully work.
How are others implementing this?

I started by renaming my /home/weewx/public_html directory to 
/home/weewx/public_html_backup, so there would be no conflict when the 
ramdisk was created at bootup.  
Then, I put this line in the /etc/fstab file and rebooted.
tmpfs   /home/weewx/public_html   tmpfs   defaults,noatime,size=100M   0 0
I tested it with sudo mount -a and the new partition was visible by using 
the df command.

After a reboot, a /home/weewx/public_html directory was created as a tmpfs 
volume.
To test the functionality, I manually ran wee_reports to force the webpage 
to be created.
When wee_reports ran, the process crashed with errors, because some of the 
files don't exist from previous runs of wee_reports.

pi@rpi3b:/home/weewx $ sudo bin/wee_reports
Using configuration file /home/weewx/weewx.conf
Generating for all time
Traceback (most recent call last):
  File "/home/weewx/bin/user/belchertown.py", line 1390, in 
get_extension_list
with open(forecast_file, "wb+") as file:
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/weewx/public_html/json/forecast.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
obj.start()
  File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
self.run()
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run
ngen = self.generate(gen_dict[section_name], self.gen_ts)
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
ngen += self.generate(section[subsection], gen_ts)
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate
ngen += self.generate(section[subsection], gen_ts)
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in generate
searchList = self._getSearchList(encoding, timespan,
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in 
_getSearchList
searchList += obj.get_extension_list(timespan, db_lookup)
  File "/home/weewx/bin/user/belchertown.py", line 1399, in 
get_extension_list
raise Warning(
Warning: Error writing forecast info to 
/home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file 
or directory: '/home/weewx/public_html/json/forecast.json'  

I found that if I copy the contents of my /home/weewx/public_html_backup 
folder into the /home/weewx/public_html ramdisk, then wee_reports completes 
and creates the fully populated /home/weewx/public_html directory.

Is everyone else populating the ramdisk with a backup of the puclic_html 
folder at bootup time?

Thanks,
Eric

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/5b24c101-f827-4c57-a4ec-252763757e8cn%40googlegroups.com.


Re: [weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
Regardless of the errors. Do you think that my code is acceptable to get 
archive data every minute?

Thanks,
Saverio

On Saturday, 12 March 2022 at 19:30:55 UTC+1 Saverio Guzzo wrote:

> Thanks for you answer Vince.
> True, the message is clear! However, the file 
> "/usr/local/lib/python3.8/logging/handlers.py" 
> is there as expected! That's why I'm surprised by the logging errors.
> It's already a few weeks I'm chasing this error :(
>
> If you guys have additional suggestions, please let me know
>
> On Saturday, 12 March 2022 at 18:48:35 UTC+1 vince wrote:
>
>> "Bad file descriptor", "File 
>> "/usr/local/lib/python3.8/logging/handlers.py" No such file or directory"
>>
>> Seems pretty clear to me.  Your docker image doesn't appear to have the 
>> logging stuff built into it at the location python expects.
>>
>> Poke around in a shell to see what's in there with something like "docker 
>> run --rm -it yourimagename bash" 
>>
>>
>> On Saturday, March 12, 2022 at 9:41:38 AM UTC-8 Saverio Guzzo wrote:
>>
>>> Hi, thanks for your answer!
>>> Yes, this is a very good insight and suggestion. Before, I was using 
>>> Apache Pulsar as a broker, but somehow the people working on the backend 
>>> have decided to move to a REST service.
>>>
>>> Anyhow, I think my issue is strictly related to logging.. if you have 
>>> any suggestions on how to solve it, please let me know! :)
>>>
>>> Thank you very much,
>>> Saverio
>>>
>>> On Saturday, 12 March 2022 at 14:22:25 UTC+1 do...@dougjenkins.com 
>>> wrote:
>>>
 Saverio:

 Reading your post, have you considered using mqtt for each station node 
 publishing it's archive data to a single broker?

 I wonder if you could do the following to achieve the same goal:

 1. Set each station node archive interval to 1 minute.
 2. Install weewx mqtt extension on each node 
 3. Configure each node to publish to a different topic, for example 
 weather-n1, n2,etc.
 4. Configure the mqtt driver to just publish archive data.
 5. Setup a mosquito mqtt broker on the same network to collect all the 
 data. It can be setup in a container.

 This assumes all of your nodes are on the same network, although you 
 could setup the mqtt broker in a cloud instance if the nodes are not on 
 the 
 same network.

 That way you will get the full archive record published from each 
 station. You would just need to focus on consuming the published data from 
 the broker. At least all the data will be in a single place.

 Just a thought.

 On Sat, Mar 12, 2022, 6:50 AM Saverio Guzzo  wrote:

> PS. One detail that I forgot to mention: Balena uses docker images, 
> for running the program I'm using 
> balenalib/raspberrypi4-64-python:3.8-stretch-run 
> 
>
> On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:
>
>> Hey community,
>>
>> I have a fleet of Davis weather stations connected to as many 
>> RaspberryPis, on which I am running the vantage drivers as a standalone 
>> program on docker container, deployed using Balena 
>> .
>> I'd like my program to send data every minute to a REST API and I've 
>> been looking into some way to get archive data from a in loop, but I'm 
>> not 
>> sure I'm doing it the right way.
>>
>> What I did was defining in the driver's main method something like:
>>
>> *while True:*
>> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
>> datetime.timedelta(minutes=1))*
>> * for packet in vantage.genDavisArchiveRecords(since_ts):*
>> * try:*
>> * new_packet = weewx.units.to_METRICWX(packet)*
>> * davispusher.send_message(payload=new_packet)*
>> * log.debug(davispusher.payload)*
>> * except Exception as e:*
>> * log.debug("Found an exception: %s" % e)*
>> * time.sleep(1.2)*
>> * continue*
>> * time.sleep(60)*
>>
>> Where davispusher is an instance of a simple class that is needed to 
>> add some values to the archive record and send the message and is 
>> defined 
>> as:
>> *class DavisPusher:*
>> * def __init__(self, host='https://mywebsite.somewhere 
>> , port=8080, endpoint='davis'):*
>> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
>> * endpoint=endpoint,*
>> * port=port)*
>> * self.payload = {}*
>>
>> * def format_message(self,*
>> * payload: dict,*
>> * sensor_id: str = environ['SENSOR_ID'],*
>> * latitude: str = environ['LATITUDE'],*
>> * longitude: str = environ['LONGITUDE'],*
>> * altitude: str = environ['ALTITUDE'],*
>> * ) -> dict:*
>> * """Formats message for backend."

Re: [weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
Thanks for you answer Vince.
True, the message is clear! However, the file 
"/usr/local/lib/python3.8/logging/handlers.py" 
is there as expected! That's why I'm surprised by the logging errors.
It's already a few weeks I'm chasing this error :(

If you guys have additional suggestions, please let me know

On Saturday, 12 March 2022 at 18:48:35 UTC+1 vince wrote:

> "Bad file descriptor", "File 
> "/usr/local/lib/python3.8/logging/handlers.py" No such file or directory"
>
> Seems pretty clear to me.  Your docker image doesn't appear to have the 
> logging stuff built into it at the location python expects.
>
> Poke around in a shell to see what's in there with something like "docker 
> run --rm -it yourimagename bash" 
>
>
> On Saturday, March 12, 2022 at 9:41:38 AM UTC-8 Saverio Guzzo wrote:
>
>> Hi, thanks for your answer!
>> Yes, this is a very good insight and suggestion. Before, I was using 
>> Apache Pulsar as a broker, but somehow the people working on the backend 
>> have decided to move to a REST service.
>>
>> Anyhow, I think my issue is strictly related to logging.. if you have any 
>> suggestions on how to solve it, please let me know! :)
>>
>> Thank you very much,
>> Saverio
>>
>> On Saturday, 12 March 2022 at 14:22:25 UTC+1 do...@dougjenkins.com wrote:
>>
>>> Saverio:
>>>
>>> Reading your post, have you considered using mqtt for each station node 
>>> publishing it's archive data to a single broker?
>>>
>>> I wonder if you could do the following to achieve the same goal:
>>>
>>> 1. Set each station node archive interval to 1 minute.
>>> 2. Install weewx mqtt extension on each node 
>>> 3. Configure each node to publish to a different topic, for example 
>>> weather-n1, n2,etc.
>>> 4. Configure the mqtt driver to just publish archive data.
>>> 5. Setup a mosquito mqtt broker on the same network to collect all the 
>>> data. It can be setup in a container.
>>>
>>> This assumes all of your nodes are on the same network, although you 
>>> could setup the mqtt broker in a cloud instance if the nodes are not on the 
>>> same network.
>>>
>>> That way you will get the full archive record published from each 
>>> station. You would just need to focus on consuming the published data from 
>>> the broker. At least all the data will be in a single place.
>>>
>>> Just a thought.
>>>
>>> On Sat, Mar 12, 2022, 6:50 AM Saverio Guzzo  wrote:
>>>
 PS. One detail that I forgot to mention: Balena uses docker images, for 
 running the program I'm using 
 balenalib/raspberrypi4-64-python:3.8-stretch-run 
 

 On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:

> Hey community,
>
> I have a fleet of Davis weather stations connected to as many 
> RaspberryPis, on which I am running the vantage drivers as a standalone 
> program on docker container, deployed using Balena 
> .
> I'd like my program to send data every minute to a REST API and I've 
> been looking into some way to get archive data from a in loop, but I'm 
> not 
> sure I'm doing it the right way.
>
> What I did was defining in the driver's main method something like:
>
> *while True:*
> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
> datetime.timedelta(minutes=1))*
> * for packet in vantage.genDavisArchiveRecords(since_ts):*
> * try:*
> * new_packet = weewx.units.to_METRICWX(packet)*
> * davispusher.send_message(payload=new_packet)*
> * log.debug(davispusher.payload)*
> * except Exception as e:*
> * log.debug("Found an exception: %s" % e)*
> * time.sleep(1.2)*
> * continue*
> * time.sleep(60)*
>
> Where davispusher is an instance of a simple class that is needed to 
> add some values to the archive record and send the message and is defined 
> as:
> *class DavisPusher:*
> * def __init__(self, host='https://mywebsite.somewhere 
> , port=8080, endpoint='davis'):*
> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
> * endpoint=endpoint,*
> * port=port)*
> * self.payload = {}*
>
> * def format_message(self,*
> * payload: dict,*
> * sensor_id: str = environ['SENSOR_ID'],*
> * latitude: str = environ['LATITUDE'],*
> * longitude: str = environ['LONGITUDE'],*
> * altitude: str = environ['ALTITUDE'],*
> * ) -> dict:*
> * """Formats message for backend."""*
>
> * payload_copy = payload.copy()*
> * try:*
> * self.payload = payload_copy*
> * self.payload['sensor_id'] = sensor_id*
> * self.payload['altitude'] = float(altitude)*
> * self.payload['longitude'] = float(longitude)*
> * self.payload['latitude'] = float(latitude)*
>
> * except E

Re: [weewx-user] Re: weewx stopped logging

2022-03-12 Thread vince
I've never heard of the UDP not working.   Typically the mistake folks make 
is trying to put the hub on a IoT network and they forget that the weewx 
box has to be on that network too because they forget that broadcasts don't 
route. Make sure your weewx/sniffer/listener boxes are really on the same 
wifi network as the hub. 

If your hub is on the same network as weewx and your sniffer(s) and that 
doesn't help, then I guess get WF support involved via their forums.

I'm guessing your guest LAN is a different subnet than your regular LAN (?) 
so you could try 'traceroute -n' to the ip of the hub and see if it's a 
straight shot or if it's routing through your ASUS router.

But if you have them all on your normal LAN and they worked, and moved them 
and it broke, it's 'likely' that one box isn't on the same network as the 
other.



-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/64dd7ee2-4f57-43b4-96f4-c2cc7aff64can%40googlegroups.com.


Re: [weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread vince
"Bad file descriptor", "File "/usr/local/lib/python3.8/logging/handlers.py" 
No such file or directory"

Seems pretty clear to me.  Your docker image doesn't appear to have the 
logging stuff built into it at the location python expects.

Poke around in a shell to see what's in there with something like "docker 
run --rm -it yourimagename bash" 


On Saturday, March 12, 2022 at 9:41:38 AM UTC-8 Saverio Guzzo wrote:

> Hi, thanks for your answer!
> Yes, this is a very good insight and suggestion. Before, I was using 
> Apache Pulsar as a broker, but somehow the people working on the backend 
> have decided to move to a REST service.
>
> Anyhow, I think my issue is strictly related to logging.. if you have any 
> suggestions on how to solve it, please let me know! :)
>
> Thank you very much,
> Saverio
>
> On Saturday, 12 March 2022 at 14:22:25 UTC+1 do...@dougjenkins.com wrote:
>
>> Saverio:
>>
>> Reading your post, have you considered using mqtt for each station node 
>> publishing it's archive data to a single broker?
>>
>> I wonder if you could do the following to achieve the same goal:
>>
>> 1. Set each station node archive interval to 1 minute.
>> 2. Install weewx mqtt extension on each node 
>> 3. Configure each node to publish to a different topic, for example 
>> weather-n1, n2,etc.
>> 4. Configure the mqtt driver to just publish archive data.
>> 5. Setup a mosquito mqtt broker on the same network to collect all the 
>> data. It can be setup in a container.
>>
>> This assumes all of your nodes are on the same network, although you 
>> could setup the mqtt broker in a cloud instance if the nodes are not on the 
>> same network.
>>
>> That way you will get the full archive record published from each 
>> station. You would just need to focus on consuming the published data from 
>> the broker. At least all the data will be in a single place.
>>
>> Just a thought.
>>
>> On Sat, Mar 12, 2022, 6:50 AM Saverio Guzzo  wrote:
>>
>>> PS. One detail that I forgot to mention: Balena uses docker images, for 
>>> running the program I'm using 
>>> balenalib/raspberrypi4-64-python:3.8-stretch-run 
>>> 
>>>
>>> On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:
>>>
 Hey community,

 I have a fleet of Davis weather stations connected to as many 
 RaspberryPis, on which I am running the vantage drivers as a standalone 
 program on docker container, deployed using Balena 
 .
 I'd like my program to send data every minute to a REST API and I've 
 been looking into some way to get archive data from a in loop, but I'm not 
 sure I'm doing it the right way.

 What I did was defining in the driver's main method something like:

 *while True:*
 * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
 datetime.timedelta(minutes=1))*
 * for packet in vantage.genDavisArchiveRecords(since_ts):*
 * try:*
 * new_packet = weewx.units.to_METRICWX(packet)*
 * davispusher.send_message(payload=new_packet)*
 * log.debug(davispusher.payload)*
 * except Exception as e:*
 * log.debug("Found an exception: %s" % e)*
 * time.sleep(1.2)*
 * continue*
 * time.sleep(60)*

 Where davispusher is an instance of a simple class that is needed to 
 add some values to the archive record and send the message and is defined 
 as:
 *class DavisPusher:*
 * def __init__(self, host='https://mywebsite.somewhere 
 , port=8080, endpoint='davis'):*
 * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
 * endpoint=endpoint,*
 * port=port)*
 * self.payload = {}*

 * def format_message(self,*
 * payload: dict,*
 * sensor_id: str = environ['SENSOR_ID'],*
 * latitude: str = environ['LATITUDE'],*
 * longitude: str = environ['LONGITUDE'],*
 * altitude: str = environ['ALTITUDE'],*
 * ) -> dict:*
 * """Formats message for backend."""*

 * payload_copy = payload.copy()*
 * try:*
 * self.payload = payload_copy*
 * self.payload['sensor_id'] = sensor_id*
 * self.payload['altitude'] = float(altitude)*
 * self.payload['longitude'] = float(longitude)*
 * self.payload['latitude'] = float(latitude)*

 * except Exception:*
 * self.payload = {}*
 * def send_message(self, payload):*
 * '''formats and sends message to backend'''*
 * self.format_message(payload)*
 * resp = requests.post (self._endpoint, data = 
 json.dumps(self.payload), allow_redirects = True)*
 * log.debug("got HTTP statuscode %s", resp.status_code)*

 However, my logs are full of logging errors ("Bad file descriptor", 
 "File "/usr/local/lib/python3.8/logging/handlers.py

Re: [weewx-user] Re: weewx stopped logging

2022-03-12 Thread Ed Wilts
Thanks Vince,

I did change share_socket to True but have weewx down for safety while I
debug this.
Your tool doesn't show any incoming UDP packets.  This just sits there
forever, not displaying anything:
pi@weatherpi:~/weatherflow-udp-listener $ ./listen.py --raw

I know I have TCP from the hub because I'm seeing updates to
https://tempestwx.com/station/57399/graph/159963/temp/4 (and wunderground)
so it's just the UDP bits that aren't working.  But they did work for over
6 months :(

It's not just your tool - I also tested with tcpdump and netcat and both
come up dry.

I reconfigured the wireless on both the Pi and the Tempest to use the same
2.4Ghz SSID (my home guest network - my main internal network is both 2.4
and 5 with the same SSID managed by the ASUS router.)

So now that I've demonstrated that UDP packets aren't getting from my hub
to my Pi, what can I do?  They're sitting about a foot apart from each
other.

Thanks again,
   .../Ed

On Fri, Mar 11, 2022 at 11:01 AM vince  wrote:

> Run my standalone UDP listener with the --raw option and see if your
> computer is hearing anything (github link)
> 
>
> Or run wireshark if you know how to do that.  Basically sniff the
> wire/wireless.
>
> You have the weewx driver set to "share_socket = False" so you will need
> to shut down weewx first.  FWIW, I recommend setting that True so multiple
> programs can listen for the broadcasts.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/weewx-user/hT4aoA3t_wg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/b5719a40-d68a-45e7-89eb-5bc97921946fn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CA%2BfaV%3DLRe1Y%2BaDfr1%3Dpw%3DUovv-0uMzgBrV85edxkNiD6pxDeKg%40mail.gmail.com.


Re: [weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
Hi, thanks for your answer!
Yes, this is a very good insight and suggestion. Before, I was using Apache 
Pulsar as a broker, but somehow the people working on the backend have 
decided to move to a REST service.

Anyhow, I think my issue is strictly related to logging.. if you have any 
suggestions on how to solve it, please let me know! :)

Thank you very much,
Saverio

On Saturday, 12 March 2022 at 14:22:25 UTC+1 do...@dougjenkins.com wrote:

> Saverio:
>
> Reading your post, have you considered using mqtt for each station node 
> publishing it's archive data to a single broker?
>
> I wonder if you could do the following to achieve the same goal:
>
> 1. Set each station node archive interval to 1 minute.
> 2. Install weewx mqtt extension on each node 
> 3. Configure each node to publish to a different topic, for example 
> weather-n1, n2,etc.
> 4. Configure the mqtt driver to just publish archive data.
> 5. Setup a mosquito mqtt broker on the same network to collect all the 
> data. It can be setup in a container.
>
> This assumes all of your nodes are on the same network, although you could 
> setup the mqtt broker in a cloud instance if the nodes are not on the same 
> network.
>
> That way you will get the full archive record published from each station. 
> You would just need to focus on consuming the published data from the 
> broker. At least all the data will be in a single place.
>
> Just a thought.
>
> On Sat, Mar 12, 2022, 6:50 AM Saverio Guzzo  wrote:
>
>> PS. One detail that I forgot to mention: Balena uses docker images, for 
>> running the program I'm using 
>> balenalib/raspberrypi4-64-python:3.8-stretch-run 
>> 
>>
>> On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:
>>
>>> Hey community,
>>>
>>> I have a fleet of Davis weather stations connected to as many 
>>> RaspberryPis, on which I am running the vantage drivers as a standalone 
>>> program on docker container, deployed using Balena 
>>> .
>>> I'd like my program to send data every minute to a REST API and I've 
>>> been looking into some way to get archive data from a in loop, but I'm not 
>>> sure I'm doing it the right way.
>>>
>>> What I did was defining in the driver's main method something like:
>>>
>>> *while True:*
>>> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
>>> datetime.timedelta(minutes=1))*
>>> * for packet in vantage.genDavisArchiveRecords(since_ts):*
>>> * try:*
>>> * new_packet = weewx.units.to_METRICWX(packet)*
>>> * davispusher.send_message(payload=new_packet)*
>>> * log.debug(davispusher.payload)*
>>> * except Exception as e:*
>>> * log.debug("Found an exception: %s" % e)*
>>> * time.sleep(1.2)*
>>> * continue*
>>> * time.sleep(60)*
>>>
>>> Where davispusher is an instance of a simple class that is needed to add 
>>> some values to the archive record and send the message and is defined as:
>>> *class DavisPusher:*
>>> * def __init__(self, host='https://mywebsite.somewhere 
>>> , port=8080, endpoint='davis'):*
>>> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
>>> * endpoint=endpoint,*
>>> * port=port)*
>>> * self.payload = {}*
>>>
>>> * def format_message(self,*
>>> * payload: dict,*
>>> * sensor_id: str = environ['SENSOR_ID'],*
>>> * latitude: str = environ['LATITUDE'],*
>>> * longitude: str = environ['LONGITUDE'],*
>>> * altitude: str = environ['ALTITUDE'],*
>>> * ) -> dict:*
>>> * """Formats message for backend."""*
>>>
>>> * payload_copy = payload.copy()*
>>> * try:*
>>> * self.payload = payload_copy*
>>> * self.payload['sensor_id'] = sensor_id*
>>> * self.payload['altitude'] = float(altitude)*
>>> * self.payload['longitude'] = float(longitude)*
>>> * self.payload['latitude'] = float(latitude)*
>>>
>>> * except Exception:*
>>> * self.payload = {}*
>>> * def send_message(self, payload):*
>>> * '''formats and sends message to backend'''*
>>> * self.format_message(payload)*
>>> * resp = requests.post (self._endpoint, data = 
>>> json.dumps(self.payload), allow_redirects = True)*
>>> * log.debug("got HTTP statuscode %s", resp.status_code)*
>>>
>>> However, my logs are full of logging errors ("Bad file descriptor", 
>>> "File "/usr/local/lib/python3.8/logging/handlers.py" No such file or 
>>> directory")
>>> I guess those are errors due to logging configuration, but I'm not sure 
>>> how to address them. I created a GitHub Gist 
>>>  
>>> in order not to pollute this post!
>>>
>>> Also, what I would like to achieve is the possibility to configure the 
>>> various consoles (set time, set coordinates) at startup using environment 
>>> variables. How could I do this using the VantageConfigurator class?
>>>
>>> Thanks a lot in advance for you

[weewx-user] Re: MQTT Belchertown server_url Syntax?

2022-03-12 Thread Michael
Not better, but different ;)
In the last error message the MQTT were not sent by weewx at all. 
With the new error message the MQTT data are not accepted by the MQTT 
server. Is the user you entered in the weewx configuration also allowed to 
receive the data on the MQTT server?
Here you can find a good description about MQTT and weewx: 
https://www.woellsdorf-wetter.de/software/mosquitto.html

Michael


Geni schrieb am Samstag, 12. März 2022 um 16:17:43 UTC+1:

> Not much better, I had already tried
> Mar 12 16:12:13 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:18 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:23 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:28 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
> to publish record 2022-03-12 16:12:13 CET (1647097933): Failed upload after 
> 3 tries
> Mar 12 16:12:28 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:33 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:38 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:43 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
> to publish record 2022-03-12 16:12:13 CET (1647097933): Failed upload after 
> 3 tries
> Mar 12 16:12:43 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:48 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:53 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
> Mar 12 16:12:58 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
> to publish record 2022-03-12 16:12:15 CET (1647097935): Failed upload after 
> 3 tries
> Mar 12 16:12:58 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
> attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
> zurückgesetzt
>
> Michael schrieb am Samstag, 12. März 2022 um 14:11:19 UTC+1:
>
>> Hi,
>>
>> try it with this syntax:
>> server_url = mqtt://name:pass...@192.168.1.75:1883/ 
>> 
>>
>> Michael
>> Geni schrieb am Samstag, 12. März 2022 um 12:23:16 UTC+1:
>>
>>> I have a local MQTT broker Mosquitto on a Synology (Docker image).
>>> With Tasmotta flashed switches this works fine
>>>
>>> I use this extension https://github.com/matthewwall/weewx-mqtt
>>>
>>> What should be the syntax for the server_url in weewx?
>>> [[MQTT]]
>>> server_url = 192.168.56.1:1883/
>>> topic = weather
>>> unit_system = METRIC
>>> binding = loop, archive
>>> aggregation = aggregate
>>>
>>>
>>> In my attempts there were the following errors
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>>> "/usr/share/weewx/weewx/restx.py", line 385, in run_loop
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>>> self.process_record(_record, dbmanager)
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>>> "/usr/share/weewx/user/mqtt.py", line 494, in process_record
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>>> mc.connect(url.hostname, url.port)
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>>> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 838, in connect
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>>> self.connect_async(host, port, keepalive, bind_address)
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>>> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 893, in 
>>> connect_async
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>>> raise ValueError('Invalid host.')
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>>> ValueError: Invalid host.
>>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] CRITICAL weewx.restx: MQTT: 
>>> Thread terminating. Reason: Invalid host.
>>>
>>> Does this work with my chosen MQTT extension?
>>> Are there any better variants for this?
>>>
>>> Thank you in advanced 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe f

[weewx-user] Re: MQTT Belchertown server_url Syntax?

2022-03-12 Thread Geni
Not much better, I had already tried
Mar 12 16:12:13 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:18 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:23 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:28 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
to publish record 2022-03-12 16:12:13 CET (1647097933): Failed upload after 
3 tries
Mar 12 16:12:28 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:33 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:38 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:43 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
to publish record 2022-03-12 16:12:13 CET (1647097933): Failed upload after 
3 tries
Mar 12 16:12:43 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:48 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 2: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:53 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 3: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt
Mar 12 16:12:58 Wetter-Raspi weewx[16406] ERROR weewx.restx: MQTT: Failed 
to publish record 2022-03-12 16:12:15 CET (1647097935): Failed upload after 
3 tries
Mar 12 16:12:58 Wetter-Raspi weewx[16406] DEBUG user.mqtt: Failed upload 
attempt 1: [Errno 104] Die Verbindung wurde vom Kommunikationspartner 
zurückgesetzt

Michael schrieb am Samstag, 12. März 2022 um 14:11:19 UTC+1:

> Hi,
>
> try it with this syntax:
> server_url = mqtt://name:pass...@192.168.1.75:1883/ 
> 
>
> Michael
> Geni schrieb am Samstag, 12. März 2022 um 12:23:16 UTC+1:
>
>> I have a local MQTT broker Mosquitto on a Synology (Docker image).
>> With Tasmotta flashed switches this works fine
>>
>> I use this extension https://github.com/matthewwall/weewx-mqtt
>>
>> What should be the syntax for the server_url in weewx?
>> [[MQTT]]
>> server_url = 192.168.56.1:1883/
>> topic = weather
>> unit_system = METRIC
>> binding = loop, archive
>> aggregation = aggregate
>>
>>
>> In my attempts there were the following errors
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>> "/usr/share/weewx/weewx/restx.py", line 385, in run_loop
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>> self.process_record(_record, dbmanager)
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>> "/usr/share/weewx/user/mqtt.py", line 494, in process_record
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>> mc.connect(url.hostname, url.port)
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 838, in connect
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>> self.connect_async(host, port, keepalive, bind_address)
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
>> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 893, in 
>> connect_async
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>> raise ValueError('Invalid host.')
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
>> ValueError: Invalid host.
>> Mar 12 10:52:09 Wetter-Raspi weewx[12110] CRITICAL weewx.restx: MQTT: 
>> Thread terminating. Reason: Invalid host.
>>
>> Does this work with my chosen MQTT extension?
>> Are there any better variants for this?
>>
>> Thank you in advanced 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/2d953d36-ca4c-4264-815c-3df53ea572fen%40googlegroups.com.


Re: [weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Doug Jenkins
Saverio:

Reading your post, have you considered using mqtt for each station node
publishing it's archive data to a single broker?

I wonder if you could do the following to achieve the same goal:

1. Set each station node archive interval to 1 minute.
2. Install weewx mqtt extension on each node
3. Configure each node to publish to a different topic, for example
weather-n1, n2,etc.
4. Configure the mqtt driver to just publish archive data.
5. Setup a mosquito mqtt broker on the same network to collect all the
data. It can be setup in a container.

This assumes all of your nodes are on the same network, although you could
setup the mqtt broker in a cloud instance if the nodes are not on the same
network.

That way you will get the full archive record published from each station.
You would just need to focus on consuming the published data from the
broker. At least all the data will be in a single place.

Just a thought.

On Sat, Mar 12, 2022, 6:50 AM Saverio Guzzo  wrote:

> PS. One detail that I forgot to mention: Balena uses docker images, for
> running the program I'm using
> balenalib/raspberrypi4-64-python:3.8-stretch-run
> 
>
> On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:
>
>> Hey community,
>>
>> I have a fleet of Davis weather stations connected to as many
>> RaspberryPis, on which I am running the vantage drivers as a standalone
>> program on docker container, deployed using Balena
>> .
>> I'd like my program to send data every minute to a REST API and I've been
>> looking into some way to get archive data from a in loop, but I'm not sure
>> I'm doing it the right way.
>>
>> What I did was defining in the driver's main method something like:
>>
>> *while True:*
>> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() -
>> datetime.timedelta(minutes=1))*
>> * for packet in vantage.genDavisArchiveRecords(since_ts):*
>> * try:*
>> * new_packet = weewx.units.to_METRICWX(packet)*
>> * davispusher.send_message(payload=new_packet)*
>> * log.debug(davispusher.payload)*
>> * except Exception as e:*
>> * log.debug("Found an exception: %s" % e)*
>> * time.sleep(1.2)*
>> * continue*
>> * time.sleep(60)*
>>
>> Where davispusher is an instance of a simple class that is needed to add
>> some values to the archive record and send the message and is defined as:
>> *class DavisPusher:*
>> * def __init__(self, host='https://mywebsite.somewhere
>> , port=8080, endpoint='davis'):*
>> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
>> * endpoint=endpoint,*
>> * port=port)*
>> * self.payload = {}*
>>
>> * def format_message(self,*
>> * payload: dict,*
>> * sensor_id: str = environ['SENSOR_ID'],*
>> * latitude: str = environ['LATITUDE'],*
>> * longitude: str = environ['LONGITUDE'],*
>> * altitude: str = environ['ALTITUDE'],*
>> * ) -> dict:*
>> * """Formats message for backend."""*
>>
>> * payload_copy = payload.copy()*
>> * try:*
>> * self.payload = payload_copy*
>> * self.payload['sensor_id'] = sensor_id*
>> * self.payload['altitude'] = float(altitude)*
>> * self.payload['longitude'] = float(longitude)*
>> * self.payload['latitude'] = float(latitude)*
>>
>> * except Exception:*
>> * self.payload = {}*
>> * def send_message(self, payload):*
>> * '''formats and sends message to backend'''*
>> * self.format_message(payload)*
>> * resp = requests.post (self._endpoint, data =
>> json.dumps(self.payload), allow_redirects = True)*
>> * log.debug("got HTTP statuscode %s", resp.status_code)*
>>
>> However, my logs are full of logging errors ("Bad file descriptor", "File
>> "/usr/local/lib/python3.8/logging/handlers.py" No such file or directory")
>> I guess those are errors due to logging configuration, but I'm not sure
>> how to address them. I created a GitHub Gist
>>  in
>> order not to pollute this post!
>>
>> Also, what I would like to achieve is the possibility to configure the
>> various consoles (set time, set coordinates) at startup using environment
>> variables. How could I do this using the VantageConfigurator class?
>>
>> Thanks a lot in advance for your help, I'm kind of alone in my work and
>> I'd really appreciate your help.
>>
>> Friendly greetings,
>> Saverio
>>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/55d40e74-aa67-40c0-bcb6-8b8a03c9a665n%40googlegroups.com
> 

[weewx-user] Re: MQTT Belchertown server_url Syntax?

2022-03-12 Thread Michael
Hi,

try it with this syntax:
server_url = mqtt://name:password@192.168.1.75:1883/

Michael
Geni schrieb am Samstag, 12. März 2022 um 12:23:16 UTC+1:

> I have a local MQTT broker Mosquitto on a Synology (Docker image).
> With Tasmotta flashed switches this works fine
>
> I use this extension https://github.com/matthewwall/weewx-mqtt
>
> What should be the syntax for the server_url in weewx?
> [[MQTT]]
> server_url = 192.168.56.1:1883/
> topic = weather
> unit_system = METRIC
> binding = loop, archive
> aggregation = aggregate
>
>
> In my attempts there were the following errors
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
> "/usr/share/weewx/weewx/restx.py", line 385, in run_loop
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
> self.process_record(_record, dbmanager)
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
> "/usr/share/weewx/user/mqtt.py", line 494, in process_record
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
> mc.connect(url.hostname, url.port)
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 838, in connect
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
> self.connect_async(host, port, keepalive, bind_address)
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
> "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 893, in 
> connect_async
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** raise 
> ValueError('Invalid host.')
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
> ValueError: Invalid host.
> Mar 12 10:52:09 Wetter-Raspi weewx[12110] CRITICAL weewx.restx: MQTT: 
> Thread terminating. Reason: Invalid host.
>
> Does this work with my chosen MQTT extension?
> Are there any better variants for this?
>
> Thank you in advanced 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/87efeb9c-9c3d-4197-a2e5-e881a10de490n%40googlegroups.com.


[weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
PS. One detail that I forgot to mention: Balena uses docker images, for 
running the program I'm using 
balenalib/raspberrypi4-64-python:3.8-stretch-run 


On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:

> Hey community,
>
> I have a fleet of Davis weather stations connected to as many 
> RaspberryPis, on which I am running the vantage drivers as a standalone 
> program on docker container, deployed using Balena 
> .
> I'd like my program to send data every minute to a REST API and I've been 
> looking into some way to get archive data from a in loop, but I'm not sure 
> I'm doing it the right way.
>
> What I did was defining in the driver's main method something like:
>
> *while True:*
> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
> datetime.timedelta(minutes=1))*
> * for packet in vantage.genDavisArchiveRecords(since_ts):*
> * try:*
> * new_packet = weewx.units.to_METRICWX(packet)*
> * davispusher.send_message(payload=new_packet)*
> * log.debug(davispusher.payload)*
> * except Exception as e:*
> * log.debug("Found an exception: %s" % e)*
> * time.sleep(1.2)*
> * continue*
> * time.sleep(60)*
>
> Where davispusher is an instance of a simple class that is needed to add 
> some values to the archive record and send the message and is defined as:
> *class DavisPusher:*
> * def __init__(self, host='https://mywebsite.somewhere 
> , port=8080, endpoint='davis'):*
> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
> * endpoint=endpoint,*
> * port=port)*
> * self.payload = {}*
>
> * def format_message(self,*
> * payload: dict,*
> * sensor_id: str = environ['SENSOR_ID'],*
> * latitude: str = environ['LATITUDE'],*
> * longitude: str = environ['LONGITUDE'],*
> * altitude: str = environ['ALTITUDE'],*
> * ) -> dict:*
> * """Formats message for backend."""*
>
> * payload_copy = payload.copy()*
> * try:*
> * self.payload = payload_copy*
> * self.payload['sensor_id'] = sensor_id*
> * self.payload['altitude'] = float(altitude)*
> * self.payload['longitude'] = float(longitude)*
> * self.payload['latitude'] = float(latitude)*
>
> * except Exception:*
> * self.payload = {}*
> * def send_message(self, payload):*
> * '''formats and sends message to backend'''*
> * self.format_message(payload)*
> * resp = requests.post (self._endpoint, data = 
> json.dumps(self.payload), allow_redirects = True)*
> * log.debug("got HTTP statuscode %s", resp.status_code)*
>
> However, my logs are full of logging errors ("Bad file descriptor", "File 
> "/usr/local/lib/python3.8/logging/handlers.py" No such file or directory")
> I guess those are errors due to logging configuration, but I'm not sure 
> how to address them. I created a GitHub Gist 
>  in 
> order not to pollute this post!
>
> Also, what I would like to achieve is the possibility to configure the 
> various consoles (set time, set coordinates) at startup using environment 
> variables. How could I do this using the VantageConfigurator class?
>
> Thanks a lot in advance for your help, I'm kind of alone in my work and 
> I'd really appreciate your help.
>
> Friendly greetings,
> Saverio
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/55d40e74-aa67-40c0-bcb6-8b8a03c9a665n%40googlegroups.com.


[weewx-user] MQTT Belchertown server_url Syntax?

2022-03-12 Thread Geni
I have a local MQTT broker Mosquitto on a Synology (Docker image).
With Tasmotta flashed switches this works fine

I use this extension https://github.com/matthewwall/weewx-mqtt

What should be the syntax for the server_url in weewx?
[[MQTT]]
server_url = 192.168.56.1:1883/
topic = weather
unit_system = METRIC
binding = loop, archive
aggregation = aggregate


In my attempts there were the following errors
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
"/usr/share/weewx/weewx/restx.py", line 385, in run_loop
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
self.process_record(_record, dbmanager)
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
"/usr/share/weewx/user/mqtt.py", line 494, in process_record
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
mc.connect(url.hostname, url.port)
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
"/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 838, in connect
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
self.connect_async(host, port, keepalive, bind_address)
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: ***   File 
"/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 893, in 
connect_async
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** raise 
ValueError('Invalid host.')
Mar 12 10:52:09 Wetter-Raspi weewx[12110] ERROR weewx.restx: *** 
ValueError: Invalid host.
Mar 12 10:52:09 Wetter-Raspi weewx[12110] CRITICAL weewx.restx: MQTT: 
Thread terminating. Reason: Invalid host.

Does this work with my chosen MQTT extension?
Are there any better variants for this?

Thank you in advanced 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/7dab81fb-01c1-4a42-9ac0-ca5673c01b89n%40googlegroups.com.


[weewx-user] Re: VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
PS. the logging library version is 0.5.1.2 and it seems I cannot update it 
because I get the error

ERROR: Command errored out with exit status 1:
 command: /usr/local/bin/python3.8 -c 'import io, os, sys, setuptools, 
tokenize; sys.argv[0] = 
'"'"'/tmp/pip-install-z4b_670u/logging_4bd977b2e0de45cb8530e2a3ad73a5cd/setup.py'"'"';
 
__file__='"'"'/tmp/pip-install-z4b_670u/logging_4bd977b2e0de45cb8530e2a3ad73a5cd/setup.py'"'"';f
 
= getattr(tokenize, '"'"'open'"'"', open)(__file__) if 
os.path.exists(__file__) else io.StringIO('"'"'from setuptools import 
setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
egg_info --egg-base /tmp/pip-pip-egg-info-6gg4rpp7
 cwd: 
/tmp/pip-install-z4b_670u/logging_4bd977b2e0de45cb8530e2a3ad73a5cd/
Complete output (26 lines):
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", 
line 18, in 
from setuptools.dist import Distribution
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", 
line 32, in 
from setuptools.extern.more_itertools import unique_everseen
  File "", line 991, in _find_and_load
  File "", line 975, in 
_find_and_load_unlocked
  File "", line 657, in _load_unlocked
  File "", line 556, in module_from_spec
  File 
"/usr/local/lib/python3.8/site-packages/setuptools/extern/__init__.py", 
line 52, in create_module
return self.load_module(spec.name)
  File 
"/usr/local/lib/python3.8/site-packages/setuptools/extern/__init__.py", 
line 37, in load_module
__import__(extant)
  File 
"/usr/local/lib/python3.8/site-packages/setuptools/_vendor/more_itertools/__init__.py",
 
line 1, in 
from .more import *  # noqa
  File 
"/usr/local/lib/python3.8/site-packages/setuptools/_vendor/more_itertools/more.py",
 
line 5, in 
from concurrent.futures import ThreadPoolExecutor
  File "/usr/local/lib/python3.8/concurrent/futures/__init__.py", line 
8, in 
from concurrent.futures._base import (FIRST_COMPLETED,
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 7, 
in 
import logging
  File 
"/tmp/pip-install-z4b_670u/logging_4bd977b2e0de45cb8530e2a3ad73a5cd/logging/__init__.py",
 
line 618
raise NotImplementedError, 'emit must be implemented '\
 ^
SyntaxError: invalid syntax

On Saturday, 12 March 2022 at 11:17:13 UTC+1 Saverio Guzzo wrote:

> Hey community,
>
> I have a fleet of Davis weather stations connected to as many 
> RaspberryPis, on which I am running the vantage drivers as a standalone 
> program on docker container, deployed using Balena 
> .
> I'd like my program to send data every minute to a REST API and I've been 
> looking into some way to get archive data from a in loop, but I'm not sure 
> I'm doing it the right way.
>
> What I did was defining in the driver's main method something like:
>
> *while True:*
> * since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
> datetime.timedelta(minutes=1))*
> * for packet in vantage.genDavisArchiveRecords(since_ts):*
> * try:*
> * new_packet = weewx.units.to_METRICWX(packet)*
> * davispusher.send_message(payload=new_packet)*
> * log.debug(davispusher.payload)*
> * except Exception as e:*
> * log.debug("Found an exception: %s" % e)*
> * time.sleep(1.2)*
> * continue*
> * time.sleep(60)*
>
> Where davispusher is an instance of a simple class that is needed to add 
> some values to the archive record and send the message and is defined as:
> *class DavisPusher:*
> * def __init__(self, host='https://mywebsite.somewhere 
> , port=8080, endpoint='davis'):*
> * self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
> * endpoint=endpoint,*
> * port=port)*
> * self.payload = {}*
>
> * def format_message(self,*
> * payload: dict,*
> * sensor_id: str = environ['SENSOR_ID'],*
> * latitude: str = environ['LATITUDE'],*
> * longitude: str = environ['LONGITUDE'],*
> * altitude: str = environ['ALTITUDE'],*
> * ) -> dict:*
> * """Formats message for backend."""*
>
> * payload_copy = payload.copy()*
> * try:*
> * self.payload = payload_copy*
> * self.payload['sensor_id'] = sensor_id*
> * self.payload['altitude'] = float(altitude)*
> * self.payload['longitude'] = float(longitude)*
> * self.payload['latitude'] = float(latitude)*
>
> * except Exception:*
> * self.payload = {}*
> * def send_message(self, payload):*
> * '''formats and sends message to backend'''*
> * self.format_message(payload)*
> * resp = requests.post (self._endpoint, data = 
> json.dumps(self.payload), allow_redirects = True)*
> * log.debug("got HTTP statuscode %s", resp.status_code)*
>
> However, my logs are full of logging errors ("Bad file descriptor", "File 
> "/usr/local/lib/python3.8/logging/handlers.py" No 

[weewx-user] VatnagePro driver: what is the best way to get archiveRecords every minute?

2022-03-12 Thread Saverio Guzzo
Hey community,

I have a fleet of Davis weather stations connected to as many RaspberryPis, 
on which I am running the vantage drivers as a standalone program on docker 
container, deployed using Balena .
I'd like my program to send data every minute to a REST API and I've been 
looking into some way to get archive data from a in loop, but I'm not sure 
I'm doing it the right way.

What I did was defining in the driver's main method something like:

*while True:*
* since_ts = datetime.datetime.timestamp(datetime.datetime.now() - 
datetime.timedelta(minutes=1))*
* for packet in vantage.genDavisArchiveRecords(since_ts):*
* try:*
* new_packet = weewx.units.to_METRICWX(packet)*
* davispusher.send_message(payload=new_packet)*
* log.debug(davispusher.payload)*
* except Exception as e:*
* log.debug("Found an exception: %s" % e)*
* time.sleep(1.2)*
* continue*
* time.sleep(60)*

Where davispusher is an instance of a simple class that is needed to add 
some values to the archive record and send the message and is defined as:
*class DavisPusher:*
* def __init__(self, host='https://mywebsite.somewhere, port=8080, 
endpoint='davis'):*
* self._endpoint = "{host}:{port}/{endpoint}".format(host=host, *
* endpoint=endpoint,*
* port=port)*
* self.payload = {}*

* def format_message(self,*
* payload: dict,*
* sensor_id: str = environ['SENSOR_ID'],*
* latitude: str = environ['LATITUDE'],*
* longitude: str = environ['LONGITUDE'],*
* altitude: str = environ['ALTITUDE'],*
* ) -> dict:*
* """Formats message for backend."""*

* payload_copy = payload.copy()*
* try:*
* self.payload = payload_copy*
* self.payload['sensor_id'] = sensor_id*
* self.payload['altitude'] = float(altitude)*
* self.payload['longitude'] = float(longitude)*
* self.payload['latitude'] = float(latitude)*

* except Exception:*
* self.payload = {}*
* def send_message(self, payload):*
* '''formats and sends message to backend'''*
* self.format_message(payload)*
* resp = requests.post(self._endpoint, data = json.dumps(self.payload), 
allow_redirects = True)*
* log.debug("got HTTP statuscode %s", resp.status_code)*

However, my logs are full of logging errors ("Bad file descriptor", "File 
"/usr/local/lib/python3.8/logging/handlers.py" No such file or directory")
I guess those are errors due to logging configuration, but I'm not sure how 
to address them. I created a GitHub Gist 
 in 
order not to pollute this post!

Also, what I would like to achieve is the possibility to configure the 
various consoles (set time, set coordinates) at startup using environment 
variables. How could I do this using the VantageConfigurator class?

Thanks a lot in advance for your help, I'm kind of alone in my work and I'd 
really appreciate your help.

Friendly greetings,
Saverio

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e74ee3d4-774d-4314-bb4d-a6052d35c66en%40googlegroups.com.