I installed MQTTSubscribe and, as for as I can tell, it is not throwing an 
error! :) 
However, no coordinates are written into weewx.sdb.
Could this be the reason: *user.MQTTSubscribe: (Service) Archive topic is 
None*?

Here a tail -f /var/log/syslog | grep MQTT:

Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
Packet prior to update is: 2023-10-25 15:18:08 CEST (1698239888) 
'dateTime': '1698239888', 'inHumidity': '74', 'inTemp': '13.2', 
'outHumidity': '86', 'outTemp': '12.9', 'pressure': '987.0', 
'relbarometer': '987.0', 'usUnits': '17', 'wh31_ch1_batt': '0', 
'wh31_ch1_sig': '4', 'wh31_ch8_batt': 'None', 'wh31_ch8_sig': '0'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager processing interval: 1698239883.000000 1698239888.000000
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager starting queue RVGPS/# size is: 1
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager data-> outgoing RVGPS/#: 'dateTime': '1698239883.45555', 
'latitude': '52.152477', 'longitude': '9.929382', 'usUnits': '1'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager input to accumulate RVGPS/# 2023-10-25 15:18:03 CEST 
(1698239883): 'dateTime': '1698239883.45555', 'latitude': '52.152477', 
'longitude': '9.929382', 'usUnits': '1'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager prior to conversion is RVGPS/# 2023-10-25 15:18:08 CEST 
(1698239888): 'dateTime': '1698239888.0', 'latitude': '52.152477', 
'longitude': '9.929382', 'usUnits': '1'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager after conversion is RVGPS/# 2023-10-25 15:18:08 CEST 
(1698239888): 'dateTime': '1698239888.0', 'latitude': '52.152477', 
'longitude': '9.929382', 'usUnits': '17'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager data-> outgoing accumulated RVGPS/#: 'dateTime': 
'1698239888.0', 'latitude': '52.152477', 'longitude': '9.929382', 
'usUnits': '17'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
Packet after update is: 2023-10-25 15:18:08 CEST (1698239888) 'dateTime': 
'1698239888.0', 'inHumidity': '74', 'inTemp': '13.2', 'latitude': 
'52.152477', 'longitude': '9.929382', 'outHumidity': '86', 'outTemp': 
'12.9', 'pressure': '987.0', 'relbarometer': '987.0', 'usUnits': '17', 
'wh31_ch1_batt': '0', 'wh31_ch1_sig': '4', 'wh31_ch8_batt': 'None', 
'wh31_ch8_sig': '0'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
Packet prior to update is: 2023-10-25 15:18:08 CEST (1698239888) 
'dateTime': '1698239888.0', 'inHumidity': '74', 'inTemp': '13.2', 
'latitude': '52.152477', 'longitude': '9.929382', 'outHumidity': '86', 
'outTemp': '12.9', 'pressure': '987.0', 'relbarometer': '987.0', 'usUnits': 
'17', 'wh31_ch1_batt': '0', 'wh31_ch1_sig': '4', 'wh31_ch8_batt': 'None', 
'wh31_ch8_sig': '0'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
Packet after update is: 2023-10-25 15:18:08 CEST (1698239888) 'dateTime': 
'1698239888.0', 'inHumidity': '74', 'inTemp': '13.2', 'latitude': 
'52.152477', 'longitude': '9.929382', 'outHumidity': '86', 'outTemp': 
'12.9', 'pressure': '987.0', 'relbarometer': '987.0', 'usUnits': '17', 
'wh31_ch1_batt': '0', 'wh31_ch1_sig': '4', 'wh31_ch8_batt': 'None', 
'wh31_ch8_sig': '0'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
data-> final packet is 2023-10-25 15:18:08 CEST (1698239888): 'dateTime': 
'1698239888.0', 'inHumidity': '74', 'inTemp': '13.2', *'latitude': 
'52.152477', 'longitude': '9.929382'*, 'outHumidity': '86', 'outTemp': 
'12.9', 'pressure': '987.0', 'relbarometer': '987.0', 'usUnits': '17', 
'wh31_ch1_batt': '0', 'wh31_ch1_sig': '4', 'wh31_ch8_batt': 'None', 
'wh31_ch8_sig': '0'
Oct 25 15:18:08 rvwx weewx[32590] INFO weewx.restx: MQTT: Published record 
2023-10-25 15:18:08 CEST (1698239888)
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Received PUBLISH (d0, q0, r0, m0), 'RVGPS/loop', ... 
 (76 bytes)
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
MessageCallbackProvider data-> incoming topic: RVGPS/loop, QOS: 0, retain: 
0, payload: b'{"dateTime": "1698239885", "latitude": "52.152477", 
"longitude": "9.929382"}'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG user.MQTTSubscribe: (Service) 
TopicManager data-> incoming RVGPS/loop: 'dateTime': '1698239885.0', 
'latitude': '52.152477', 'longitude': '9.929382'
Oct 25 15:18:08 rvwx weewx[32590] DEBUG *user.MQTTSubscribe: (Service) 
TopicManager Added to queue RVGPS/loop RVGPS/# 2023-10-25 15:18:08 CEST 
(1698239888): 'dateTime': '1698239888.4406571', 'latitude': '52.152477', 
'longitude': '9.929382', 'usUnits': '1'*

I see also for weewx-mqtt publisher the following.
Here a tail -f /var/log/syslog | grep mqtt:

Oct 25 15:32:21 rvwx weewx[32590] DEBUG user.mqtt: data: {'dateTime': 
'1698240741.0', 'inTemp_C': '13.299999999999999', 'outTemp_C': 
'13.000000000000004', 'outHumidity': '86.0', 'pressure_mbar': '986.5', 
'relbarometer': '986.5', 'wh31_ch1_batt': '0.0', 'wh31_ch1_sig': '4.0', 
'wh31_ch8_sig': '0.0', 'inHumidity': '74.0', 'altimeter_mbar': 
'990.1050304333165', 'barometer_mbar': '990.0253260380001', 
'cloudbase_meter': '315.17323732125936', 'dewpoint_C': 
'10.711913219964744', 'heatindex_C': '12.601111111111116', 'humidex_C': 
'14.614171236229963', 'inDewpoint_C': '8.762453683350873', 
'rainRate_cm_per_hour': '0.0', 'usUnits': '16.0', *'latitude': '52.152554', 
'longitude': '9.929341', 'position': '52.152554,9.929341'*}

As for as I understand it, MQTTSubscribe is reading from topic RVGPS the 
coordinates and adds them to the final package.
Weewx-mqtt publishes under topic RV the updated data; now including 
latitude, longitude and position (I do not know how "position" was added).

However, latitude and longitude are not updated into weewx.sdb. The values 
for the columns latitide and longitude (which I added manually) display 
*NULL*.

Here is the MQTTSubscribe initialization after a weewx restart.
Here a tail -f /var/log/syslog:

Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) Using 
weewx version 4.10.2
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) Using 
Python 3.9.2 (default, Mar 12 2021, 04:06:34) #012[GCC 10.2.1 20210110]
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
Platform Linux-6.1.21-v8+-aarch64-with-glibc2.31
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) Locale 
is 'en_GB.UTF-8'
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Version 
is 2.2.2
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Log 
level: 0
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Log 
debug setting: 5
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Log 
console: False
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Log 
file: None
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
sanitized configuration removed ['password']
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSUBscriber sanitized_service_dict is {'username': 'teffi', 'topics': 
{'unit_system': 'US', 'use_server_datetime': 'True', 
'use_topic_as_fieldname': 'true', 'RVGPS/#': {'ignore': 'False'}}, 'log': 
'true', 'port': '1883', 'binding': 'loop', 'enable': 'true', 'keepalive': 
'60', 'host': 'weewx.bz3gfkrlqtrsc3sv.myfritz.net', 'message_callback': 
{'type': 'json'}}
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
'use_topic_as_fieldname' option is no longer needed and can be removed.
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager self.collect_wind_across_loops is True
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager self.collect_observations is False
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager single_queue is False
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager single_queue is False
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager self.subscribed_topics is {"RVGPS/#": {"ignore": false, 
"subscribe": true, "conversion_func": {"source": "lambda x: to_float(x)", 
"compiled": "<function <lambda> at 0xf72d89b8>"}, "unit_system": 1, 
"msg_id_field": null, "qos": 0, "topic_tail_is_fieldname": false, 
"use_server_datetime": true, "datetime_format": null, "offset_format": 
null, "ignore_msg_id_field": [], "fields": {"RVGPS/#": {"name": "RVGPS/#", 
"ignore": false, "contains_total": false, "total_wrap_around": false, 
"conversion_func": {"source": "lambda x: to_float(x)", "compiled": 
"<function <lambda> at 0xf72ed970>"}, "conversion_type": "float", 
"conversion_error_to_none": false}}, "queue": {"name": "RVGPS/#", "type": 
"normal", "ignore_start_time": false, "ignore_end_time": false, 
"adjust_start_time": 0.0, "adjust_end_time": 0.0, "max_size": 2147483647, 
"data": "deque([])"}, "filters": {}, "message-1698241329.683747": {}}, 
"1698241329.686176-windGust-windGustDir-windDir-windSpeed": {"subscribe": 
false, "message-1698241329.683747": {}, "unit_system": 1, "qos": 0, 
"topic_tail_is_fieldname": false, "use_server_datetime": true, 
"datetime_format": null, "offset_format": null, "queue": {"name": 
"1698241329.686176-windGust-windGustDir-windDir-windSpeed", "type": 
"collector", "ignore_start_time": false, "ignore_end_time": false, 
"adjust_start_time": 0.0, "adjust_end_time": 0.0, "max_size": 2147483647, 
"data": "deque([])"}}}
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager self.cached_fields is {}
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
message_callback_provider_name is user.MQTTSubscribe.MessageCallbackProvider
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) clientid 
is MQTTSubscribe-3055
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
client_session is True
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) host is 
weewx.bz3gfkrlqtrsc3sv.myfritz.net
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) port is 
1883
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
keepalive is 60
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) username 
is teffi
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
min_delay is 1
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
max_delay is 120
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) password 
is set
Oct 25 15:42:09 rvwx weewx[460] *INFO user.MQTTSubscribe: (Service) Archive 
topic is None*
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) 
client_id=b'MQTTSubscribe-3055'
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) binding 
is loop
Oct 25 15:42:09 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
Starting loop
Oct 25 15:42:09 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) Waiting 
for MQTT connection.
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Received CONNACK (0, 0)
Oct 25 15:42:10 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
Connected with result code 0
Oct 25 15:42:10 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
Connected flags {'session present': 0}
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Sending SUBSCRIBE (d0, m1) [(b'RVGPS/#', 0)]
Oct 25 15:42:10 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
Subscribing to RVGPS/# has a mid 1 and rc 0
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Received SUBACK
Oct 25 15:42:10 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) 
Subscribed to mid: 1 is size 1 has a QOS of 0
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MQTTSubscribe MQTT: Received PUBLISH (d0, q0, r0, m0), 'RVGPS/loop', ... 
 (76 bytes)
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
MessageCallbackProvider data-> incoming topic: RVGPS/loop, QOS: 0, retain: 
0, payload: b'{"dateTime": "1698241325", "latitude": "52.152546", 
"longitude": "9.929337"}'
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager data-> incoming RVGPS/loop: 'dateTime': '1698241325.0', 
'latitude': '52.152546', 'longitude': '9.929337'
Oct 25 15:42:10 rvwx weewx[460] DEBUG user.MQTTSubscribe: (Service) 
TopicManager Added to queue RVGPS/loop RVGPS/# 2023-10-25 15:42:10 CEST 
(1698241330): 'dateTime': '1698241330.3411937', 'latitude': '52.152546', 
'longitude': '9.929337', 'usUnits': '1'
Oct 25 15:42:10 rvwx weewx[460] INFO user.MQTTSubscribe: (Service) MQTT 
initialization complete.

I just notice that there is no archive topic set. Is that the reason why 
nothing is written to the weewx.sdb?
*user.MQTTSubscribe: (Service) Archive topic is None*

TIA for any hint!
On Sunday, October 22, 2023 at 4:38:49 PM UTC+2 Stefan Gliessmann wrote:

> Thank you, Greg!
>
> That makes so much sense now to me!
> 🙏😇
>
>
> Greg Troxel <g...@lexort.com> schrieb am So. 22. Okt. 2023 um 16:28:
>
>> Stefan Gliessmann <stefan.g...@gmail.com> writes:
>>
>> > I thought that having the topic's binding set to archive would populate 
>> the 
>> > weewx db accordingly ...
>>
>> I think you are missing that MQTT is supported in two distinct ways and
>> that these two methods have nothing to do with each other.
>>
>>   The mqtt extension
>>     https://github.com/matthewwall/weewx-mqtt
>>   takes data from weewx (archive and loop) and publishes it to
>>   MQTT.  This is used to provide data to be read by skins like
>>   Belchertown and things like Home Assistant.
>>
>>   The mqtt-subscribe service/driver
>>     https://github.com/bellrichm/WeeWX-MQTTSubscribe
>>   takes data from MQTT and stores it in the database.  This is used to
>>   add sensors to weewx, from data that appears over MQTT.
>>
>>
>> You should be able to store coordinates with mqtt-subscribe and then
>> also publish those so HA/skin/whatever can see them.  But they are in
>> the db (or as loop packets) in the middle.
>>
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/47df9630-cbe6-4ea7-a8ae-2e68c27e63c3n%40googlegroups.com.

Reply via email to