You need to tell MQTTSubscribe/WeeWX what 'unit_group' 'extratemp14' 
belongs to. If I remember correctly this is needed because MQTTSubscribe 
uses WeeWX to perform the conversion. See, 
https://www.weewx.com/docs/customizing.htm#Assigning_a_unit_group. So you 
would want something like.

import weewx.units
weewx.units.obs_group_dict['extratemp14'] = 'group_temperature'

Where to add this, I'm not sure. I think the recommended place is in 
__init__.py in the bin/user directory.
-rich

On Thursday, 5 October 2023 at 14:59:07 UTC-4 bdf0506 wrote:

> I've got a very long list of sensors and am now all the way up to 
> ExtraTemp14 :). The extended database goes up to ExtraTemp9, so I've 
> manually added to the database structure to allow for more. ExtraTemp10-13 
> are fine, but ExtraTemp14 is giving me a hard time since I need to tell it 
> what units to come in with. ExtraTemp10-13 use default units.
>
> Here's the error I keep getting in the logs:
>
> Oct 5 14:29:57 weewx[19] ERROR weewx.engine: Import of driver failed: For 
> extraTemp14 invalid units, degree_C. (<class 'ValueError'>)
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** Traceback (most 
> recent call last):
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/weewx/engine.py", line 119, in setupStation
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** self.console = 
> loader_function(config_dict, self)
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/user/MQTTSubscribe.py", line 1951, in loader
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** return 
> MQTTSubscribeDriver(**config_dict[DRIVER_NAME]) # pragma: no cover
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/user/MQTTSubscribe.py", line 1977, in __init__
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** self.subscriber = 
> MQTTSubscriber(stn_dict, self.logger)
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/user/MQTTSubscribe.py", line 1566, in __init__
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** self.manager = 
> TopicManager(self.archive_topic, topics_dict, self.logger)
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/user/MQTTSubscribe.py", line 844, in __init__
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** 
> self.subscribed_topics[topic]['fields'][topic] = 
> self._configure_field(topic_dict, topic_dict, topic, field_defaults)
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** File 
> "/home/weewx/bin/user/MQTTSubscribe.py", line 964, in _configure_field
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** raise ValueError("For 
> %s invalid units, %s." % (field['name'], field_dict['units']))
> Oct 5 14:29:57 weewx[19] CRITICAL weewx.engine: **** ValueError: For 
> extraTemp14 invalid units, degree_C.
> Oct 5 14:29:57 weewx[19] CRITICAL __main__: Unable to load driver: For 
> extraTemp14 invalid units, degree_C.
> Oct 5 14:29:57 weewx[19] CRITICAL __main__: **** Exiting...
>
> From my weewx.conf:
>
> xxxxxxxx
>
> [MQTTSubscribeDriver]
>     # This section is for the MQTTSubscribe driver.
>
>     # The driver to use:
>     driver = user.MQTTSubscribe
>
>     # The MQTT server.
>     # Default is localhost.
>     host = unraid.home
>
>     # 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 = mqtt
>
>     # password for broker authentication.
>     # Default is None.
>     password = mqtt
>
>     # Configuration for the message callback.
>     [[message_callback]]
>         type = individual
>
> # for fields that aren't the default, specify them here.
>     [[weewx]]
>         [[[observations]]]
>             extraTemp9 = group_temperature
>             extraTemp10 = group_temperature
>             extraTemp11 = group_temperature
>             extraTemp12 = group_temperature
>             extraTemp13 = group_temperature
>             extraTemp14 = group_temperature
>             extraTemp15 = group_temperature
>             extraHumid9 = group_percent
>             extraHumid10 = group_percent
>             extraHumid11 = group_percent
>             extraHumid12 = group_percent
>             extraHumid13 = group_percent
>             extraHumid14 = group_percent
>             extraHumid15 = group_percent
>             rain2 = group_rain
>             windDir2 = group_direction
>             windSpeed2 = group_speed
>             outTemp2 = group_temperature
>             outHumidity2 = group_percent
>             luminosity = group_illuminance
>
>     # The topics to subscribe to.
>     [[topics]]
>         unit_system = US
>         [[[rtl_433/devices/Acurite-Tower/9235/temperature_C]]]
>               name = extraTemp14
>               units = degree_C
>         [[[rtl_433/devices/Acurite-Tower/9235/humidity]]]
>               name = extraHumid14
>         [[[rtl_433/devices/Acurite-Tower/9235/battery_ok]]]
>               name = batteryStatus14
>
> xxxxxxxx
>
> It's struggling because I am telling it that the units are coming in 
> degree_C and I need weewx to convert it. Is there a config file somewhere 
> where I need to properly map the unit to extraTemp14?
>
> Thank you!
>
>

-- 
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/e59c247f-7d8b-4a46-a3b0-2a9195427197n%40googlegroups.com.

Reply via email to