A GPS device in my RV sends the current coordinates via MQTT to my weewx server.
The coordinates are displayed with units = None.
Trying to change them to units = degree_compass or units = " °" results in the below error:
Aug 21 15:28:26 rvwx weewx[1590] DEBUG weewx.units: Unable to convert from None to °
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: MQTT: Unexpected exception of type <class 'KeyError'>
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** Traceback (most recent call last):
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** File "/usr/share/weewx/weewx/restx.py", line 382, in run_loop
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** self.process_record(_record, dbmanager)
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** File "/usr/share/weewx/user/mqtt.py", line 516, in process_record
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** data = self.filter_data(record)
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** File "/usr/share/weewx/user/mqtt.py", line 496, in filter_data
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** v = weewx.units.convert(from_t, to_units)[0]
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** File "/usr/share/weewx/weewx/units.py", line 1454, in convert
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** conversion_func = conversionDict[val_t[1]][target_unit]
Aug 21 15:28:26 rvwx weewx[1590] ERROR weewx.restx: *** KeyError: None
Aug 21 15:28:26 rvwx weewx[1590] CRITICAL weewx.restx: MQTT: Thread terminating. Reason: None
Here is the relevant section from weewx.conf to display coordinates in belchertown skin:
[[MQTT]]
server_url = mqtt://
zzzz:yy...@wxvm.bz3gfkrlqtrsc3sv.myfritz.net:1883/ topic = RV
unit_system = METRIC
binding = loop, archive
log_success = true
[[[inputs]]]
[[[[latitude]]]]
# units = " °"
format = %.3f
and MQTT subscribe to Write the GPS data received via MQTT into the weewx db:
[MQTTSubscribeService]
# This section is for the MQTTSubscribe service.
# Turn the service on and off.
# Default is: true
# Only used by the service.
enable = true
log = true
# The MQTT server.
# Default is localhost.
host = "
wxvm.bz3gfkrlqtrsc3sv.myfritz.net"
# The port to connect to.
# Default is 1883.
port = 1883
# Maximum period in seconds allowed between communications with the broker.
# Default is 60.
keepalive = 60
# username for broker authentication.
# Default is None.
username = xxxx
# password for broker authentication.
# Default is None.
password = yyyy
# The binding, loop or archive.
# Default is: loop
# Only used by the service.
binding = loop
# The message handler to use
[[message_callback]]
# The format of the MQTT payload.
# Currently support: individual, json, keyword
# Must be specified.
type = json
# The topics to subscribe to.
[[topics]]
# Units for MQTT payloads without unit value.
# Valid values: US, METRIC, METRICWX
# Default is: US
unit_system = US
# adjust_start_time = 1
use_server_datetime = True
use_topic_as_fieldname = true
[[[RVGPS/#]]]
# The WeeWX name.
# Default is the name from MQTT.
#name = Latitude
# True if the incoming data should not be processed into WeeWX.
# Valid values: True, False
# Default is False
ignore = False
# True if the incoming data is cumulative.
# Valid values: True, False
# Default is False
# contains_total = False
# The conversion type necessary for WeeWX compatibility
# Valid values: bool, float, int, none
# Default is float
# conversion_type = int
# The units of the incoming data.
# Useful if this field's units differ from the topic's unit_system's units.
# Valid values: see,
http://www.weewx.com/docs/customizing.htm#units # Default is not set
# units = degree_compass
This is how it Looks on belchertown skin with units = None, e.g. no change of units intented.
TIA,
Stefan