Connection refused usually means the other side literally not listening on 
that port.  You might want to check that 192.168.1.35 is listening on port 
1883.  That should be the ip address of your MQTT broker, not the ip 
address of the weewx system that's trying to connect to it.

Here's me checking my MQTT server pi

pi@pi3:~ $ sudo ss -tupl|grep 1883
tcp   LISTEN 0      100                         0.0.0.0:1883           
 0.0.0.0:*                      users:(("mosquitto",pid=607,fd=5))
tcp   LISTEN 0      100                            [::]:1883               
[::]:*                      users:(("mosquitto",pid=607,fd=6))

...and checking that process 607 is the MQTT server...

pi@pi3:~ $ ps -aux|grep 607
mosquit+   607  0.0  0.5   8924  5128 ?        Ss   Jan12   7:49 
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf


Quick test with mosquitto is to get on a client computer and run:
mosquitto_sub -h 192.168.1.35 -t testingmqtt

And in another window send a message to that topic:
mosquitto_pub -h 192.168.35 -t testingmqtt -m hellothere

(and the first window that's subscribing should display the 'hellothere' 
message the other window sent to the broker)

On Monday, January 25, 2021 at 7:53:02 PM UTC-8 [email protected] wrote:

> I'm having trouble getting data into Home Assistant via MQTT.  I've 
> connected to Home Assistant with MQTT Explorer and been able to publish to 
> a test topic, so that end of things appears to be working.  
>
> I did my best to follow the instructions at 
> https://github.com/weewx/weewx/wiki/mqtt, skipping the python-cjson since 
> weewx is using python 3 (via Deb package).  The MQTT portion of my 
> weewx.config looks like this in my latest attempt:
>     [[MQTT]]
>         server_url = mqtt://192.168.1.35:1883
>         topic = weather
>         unit_system=METRIC
>         [[[inputs]]]
>             [[[[inTemp]]]]
>                 units = degree_F
>
> Initially I was trying with server_url = mqtt://
> user:[email protected]:1883 <http://user:[email protected]:1883>, 
> but recently enabled anonymous connections in case a password typo was the 
> problem.  
>
> With debug = 1 my syslog seems to indicate the problem is possibly with 
> authentication (connection refused).  Any ideas what I'm doing wrong.
>
> Jan 25 20:39:49 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: 
> Found station at bus= device=
> Jan 25 20:39:49 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: next 
> read in 18 seconds
> Jan 25 20:40:01 raspberrypi CRON[1952]: (pi) CMD (python3 
> /home/pi/cron_jobs/humid_checker.py > /dev/null)
> Jan 25 20:40:07 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: 
> Found station at bus= device=
> Jan 25 20:40:07 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: next 
> read in 12 seconds
> Jan 25 20:40:19 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: 
> Found station at bus= device=
> Jan 25 20:40:19 raspberrypi /weewxd: inside humid: found value of 53.2
> Jan 25 20:40:19 raspberrypi weewx[29660] INFO weewx.manager: Added record 
> 2021-01-25 20:40:00 MST (1611632400) to database 'weewx.sdb'
> Jan 25 20:40:19 raspberrypi weewx[29660] INFO weewx.manager: Added record 
> 2021-01-25 20:40:00 MST (1611632400) to daily summary in 'weewx.sdb'
> Jan 25 20:40:22 raspberrypi weewx[29660] DEBUG weewx.reportengine: Running 
> reports for latest time in the database.
> Jan 25 20:40:22 raspberrypi weewx[29660] DEBUG weewx.reportengine: Running 
> report 'StandardReport'
> Jan 25 20:40:22 raspberrypi weewx[29660] DEBUG user.mqtt: Failed upload 
> attempt 1: [Errno 111] Connection refused
> Jan 25 20:40:23 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: 
> Found station at bus= device=
> Jan 25 20:40:23 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: next 
> read in 6 seconds
> Jan 25 20:40:23 raspberrypi weewx[29660] DEBUG weewx.reportengine: Found 
> configuration file /etc/weewx/skins/Seasons/skin.conf for report 
> 'StandardReport'
> Jan 25 20:40:23 raspberrypi weewx[29660] DEBUG weewx.cheetahgenerator: 
> Using search list ['weewx.cheetahgenerator.Almanac', 
> 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 
> 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 
> 'weewx.cheetahgenerator.Extras']
> Jan 25 20:40:23 raspberrypi weewx[29660] DEBUG weewx.manager: Daily 
> summary version is 3.0
> Jan 25 20:40:27 raspberrypi weewx[29660] DEBUG user.mqtt: Failed upload 
> attempt 2: [Errno 111] Connection refused
> Jan 25 20:40:29 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: 
> Found station at bus= device=
> Jan 25 20:40:29 raspberrypi weewx[29660] DEBUG weewx.drivers.acurite: next 
> read in 18 seconds
> Jan 25 20:40:32 raspberrypi weewx[29660] DEBUG user.mqtt: Failed upload 
> attempt 3: [Errno 111] Connection refused
> Jan 25 20:40:35 raspberrypi weewx[29660] INFO weewx.cheetahgenerator: 
> Generated 8 files for report StandardReport in 12.36 seconds
> Jan 25 20:40:35 raspberrypi weewx[29660] DEBUG weewx.manager: Daily 
> summary version is 3.0
> Jan 25 20:40:37 raspberrypi weewx[29660] ERROR weewx.restx: MQTT: Failed 
> to publish record 2021-01-25 20:40:00 MST (1611632400): Failed upload after 
> 3 tries
> Jan 25 20:40:42 raspberrypi weewx[29660] INFO weewx.imagegenerator: 
> Generated 14 images for report StandardReport in 6.25 seconds
> Jan 25 20:40:42 raspberrypi weewx[29660] INFO weewx.reportengine: Copied 0 
> files to /var/www/html/weewx
>

-- 
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/42c379c7-1706-4ef5-9f8d-10ca8294e51en%40googlegroups.com.

Reply via email to