I revome the “[[[tls]]]” section from weewx.conf and now the error 
disappear:

------------------------------------------------------------------------
INFO weewx.restx: MQTT: Published record 2021-03-17 10:29:15 CET 
(1615973355)
------------------------------------------------------------------------

but it doesn't work, always in "waiting data from the sation"

this is the log of mosquitto.conf
---------------------------------------------------------------------------
1615973513: mosquitto version 1.6.9 starting
1615973513: Config loaded from /etc/mosquitto/mosquitto.conf.
1615973513: Opening ipv4 listen socket on port 1883.
1615973513: Opening ipv4 listen socket on port 8883.
1615973513: Opening ipv6 listen socket on port 8883.
1615973513: Opening websockets listen socket on port 9001.
1615973518: New connection from 127.0.0.1 on port 1883.
1615973518: New client connected from 127.0.0.1 as MQTTSubscribe-5787 (p2, 
c1, k60, u'carlo').
1615973536: New client connected from ::ffff:X.X.X.X as website502959092 
(p2, c1, k60).
1615973539: New connection from 127.0.0.1 on port 1883.
1615973539: New client connected from 127.0.0.1 as weewx_1f2ccce3 (p2, c1, 
k60, u'carlo').
1615973539: Client weewx_1f2ccce3 disconnected.
1615973558: Socket error on client website502959092, disconnecting.
------------------------------------------------------------------------------

Thanks
Carlo
Il giorno mercoledì 17 marzo 2021 alle 05:11:00 UTC+1 ln77 ha scritto:

> I’ll make a wild guess and hypothesize that the problem is that the weewx 
> MQTT module is trying to speak TLS to the broker on port 1883 rather than 
> 8883.  I would start by getting MQTT working without TLS — just remove the 
> “[[[tls]]]” section from weewx.conf.  Once that is working you can add TLS 
> back, but usually there’s no advantage to encrypting network traffic to 
> localhost.   
>
>   -Les
>
>
> On 16 Mar 2021, at 10:56, Carlo <[email protected]> wrote:
>
> Hi everyone. I have a problem with the MQTT Broker on my localhost server.
> My website (meteopievedicampo.ddns.net) work good, but i wanto to enable 
> MQTT.
> I open on my firewall the 9001 port.
>
> I have this error in mosquitto log:
>
> -------------------------------------------------------------------------------------------
> 1615760009: New connection from 127.0.0.1 on port 1883.
> 1615760009: Client <unknown> disconnected due to protocol error.
> 1615760060: New client connected from ::ffff:192.168.1.2 as 
> website557173374 (p2, c1, k60).
> 1615760060: New connection from 127.0.0.1 on port 1883.
> 1615760060: Client <unknown> disconnected due to protocol error
>
> ---------------------------------------------------------------------------------------------
>
> and this is syslog:
>
> ---------------------------------------------------------------------------------------------
> DEBUG user.mqtt: Failed upload attempt 3: [Errno 104] Connessione 
> interrotta dal corrispondente
> ERROR weewx.restx: MQTT: Failed to publish record 2021-03-14 23:18:23 CET 
> (1615760303): Failed upload after 3 tries
>
> ---------------------------------------------------------------------------------------------
>
> This is my weewx.conf:
>
>
> ---------------------------------------------------------------------------------------------
> [[MQTT]]
>         server_url = mqtt://carlo:XXXXXXXXX@localhost:1883/
>         topic = weather/loop
>         unit_system = METRIC
>         binding = archive, loop
>         aggregation = aggregate
>          [[[tls]]]
>             tls_version = tlsv12
>             ca_certs = /etc/mosquitto/certs/chain.pem
>
>  # MQTT Websockets defaults
>             mqtt_websockets_enabled = 1
>             mqtt_websockets_host = meteopievedicampo.ddns.net
>             mqtt_websockets_port = 9001
>             mqtt_websockets_ssl = 1
>             mqtt_websockets_topic = weather/loop
>             disconnect_live_website_visitor = 1800000
>
> [MQTTSubscribeService]
>     enable = true
>     host = localhost
>     port = 1883
>     keepalive = 60
>     username = carlo
>     password = XXXXXXXXXX
>     binding = loop
>     [[message_callback]]
>         type = json
>     [[topics]]
>         unit_system = METRIC
>
> -------------------------------------------------------------------------------------------
>
> And this is my mosquitto.conf:
>
>
> ------------------------------------------------------------------------------------------
> persistence false
> allow_anonymous true
> password_file /etc/mosquitto/passwd
> acl_file /etc/mosquitto/acl
> # Insecure mqtt to localhost only, and secure mqtt
> listener 1883 localhost
> listener 8883
> certfile /etc/mosquitto/certs/cert.pem
> cafile /etc/mosquitto/certs/chain.pem
> keyfile /etc/mosquitto/certs/privkey.pem
> protocol mqtt
> # websockets
> listener 9001
> certfile /etc/mosquitto/certs/cert.pem
> cafile /etc/mosquitto/certs/chain.pem
> keyfile /etc/mosquitto/certs/privkey.pem
> protocol websockets
>
> ------------------------------------------------------------------------------------------------------
>
> Thanks everyone help me!
> Carlo
>
> -- 
> 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/bd2362e9-95fd-4d0b-9aa8-eb0abea25350n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/weewx-user/bd2362e9-95fd-4d0b-9aa8-eb0abea25350n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
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/c63ab833-09bd-4e00-bb64-96317df59203n%40googlegroups.com.

Reply via email to