Thanks Tom.  I substituted the username and password for a public account 
and that has solved it.  I guess I was put off by the fact that the 
original one still works.  In fact they are both working in parallel!

On Wednesday, May 31, 2023 at 3:34:54 PM UTC+1 Tom Hogland wrote:

> From the docs, it looks like the correct config line is:
>
> server_url = mqtt://username:password@localhost:1883/
>
> On Wednesday, May 31, 2023 at 3:27:01 AM UTC-8 mjuwx wrote:
>
>> I have successfully used mqtt when running weewx on a raspberry pi.  I am 
>> now running weewx under docker on a more powerful pi4.  The mqtt settings 
>> that worked originally now give the following error.
>>
>> ValueError: Port could not be cast to integer value as '1883 '  - full 
>> error log below
>>
>> 1  There were no errors when paho-mqtt was installed.
>> 2  weewx.conf entries
>>     [[MQTT]]
>>         enable = True
>>         log_success = False
>>         server_url = //broker.emqx.io:1883 /
>>         topic = xxxx/yyyyyyy
>>         unit_system = METRIC
>>         aggregation = aggregate
>>         binding = archive, loop
>>
>>         [[[inputs]]]
>>             [[[[dayRain]]]]
>>                 units = mm
>>             [[[[rainRate]]]]
>>                 units = mm_per_hour
>>
>> 3  port 1883 on the container is linked to port 1883 on the host
>>
>> Can anyone help me to resolve this please?
>>
>> Thanks
>>
>> Output from log file
>>
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: MQTT: Unexpected exception 
>> of type <class 'ValueError'>
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: *** Traceback (most recent 
>> call last):
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***   File 
>> "/home/weewx/bin/weewx/restx.py", line 382, in run_loop
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***     
>> self.process_record(_record, dbmanager)
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***   File 
>> "/home/weewx/bin/user/mqtt.py", line 522, in process_record
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***     
>> self.get_mqtt_client()
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***   File 
>> "/home/weewx/bin/user/mqtt.py", line 453, in get_mqtt_client
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***     
>> mc.connect(url.hostname, url.port)
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***   File 
>> "/usr/local/lib/python3.10/urllib/parse.py", line 177, in port
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: ***     raise 
>> ValueError(f"Port could not be cast to integer value as {port!r}")
>> May 31 11:26:43 weewx[18] ERROR weewx.restx: *** ValueError: Port could 
>> not be cast to integer value as '1883 '
>> May 31 11:26:43 weewx[18] CRITICAL weewx.restx: MQTT: Thread terminating. 
>> Reason: Port could not be cast to integer value as '1883 '
>> Exception in thread MQTT:
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python3.10/threading.py", line 1016, in 
>> _bootstrap_inner
>>     self.run()
>>   File "/home/weewx/bin/weewx/restx.py", line 355, in run
>>     self.run_loop(_manager)
>>   File "/home/weewx/bin/weewx/restx.py", line 382, in run_loop
>>     self.process_record(_record, dbmanager)
>>   File "/home/weewx/bin/user/mqtt.py", line 522, in process_record
>>     self.get_mqtt_client()
>>   File "/home/weewx/bin/user/mqtt.py", line 453, in get_mqtt_client
>>     mc.connect(url.hostname, url.port)
>>   File "/usr/local/lib/python3.10/urllib/parse.py", line 177, in port
>>     raise ValueError(f"Port could not be cast to integer value as 
>> {port!r}")
>> ValueError: Port could not be cast to integer value as '1883 '
>>
>

-- 
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/4782261d-ac2e-4171-a0fa-abfb6272bb17n%40googlegroups.com.

Reply via email to