Hello,
I have a Dragino LHT65 temp/hum sensor sending MQTT data from a RAK7244
LoRa gateway. Presently I also have a Seeed CO2 sensor sending data
correctly to weewx (Standard skin) via MQTT--this is working via Node-Red
on the weewx server (many thanks to vince and storm for the help setting
this up).
Not being a programmer, I thought it would be simple to copy the CO2 flow,
with certain modifications, and get the LHT65 running. Not so...
I have a connection at both ends of the NR flow but there seems to be a
problem with the format of the data being parsed and exchanged. I would
like to store the data as extraTemp3 in the db.[image: LHT65flow.png]
I am attaching a file of areas that might explain what the problem might
be; however, I can send any additional information that might be needed.
My setup is weewx 4.10.1 (setup.py) running on ubuntu 22.04.1.
Thanks in advance for any help for this.
Cheers,
Bob [grattans.org/wx]
--
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/7c8f1d8a-902e-4d3c-afa5-57114f9b9969n%40googlegroups.com.
topic from RAK (192.168.1.10:1883): application/7/device/a84041c14184b062/rx
{
"applicationID": "7",
"applicationName": "LHT65",
"deviceName": "LHT65b",
"deviceProfileName": "my-device-profile",
"deviceProfileID": "67920d1f-034b-4739-8116-4bc7ebb1703d",
"devEUI": "a84041c14184b062",
"txInfo": {
"frequency": 904500000,
"dr": 0
},
"adr": true,
"fCnt": 2,
"fPort": 2,
"data": "y94IYQFJAQhAf/8=",
"object": {
"BatV": 3.038,
"Ext_sensor": "Temperature Sensor",
"Hum_SHT": "32.9",
"TempF_DS": "70.02",
"TempF_SHT": "70.61"
}
}
-------------------------------
# Options for 'MQTTSubscribeService'
[MQTTSubscribeService]
# This section is for the MQTTSubscribe service.
# Turn the service on and off.
# Default is: true
# Only used by the service.
enable = true # false
# The MQTT server.
# Default is localhost.
host = localhost
# 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 = None #admin #None
# password for broker authentication.
# Default is None.
password = None #admin #None
# 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 #REPLACE_ME
# The application/18/device/2cf7f12122500013/rx topics to subscribe to.
[[topics]]
# Units for MQTT payloads without unit value.
# Valid values: US, METRIC, METRICWX
# Default is: US
unit_system = US
ignore_start_time = True
ignore_end_time = True
[[[mytopic]]]
ignore = true
[[[[CO2_Value_PPM]]]]
name = co2
ignore = false
contains total = false
#expires_after = none
conversion type = float
#units = ppm # 12/2/21
[[[[measurementID]]]]
ignore = true
[[[[report_telemetry]]]]
ignore = true
[[[[upload_battery]]]]
ignore = true
[[[[battery]]]]
ignore = true
[[[lht65b]]]
[[[[TempF_SHT]]]]
name = extraTemp3
contains total = false
conversion type = float
[[[[BatV]]]]
ignore = true
[[[[Ext_sensor]]]]
ignore = true
[[[[Hun_SHT]]]]
ignore = true
[[[[TempF_DS]]]]
ignore = true
------------------------------------------------------------------
weewx.log
Feb 13 11:46:26 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service)
MessageCallbackProvider on_message_json failed with <class
'user.MQTTSubscribe.ConversionError'> and reason Failed converting field
applicationName with value LHT65 using 'lambda x: to_float(x)' with reason
could not convert string to float: 'LHT65'..
Feb 13 11:46:26 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service) ****
MessageCallbackProvider Ignoring topic=lht65b and payload=b'{\n
"applicationID": "7",\n "applicationName": "LHT65",\n "deviceName":
"LHT65b",\n "deviceProfileName": "my-device-profile",\n
"deviceProfileID": "67920d1f-034b-4739-8116-4bc7ebb1703d",\n "devEUI":
"a84041c14184b062",\n "txInfo": {\n "frequency": 905100000,\n
"dr": 0\n },\n "adr": true,\n "fCnt": 0,\n "fPort": 2,\n "data":
"AA==",\n "object": {\n "BatV": 0,\n "Ext_sensor": "No
external sensor",\n "Hum_SHT": "0.0",\n "TempF_SHT": "32.00"\n
}\n}'
Feb 13 11:46:26 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service) ****
MessageCallbackProvider Traceback (most recent call last):#012 File
"/home/weewx/bin/user/MQTTSubscribe.py", line 1263, in _convert_value#012
return conversion_func['compiled'](value)#012 File "<string>", line 1, in
<lambda>#012 File "/home/weewx/bin/weeutil/weeutil.py", line 1533, in
to_float#012 return float(x) if x is not None else None#012ValueError: could
not convert string to float: 'LHT65'#012#012During handling of the above
exception, another exception occurred:#012#012Traceback (most recent call
last):#012 File "/home/weewx/bin/user/MQTTSubscribe.py", line 1427, in
_on_message_json#012 (fieldname, value) = self._update_data(fields,
fields_conversion_func, lookup_key, data_flattened[key], unit_system)#012 File
"/home/weewx/bin/user/MQTTSubscribe.py", line 1230, in _update_data#012
value = self._convert_value(fields, default_field_conversion_func, orig_name,
orig_value)#012 File "/home/weewx/bin/user/MQTTSubscribe.py", line 1268, in
_convert_value#012 raise ConversionError("Failed converting field %s with
value %s using '%s' with reason %s." \#012user.MQTTSubscribe.ConversionError:
Failed converting field applicationName with value LHT65 using 'lambda x:
to_float(x)' with reason could not convert string to float: 'LHT65'.
Feb 13 11:46:28 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service)
MessageCallbackProvider on_message_json failed with <class
'user.MQTTSubscribe.ConversionError'> and reason Failed converting field
applicationName with value LHT65 using 'lambda x: to_float(x)' with reason
could not convert string to float: 'LHT65'..
Feb 13 11:46:28 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service) ****
MessageCallbackProvider Ignoring topic=lht65b and payload=b'{\n
"applicationID": "7",\n "applicationName": "LHT65",\n "deviceName":
"LHT65b",\n "deviceProfileName": "my-device-profile",\n
"deviceProfileID": "67920d1f-034b-4739-8116-4bc7ebb1703d",\n "devEUI":
"a84041c14184b062",\n "txInfo": {\n "frequency": 904900000,\n
"dr": 0\n },\n "adr": true,\n "fCnt": 1,\n "fPort": 2,\n "data":
"AA==",\n "object": {\n "BatV": 0,\n "Ext_sensor": "No
external sensor",\n "Hum_SHT": "0.0",\n "TempF_SHT": "32.00"\n
}\n}'
Feb 13 11:46:28 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service) ****
MessageCallbackProvider Traceback (most recent call last):#012 File
"/home/weewx/bin/user/MQTTSubscribe.py", line 1263, in _convert_value#012
return conversion_func['compiled'](value)#012 File "<string>", line 1, in
<lambda>#012 File "/home/weewx/bin/weeutil/weeutil.py", line 1533, in
to_float#012 return float(x) if x is not None else None#012ValueError: could
not convert string to float: 'LHT65'#012#012During handling of the above
exception, another exception occurred:#012#012Traceback (most recent call
last):#012 File "/home/weewx/bin/user/MQTTSubscribe.py", line 1427, in
_on_message_json#012 (fieldname, value) = self._update_data(fields,
fields_conversion_func, lookup_key, data_flattened[key], unit_system)#012 File
"/home/weewx/bin/user/MQTTSubscribe.py", line 1230, in _update_data#012
value = self._convert_value(fields, default_field_conversion_func, orig_name,
orig_value)#012 File "/home/weewx/bin/user/MQTTSubscribe.py", line 1268, in
_convert_value#012 raise ConversionError("Failed converting field %s with
value %s using '%s' with reason %s." \#012user.MQTTSubscribe.ConversionError:
Failed converting field applicationName with value LHT65 using 'lambda x:
to_float(x)' with reason could not convert string to float: 'LHT65'.
Feb 13 11:46:32 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service)
MessageCallbackProvider on_message_json failed with <class
'user.MQTTSubscribe.ConversionError'> and reason Failed converting field
applicationName with value LHT65 using 'lambda x: to_float(x)' with reason
could not convert string to float: 'LHT65'..
Feb 13 11:46:32 n4mrv weewx[3341] ERROR user.MQTTSubscribe: (Service) ****
MessageCallbackProvider Ignoring topic=lht65b and payload=b'{\n
"applicationID": "7",\n "applicationName": "LHT65",\n "deviceName":
"LHT65b",\n "deviceProfileName": "my-device-profile",\n
"deviceProfileID": "67920d1f-034b-4739-8116-4bc7ebb1703d",\n "devEUI":
"a84041c14184b062",\n "txInfo": {\n "frequency": 905300000,\n
"dr": 0\n },\n "adr": true,\n "fCnt": 2,\n "fPort": 2,\n "data":
"y9wIfwFAAQhZf/8=",\n "object": {\n "BatV": 3.036,\n
"Ext_sensor": "Temperature Sensor",\n "Hum_SHT": "32.0",\n
"TempF_DS": "70.47",\n "TempF_SHT": "71.15"\n }\n}'