Re: [weewx-development] MQTTSubscribe.py installing as service

2020-05-02 Thread Wysiwyg

Hello everybody,

There is issue and maybe an improvement that could be done in the driver 
but I'm not sure to understand correctly.

My understanding is that:
def __init__(self, **stn_dict):   is executed at weewx start
while :
def genLoopPackets(self):  is executed at each packet lookp

The issue is that the mqtt connect is only in __init__ therefore, if weewx 
gets disconnected from mqtt (ex: if I restart mosquitto),  weewx stops 
receiving packets.

would it make sense to add at the beginning of def genLoopPackets(self): 
something like  (NOT PYTHON, just principle example)
if not(self.client.isConnected())
  then 
   self.client.subscribe(self.topic, qos=0)
   self.client.connect(self.host, 1883, 60)

or maybe it could be used only  .reconnect() ?


Here is the driver link for reference:
https://github.com/bonjour81/station_meteo/blob/master/weewx/driver/wxMesh.py














Le mardi 14 janvier 2020 21:48:03 UTC+1, Ralph Underwood a écrit :
>
> I am using WeeWx 4.0.0.b8 (latest development version) and I copied 
> MQTTSubscribe from your GitHub.  I did not install via wee_extension. 
>
> My plan was to replace my standalone python program which subscribes to 
> MQTT and writes a file for the filepile.py extension. I converted it to 
> Python3 so with WeeWx 4 I will be all Python3. That has worked fine on one 
> of my stations, however my program does not have a queue and only handles 
> one MQTT message and I want to add more MQTT sensors to the stations. I 
> have a separate development station that I am working with to get 
> MQTTSubscribe working. I am going to start over with a clean installation 
> and use wee-extension to install MQTTSubscribe. 
>
> It's snowing here in Seattle, so I should have some time to experiment.
>
> I will start a new thread to report success or ask for help - I didn't 
> notice that there were 5 pages on this thread before I asked about running 
> as a service.
>
>
>
> On Tuesday, January 14, 2020 at 12:02:43 PM UTC-8, Rich Bell wrote:
>>
>> Ralph,
>> What version of WeeWX and MQTTSubscribe? Did you install via 
>> wee_extension? If you post a copy of your config (making sure to remove any 
>> sensitive information), I’d be happy to take a look.
>> We should probably move this out of the wxMesh thread...
>> Rich
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/9633cb2b-1249-4391-9a73-e9f4e55650d1%40googlegroups.com.


Re: [weewx-development] MQTTSubscribe.py installing as service

2020-01-14 Thread Ralph Underwood
I am using WeeWx 4.0.0.b8 (latest development version) and I copied 
MQTTSubscribe from your GitHub.  I did not install via wee_extension. 

My plan was to replace my standalone python program which subscribes to 
MQTT and writes a file for the filepile.py extension. I converted it to 
Python3 so with WeeWx 4 I will be all Python3. That has worked fine on one 
of my stations, however my program does not have a queue and only handles 
one MQTT message and I want to add more MQTT sensors to the stations. I 
have a separate development station that I am working with to get 
MQTTSubscribe working. I am going to start over with a clean installation 
and use wee-extension to install MQTTSubscribe. 

It's snowing here in Seattle, so I should have some time to experiment.

I will start a new thread to report success or ask for help - I didn't 
notice that there were 5 pages on this thread before I asked about running 
as a service.



On Tuesday, January 14, 2020 at 12:02:43 PM UTC-8, Rich Bell wrote:
>
> Ralph,
> What version of WeeWX and MQTTSubscribe? Did you install via 
> wee_extension? If you post a copy of your config (making sure to remove any 
> sensitive information), I’d be happy to take a look.
> We should probably move this out of the wxMesh thread...
> Rich
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/70eea334-56d2-4a26-a102-5170bb26988f%40googlegroups.com.


Re: [weewx-development] MQTTSubscribe.py installing as service

2020-01-14 Thread Rich Bell
Ralph,
What version of WeeWX and MQTTSubscribe? Did you install via wee_extension? 
If you post a copy of your config (making sure to remove any sensitive 
information), I’d be happy to take a look.
We should probably move this out of the wxMesh thread...
Rich

On Tuesday, 14 January 2020 14:48:03 UTC-5, Ralph Underwood wrote:
>
> I was replying to a post on an earlier page. I just found Rich's 
> MQTTSubscribe.py and have started to experiment with it as a service.
>
> I managed to get to this:
>
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: Caught 
> unrecoverable exception:
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:   Empty 
> module name
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  Traceback (most recent call last):
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
> "/home/weewx/bin/weewx/engine.py", line 897, in main
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  engine = StdEngine(config_dict)
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
> "/home/weewx/bin/weewx/engine.py", line 83, in __init__
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  self.loadServices(config_dict)
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
> "/home/weewx/bin/weewx/engine.py", line 144, in loadServices
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  obj = weeutil.weeutil.get_object(svc)(self,config_dict)
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
> "/home/weewx/bin/weeutil/weeutil.py", line 1093, in get_object
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  mod = __import__(module)
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  ValueError: Empty module name
> Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
>  Exiting.
>
> Sleuthing begins.
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/85171f1e-4b3d-46a1-a018-3428c6396843%40googlegroups.com.


Re: [weewx-development] MQTTSubscribe.py installing as service

2020-01-14 Thread Ralph Underwood
I was replying to a post on an earlier page. I just found Rich's 
MQTTSubscribe.py and have started to experiment with it as a service.

I managed to get to this:

Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: Caught 
unrecoverable exception:
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:   Empty 
module name
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
 Traceback (most recent call last):
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
"/home/weewx/bin/weewx/engine.py", line 897, in main
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
 engine = StdEngine(config_dict)
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
"/home/weewx/bin/weewx/engine.py", line 83, in __init__
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
 self.loadServices(config_dict)
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
"/home/weewx/bin/weewx/engine.py", line 144, in loadServices
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:   obj 
= weeutil.weeutil.get_object(svc)(self,config_dict)
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine: File 
"/home/weewx/bin/weeutil/weeutil.py", line 1093, in get_object
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:   mod 
= __import__(module)
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:  
 ValueError: Empty module name
Jan 14 11:23:16 TestPi weewx[4983] CRITICAL weewx.engine:   Exiting.

Sleuthing begins.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/0f790eb9-5cea-4056-8614-bb3340238b14%40googlegroups.com.