Hi,
I have only installed via setup.py, but I think the problem with running
standalone is that after the PYTHONPATH= it should be /usr/share/*weewx*
PYTHONPATH=/usr/share/*weewx* python
/usr/share/weewx//user/MQTTSubscribe.py --type service --binding archive
--interval 300 --delay 15 --records 2 weewx.conf
As for the real error, it appears that the keepalive value might need to be
divisible by 60. I can reproduce the error when I set it to 70, but I am
still researching.
- Rich
On Thursday, 25 April 2019 10:08:22 UTC-4, Eugen66 wrote:
>
> Hi,
> really trying to get your MQTT subscription to work, this is a very useful
> way of adding values to a great weather software :)
> I use (for the moment SDR as driver)
> When I try to run it stand alone I get this:
>
> PYTHONPATH=/usr/share/ python /usr/share/weewx//user/MQTTSubscribe.py
> --type service --binding archive --interval 300 --delay 15 --records 2
> weewx.conf
> Traceback (most recent call last):
> File "/usr/share/weewx//user/MQTTSubscribe.py", line 75, in <module>
> import weeutil.weeutil
> ImportError: No module named weeutil.weeutil
>
> and Weewx fail to start when I add MQTTSubscribe.... to weewx.conf
>
> Any suggestion?
>
> this is the log:
> Apr 25 15:50:26 weewx-hyggebu systemd[1]: Starting LSB: weewx weather
> system...
> Apr 25 15:50:27 weewx-hyggebu weewx[9314]: engine: Initializing weewx
> version 3.9.1
> Apr 25 15:50:27 weewx-hyggebu weewx[9314]: engine: Using Python 2.7.13
> (default, Sep 26 2018, 18:42:22) #012[GCC 6.3.0 20170516]
> Apr 25 15:50:27 weewx-hyggebu weewx[9314]: engine: Platform
> Linux-4.14.98-v7+-armv7l-with-debian-9.8
> Apr 25 15:50:27 weewx-hyggebu weewx[9314]: engine: Locale is 'en_GB.UTF-8'
> Apr 25 15:50:27 weewx-hyggebu weewx[9314]: engine: pid file is
> /var/run/weewx.pid
> Apr 25 15:50:27 weewx-hyggebu weewx[9303]: Starting weewx weather system:
> weewx.
> Apr 25 15:50:27 weewx-hyggebu systemd[1]: Started LSB: weewx weather
> system.
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Using configuration
> file /etc/weewx/weewx.conf
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Debug is 1
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Initializing engine
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Loading station type
> SDR (user.sdr)
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: driver version
> is 0.62
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: sensor map is
> {'inTemp': 'temperature.8:1.AcuriteWT450Packet', 'outTemp':
> 'temperature.1:1.AcuriteWT450Packet', 'outHumidity': '', 'extraTemp1':
> 'temperature.4:5.HidekiWindPacket', 'extraHumidity1': '', 'extraTemp2': '',
> 'extraHumidity3': '', 'rain': 'rain_total.4:0.HidekiRainPacket',
> 'rainBatteryStatus': 'battery.4:0.HidekiRainPacket', 'UV':
> 'uv_index.1:137.OSUV800Packet', 'outTempBatteryStatus':
> 'battery.1:137.OSUV800Packet', 'windDir': 'wind_dir.4:5.HidekiWindPacket',
> 'windGust': 'wind_gust.4:5.HidekiWindPacket', 'windSpeed':
> 'wind_speed.4:5.HidekiWindPacket', 'windBatteryStatus':
> 'battery.4:5.HidekiWindPacket'}
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: deltas is
> {'strikes': 'strikes_total', 'rain': 'rain_total'}
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: startup
> process 'rtl_433 -M utc -F json -G'
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: stdout-thread: start async
> reader for stdout-thread
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: stderr-thread: start async
> reader for stderr-thread
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Loading service
> weewx.engine.StdTimeSynch
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Finished loading
> service weewx.engine.StdTimeSynch
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: engine: Loading service
> user.MQTTSubscribe.MQTTSubscribeService
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Client id is weewx
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Binding is loop
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Default units is US 1
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Overlap is 0.0
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Host is 10.0.10.165
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Port is 1883
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Keep alive is 70
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Username is xxxxxx
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Password is set
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Topic is Weather/
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Archive topic is None
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Payload type is
> individual
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Default units is 1
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: MQTTSS: Label map is
> {'outHumidity': 'outHumidity', 'overlap': '20', 'binding': 'loop'}
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: shutdown
> process rtl_433 -M utc -F json -G
> Apr 25 15:50:27 weewx-hyggebu weewx[9318]: sdr: MainThread: waiting for
> stdout-thread
> Apr 25 15:50:31 weewx-hyggebu weewx[9318]: sdr: MainThread: waiting for
> stderr-thread
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: sdr: MainThread: timed out
> waiting for stderr-thread
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: sdr: MainThread: close stdout
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: sdr: MainThread: close stderr
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: engine: Caught unrecoverable
> exception in engine:
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** cannot convert
> argument to integer
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** Traceback (most
> recent call last):
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/weewx/engine.py", line 884, in main
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** engine =
> engine_class(config_dict)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/weewx/engine.py", line 78, in __init__
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: ****
> self.loadServices(config_dict)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/weewx/engine.py", line 142, in loadServices
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: ****
> self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/user/MQTTSubscribe.py", line 263, in __init__
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** self.thread =
> MQTTSubscribeServiceThread(self, self.client, self.queue,
> self.archive_queue, label_map, unit_system, payload_type, host, keepalive,
> port, username, password, topic, archive_topic)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/user/MQTTSubscribe.py", line 326, in __init__
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: ****
> MQTTSubscribe.__init__(self, client, queue, archive_queue, label_map,
> unit_system, payload_type, host, keepalive, port, username, password,
> topic, archive_topic)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/share/weewx/user/MQTTSubscribe.py", line 135, in __init__
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: ****
> self.client.connect(host, port, keepalive)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 839, in
> connect
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** return
> self.reconnect()
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1009, in
> reconnect
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** return
> self._send_connect(self._keepalive, self._clean_session)
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** File
> "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2361, in
> _send_connect
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** keepalive))
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** error: cannot convert
> argument to integer
> Apr 25 15:50:41 weewx-hyggebu weewx[9318]: **** Exiting.
>
>
>
> onsdag 24. april 2019 01.36.17 UTC+2 skrev [email protected] følgende:
>>
>> After experimenting and developing more, I decided this needs it own
>> repository. You can now find it here,
>> https://github.com/bellrichm/WeeWX-MQTTSubscribe
>>
>> The service now supports binding to either new loop packets or new
>> archive records. Since much of the code was similar to my MQTT driver, this
>> has been added to the module. It is still a manual install process, but
>> some documentation has been added.
>> -rich
>>
>
--
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].
For more options, visit https://groups.google.com/d/optout.