weewx-multi not working

347 views
Skip to first unread message

Rainer Lang

unread,
Sep 21, 2021, 9:18:25 AM9/21/21
to weewx-user

Hi

I did the installation on my RPi exactly as described at
https://github.com/weewx/weewx/wiki/weewx-multi

- downloaded the multi start script and copied it to /etc/init.d/weewx

wget -P /var/tmp https://raw.githubusercontent.com/weewx/weewx/master/util/init.d/weewx-multi
sudo cp /var/tmp/weewx-multi /etc/init.d/weewx
sudo update-rc.d weewx defaults
echo 'WEEWX_INSTANCES="WS2320E HP2553"' | sudo tee /etc/default/weewx-multi
echo 'WEEWX_CFGDIR=/etc/weewx' | sudo tee -a /etc/default/weewx-multi

the commands all went through without any complaints from the OS end

- created the two separate weewx.conf files for each instance
- modified the weewx.conf files accordingly for the DB, HTML_ROOT, station-type etc.

when I try to start one of the instances (named: WS2320E and HP2553), the OS replies:

pi@rasperrypi:~ $ sudo /etc/init.d/weewx start WS2320E
sudo: /etc/init.d/weewx; command not found
same with the other instance
pi@rasperrypi:~ $ sudo /etc/init.d/weewx start HP2553
sudo: /etc/init.d/weewx; command not found

/etc/default/weewx-multi contains the above entries
/etc/init.d/weewx is the multi script from Matthew

Nothing in the syslog - any ideas ? weewx even doesn't start ...
looks like a OS/script issue

By the way - the single instance version worked without any issue.
OS version is Raspbian 10


Andy

unread,
Sep 21, 2021, 10:20:45 AM9/21/21
to weewx-user
file is missing from /etc/init.d or is not executable?

ls -l /etc/init.d | grep weewx

Rainer Lang

unread,
Sep 21, 2021, 1:25:34 PM9/21/21
to Andy, weewx-user

Thanks, Andy, your command directed me in the right direction:
- first I needed to change the permission of /etc/init.d/weewx with chmod
- then an error occurred saying that the weewx daemon is not in a certain directory
- then I realized that the script 'weewx' in /etc/init.d needed some customization (what the WiKi didn't mention)
after adjusting the variables WEEWX_BINDIR=, WEEWX_CFG= and WEEWX_CFGDIR= in the script 'weewx' I got weewx starting up.

Now I have to make it understand to find the driver, but that I should work out soon - I guess it's some adjustment in weewx.conf (of the instance)
needed which wasn't mentioned nor properly described in the WiKi either.

It's working now - the choice of the name for station_type doesn't seem to be as free as the WiKi seems to indicate.
I had to stick with the original name of the driver stanza - in my case GW1000 - when I changed the station_type to HP2553 and the section to [HP2553]
correspondingly, it wouldn't find the driver user.gw1000 even thought that driver was mentioned. Going back to GW1000 and [GW1000] made it work.

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/a4230e20-7b1e-406a-8284-e12dffa7a7d6n%40googlegroups.com.

vince

unread,
Sep 21, 2021, 2:22:54 PM9/21/21
to weewx-user
It's probably wise to just stick with the original driver name of the actual driver you are running so you can get support.  If you start renaming things, you'll be on your own.   The important thing is to have unique instance names and databases those instances write to.

Rainer Lang

unread,
Sep 21, 2021, 3:36:02 PM9/21/21
to vince, weewx-user

That driver name was always user.gw1000, that wasn't changed.

The way the WiKi is written suggests that you can use any name as long as you are consistent with station_type = name and respection section [name].
It doesn't say that you should use the original station name and section name. Maybe the example given gives room for such thinking.
It should explicitly say that you have to stick with the names (pertaining to the driver) for station_type and section name [] which are used for a single instance !

It's not a matter of getting support or not if it is not clear what one is supposed to do and what not.

For my original scenario (one interceptor, one GW1000) this all works now - after divination between the WiKi lines ...

However, when I have two GW1000 and want to run both instances on the same server (different database names - they can be anything and are not affected by the station_type/section naming),
is it then enough that the instance-weewx.conf have different names and the databases either different names or a different location in the file system ?

I doubt this, because, when I try to run two instances both using the interceptor driver I get a message

ERROR weewx.engine: Import of driver failed: [Errno 98] Address already in use (<class 'OSError'>)

I expect the same to happen with two instance-weewx.conf both having an active GW1000 section (station_type, section name)

Or is there a way around ?

For me, from what I have observed so far, that means - as already said above - that it's not a real multi instance solution but a multi (different) driver solution, a special case of a general multi instance solution.
On 21.09.2021 20:22, vince wrote:
It's probably wise to just stick with the original driver name of the actual driver you are running so you can get support.  If you start renaming things, you'll be on your own.   The important thing is to have unique instance names and databases those instances write to.

--
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+...@googlegroups.com.

vince

unread,
Sep 21, 2021, 5:33:41 PM9/21/21
to weewx-user
On Tuesday, September 21, 2021 at 12:36:02 PM UTC-7 lang....@googlemail.com wrote:

The way the WiKi is written suggests that you can use any name as long as you are consistent with station_type = name and respection section [name].

It doesn't say that you should use the original station name and section name. Maybe the example given gives room for such thinking.
It should explicitly say that you have to stick with the names (pertaining to the driver) for station_type and section name [] which are used for a single instance !


I still question why you would rename things at all.  It's not necessary.

Regardless, you 'can' do this if you fork the driver and edit judiciously.   I successfully started two Simulator instances with one renamed to 'Simulator2' driver type, but I needed to copy the existing simulator.py driver to simulator2.py 'and' edit its DRIVER_NAME to match.

root@buster:/home/weewx# ls
LICENSE.txt  README.md Simulator1.conf  Simulator2.conf  archive  bin docs  examples skins  util  weewx.conf  weewx.conf.4.5.1

root@buster:/home/weewx# diff Simulator*
48c48
<     station_type = Simulator
---
>     station_type = Simulator2
62c62
< [Simulator]
---
> [Simulator2]
79c79
<     driver = weewx.drivers.simulator
---
>     driver = weewx.drivers.simulator2
572c572
<         database_name = weewx-Simulator1.sdb
---
>         database_name = weewx-Simulator2.sdb

Note - that required me to copy the original driver to another name and edit lightly for consistency.

root@buster:/home/weewx/bin/weewx/drivers# ls
__init__.py  __pycache__  acurite.py  cc3000.py  fousb.py  simulator.py  simulator2.py te923.py  ultimeter.py vantage.py  wmr100.py  wmr300.py  wmr9x8.py  ws1.py  ws23xx.py ws28xx.py

root@buster:/home/weewx/bin/weewx/drivers# diff sim*
18c18
< DRIVER_NAME = 'Simulator'
---
> DRIVER_NAME = 'Simulator2'

For my original scenario (one interceptor, one GW1000) this all works now - after divination between the WiKi lines ...


A wiki is a 'shared' editing environment.  If you have changes that you think will make the wiki better, please write them up and submit them.

I doubt this, because, when I try to run two instances both using the interceptor driver I get a message 

ERROR weewx.engine: Import of driver failed: [Errno 98] Address already in use (<class 'OSError'>)

I expect the same to happen with two instance-weewx.conf both having an active GW1000 section (station_type, section name)

Or is there a way around ?


Depends on the driver and whether it will share a socket on the host computer.  For example, the WeathflowUDP driver defaults to 'not' sharing its listening socket with other programs on the same computer, but it can be configured to share the socket if you edit the driver stanza in the config file.   It's possible gw1000 is similar and that you can run only one instance on the host computer (I didn't have time to test this).
 

For me, from what I have observed so far, that means - as already said above - that it's not a real multi instance solution but a multi (different) driver solution, a special case of a general multi instance solution.

Disagree.   You can run two of the same, or two different, as long as you're consistent in your naming 'and' as long as the driver supports multiple instances of things on the same port if it's a network-based driver like WeatherFlowUDP and gw1000 are.


gjr80

unread,
Sep 22, 2021, 1:06:25 AM9/22/21
to weewx-user
I believe this is being made way more complex than it need be.

> - first I needed to change the permission of /etc/init.d/weewx with chmod

Would like to know what permissions existed beforehand that needed to be changed and what changes were required? I have a RPi running Raspberry Pi OS (setup.py install) and a VM running Debian buster (.deb package install) both running weewx-multi and both required no changes to permissions of /etc/init.d/weewx. After following the wiki instructions both showed:

134454 -rwxr-xr-x  1 root root 5386 Sep 22 10:13 weewx

and both run fine with these permissions.

> - then an error occurred saying that the weewx daemon is not in a certain directory

I believe there is a step omitted from the weewx-multi DEB/RPM config instructions. The config instructions as they stand now leave the weewx-multi script on a package install looking for the WeeWX executables in the setup.py location (/home/weewx/bin). This is fixed with the following command:

$ echo 'WEEWX_BINDIR=/usr/share/weewx' | sudo tee -a /etc/default/weewx-multi

> - then I realized that the script 'weewx' in /etc/init.d needed some customization (what the WiKi didn't mention) after adjusting the variables WEEWX_BINDIR=, WEEWX_CFG= and WEEWX_CFGDIR= in the script 'weewx' I got weewx starting up.

No, there is good reason the wiki doesn't mention editing/changing anything in the weewx-multi script and that is because it is not required. If you follow the wiki instructions you end up with a file /etc/default/weewx-multi that contains overrides for a number of config items in the weewx-multi script. That is the purpose of the following commands:

$ echo 'WEEWX_INSTANCES="vantage acurite"' | sudo tee /etc/default/weewx-multi
$ echo 'WEEWX_CFGDIR=/etc/weewx' | sudo tee -a /etc/default/weewx-multi

 and the command I previously mentioned:
 
 $ echo 'WEEWX_BINDIR=/usr/share/weewx' | sudo tee -a /etc/default/weewx-multi

These commands set a number of overrides that are used by the weewx-multi script. When the weewx-multi script is executed the contents of /etc/default/weewx-multi are read and various config items in the weewx-multi script are overridden. Have a look at the contents of /etc/default/weewx-multi. Unfortunately the omission I mentioned earlier mean that WEEWX_BINDIR is not overridden and hence the weewx-multi cannot find the WeeWX executables.


> Now I have to make it understand to find the driver, but that I should work out soon - I guess it's some adjustment in weewx.conf (of the instance) needed which wasn't mentioned nor properly described in the WiKi either.
>
> It's working now - the choice of the name for station_type doesn't seem to be as free as the WiKi seems to indicate. I had to stick with the original name of the driver stanza - in my case GW1000 - when I changed the station_type to HP2553 and the section to [HP2553] correspondingly, it wouldn't find the driver user.gw1000 even thought that driver was mentioned. Going back to GW1000 and [GW1000] made it work.

Not sure what you mean by "the choice of the name for station_type doesn't seem to be as free as the WiKi seems to indicate". The wiki does not say you can set station_type to be anything, in fact the wiki says "In each configuration file, ensure that station_type is set correctly.". The wiki does say "Let's say that you have two weather stations connected to a single computer. Call them vantage and acurite." You can call your stations rudolph and dasher and have rudolph.conf and dasher.conf but your station_type will need to be Vantage or Acurite (or GW1000) as station_type tells WeeWX where to find the driver config. The driver config stanza then tells WeeWX, among other things, which driver file to use. If you decide to go changing driver file names you are treading on thin ice as typically each driver looks for certain config items that it requires in a particular stanza. When you used HP2553 for station_type and [HP2553] WeeWX will have found the driver file, user.gw1000, but the driver would have choked as it requires config to be in [GW1000].


> The way the WiKi is written suggests that you can use any name as long as you are consistent with station_type = name and respection section [name].
>
> It doesn't say that you should use the original station name and section name. Maybe the example given gives room for such thinking. It should explicitly say that you have to stick with the names (pertaining to the driver) for station_type and section name [] which are used for a single instance !
>
> It's not a matter of getting support or not if it is not clear what one is supposed to do and what not.

It doesn't say that you have to change the original station_type either. I don't know why there is a belief that you can use anything you please for station_type. "Verify the driver configurations. In each configuration file, ensure that station_type is set correctly." indicates to me that perhaps there is something particular about station_type. Looking at the [Station] stanza in the User's Guide again you are referred to some 'valid options'  that can be used for station_type which again suggests to me that there may be something special here. We can certainly spell out in minute detail the intricacies of all config settings, that's going to make for an awfully large/complex document that I suspect will then be largely unused/ignored.


> However, when I have two GW1000 and want to run both instances on the same server (different database names - they can be anything and are not affected by the station_type/section naming),
is it then enough that the instance-weewx.conf have different names and the databases either different names or a different location in the file system ?
>
> I doubt this, because, when I try to run two instances both using the interceptor driver I get a message
>
> ERROR weewx.engine: Import of driver failed: [Errno 98] Address already in use (<class 'OSError'>)

What you are seeing in your 'double interceptor instance' is the two interceptor driver instances competing for the same port. It's a bit like configuring the Vantage and Acurite stations in the weewx-multi wiki entry to use the same port; there will be contention and someone will lose. Bottom line is it will not work. I suspect that in your 'dual interceptor instance' case if you set the instances to use different ports, and provided you set your stations to publish to the correct port, things would work fine.
> For me, from what I have observed so far, that means - as already said above - that it's not a real multi instance solution but a multi (different) driver solution, a special case of a general multi instance solution.

It is, you just need to configure weewx-multi and the config files correctly. As an experiment I have just set both WeeWX instances on my Debian buster VM (that were running dual simulator instances) to use the GW1000 driver instead of the simulator and it works just fine. It was as simple as installing the GW1000 driver, setting station_type = GW1000 in each config file and then adding a [GW1000] stanza to each config file ensuring a unique IP address was specified for the GW1000 used by each instance (each instance uses a different GW1000 device). I would not recommend using discovery by broadcast as I could see both instances possibly using the same GW1000, and whilst there is nothing in the GW100 driver that prevents this, it is possible there would eventually be some contention. No need to use a different station_type in each config, no need to rename stanzas and definitely no need to alter the driver file in anyway.

Logging generally needs some tweaking as making sense of a log that includes multiple instances is somewhat brain numbing, one strategy is covered in the Put log messages from WeeWX into a separate file wiki page.

I will have a look through the weewx-multi wiki page tonite and see what improvements I can make. Remember the wiki is a document that is editable by the community, anyone can and is most welcome to contribute and clear up ambiguities, make improvements etc.

Sorry this was rather lengthy but as I said this is being made way more complex than it need be.

Gary

matthew wall

unread,
Sep 22, 2021, 1:04:13 PM9/22/21
to weewx-user
you should not have to modify the weewx-multi script at all - put all of your customizations into /etc/default/weewx-multi

this includes not only the WEEWX_INSTANCES, but also WEEWX_BINDIR, WEEWX_CFGDIR, etc.

weewx-multi does not care about drivers - it only cares about the name you give to each weewx instance.  the instance names distinguish between config files and databases.  for example, you could have 2 gw1000 instances and 1 vantage instance, with your weewx installed in /opt/weewx and config files in /etc/weewx, like this:

WEEWX_CFGDIR=/etc/weewx
WEEWX_BINDIR=/opt/weewx/bin
WEEWX_INSTANCES="gw1000_1 gw1000_2 vantage"

for each instance, you need a config file in the WEEWX_CFGDIR, so in /etc/weewx you would have:

/etc/weewx/gw1000_1.conf
/etc/weewx/gw1000_2.conf
/etc/weewx/vantage.conf

each of those config files would specify its own database: /var/lib/weewx/gw1000_1.sdb for gw1000_1, etc.  the weewx-multi script ensures that logging from each instance gets a different prefix, so you can search per-instance, or use rsyslog configs to direct output from each instance to a separate file.

the instance names are arbitrary.  if the first gw1000 is in the paddock, the second is monitoring a station at the boat, and the vantage is up on a hill, you could use names like this:

WEEWX_INSTANCES="paddock boat hill"
 
the drivers and server_type do not change.

gjr80

unread,
Sep 23, 2021, 8:42:15 PM9/23/21
to weewx-user
Have updated the weewx-multi and logging wiki pages.

Gary

Joachim Puttkammer

unread,
Dec 10, 2021, 12:12:39 PM12/10/21
to weewx-user
I have set up 2 instances (sim inter) (Debian Bullseye) according to instructions from https://github.com/weewx/weewx/wiki/weewx-multi.
Unfortunately, I get the following error message when starting an instance:
$ ▶ sudo /etc/init.d/weewx start sim
Traceback (most recent call last):
  File "/usr/share/weewx/weewxd", line 20, in <module>.
    import configobj
ImportError: No module named configobj

python3-configobj  is installed

$ ▶ python -V
Python 3.9.2

$ ▶ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import configobj
>>>
--------------------------------------------

/etc/default/weewx-multi
WEEWX_INSTANCES="sim inter"
WEEWX_CFGDIR=/etc/weewx
WEEWX_BINDIR=/usr/share/weewx

/etc/weewx/inter.conf
station_type = Simulator
HTML_ROOT = /var/www/html/public_html/inter
database_name = weewx_inter.sdb

/etc/weewx/sim.conf
station_type = Simulator
HTML_ROOT = /var/www/html/public_html/sim
database_name = weewx_sim.sdb

/etc/weewx/weewx.conf
station_type = Simulator
HTML_ROOT = /var/www/html/weewx
database_name = weewx.sdb

gjr80

unread,
Dec 10, 2021, 2:39:43 PM12/10/21
to weewx-user
The config_obj python version must match the python version that WeeWX is being run under. This may or may not be python3 and may be different to the python version run when the command ‘python’ is executed. If you don’t know what version of python you installed WeeWX under you can check by looking at the WeeWX log or by looking at the first line of any of the installed WeeWX utilities, eg wee_database, wee_config etc (which will be found in /usr/share/weewx).

Gary

Joachim Puttkammer

unread,
Dec 10, 2021, 5:38:55 PM12/10/21
to weewx-user
I uninstalled python2.7 and created a symlink from /usr/bin/python3.9 to /usr/bin/python.
The two instances work.
merci
Reply all
Reply to author
Forward
0 new messages