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 <http://weewx.com/docs/usersguide.htm#[Station]> 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 
<https://github.com/weewx/weewx/wiki/logging> 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
On Wednesday, 22 September 2021 at 07:33:41 UTC+10 vince wrote:

> On Tuesday, September 21, 2021 at 12:36:02 PM UTC-7 
> [email protected] 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.
>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/fbedd636-ffa5-4c98-9a82-3cb2b71a5c67n%40googlegroups.com.

Reply via email to