Hello.
I connected the wind vane and the anemometer and I get readings but
mqtt uploader cancels if I set:

            [[[[windDir]]]]
               name = windDir_ordinal
               units= ordinal_compass
           [[[[windGustDir]]]]
               name = windGustDir_ordinal
               units= ordinal_compass

Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
*** Traceback (most recent call last):
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***   File "/usr/share/weewx/weewx/restx.py", line 382, in run_loop
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***     self.process_record(_record, dbmanager)
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***   File "/usr/share/weewx/user/mqtt.py", line 476, in
process_record
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***     data = self.filter_data(record)
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***   File "/usr/share/weewx/user/mqtt.py", line 455, in filter_data
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***     v = weewx.units.convert(from_t, to_units)[0]
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***   File "/usr/share/weewx/weewx/units.py", line 1454, in convert
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
***     conversion_func = conversionDict[val_t[1]][target_unit]
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] ERROR weewx.restx:
*** KeyError: 'degree_compass'
Jun 04 11:50:13 pi2weewx python3[5961]: weewx[5961] CRITICAL
weewx.restx: MQTT: Thread terminating. Reason: 'degree_compass'

and it works fine with this config.

            [[[[windDir]]]]
                name = windDir_ordinal
                units= degree_compass
            [[[[windGustDir]]]]
                name = windGustDir_ordinal
                units= degree_compass

If I'm not mistaken, ordinal_compass is a valid unit.
Thanks!

On Mon, May 29, 2023 at 8:53 PM gjr80 <[email protected]> wrote:
>
> My apologies, you said windDir and windGustDir and I read windGust and 
> windGustDir. Vince is exactly right; the MQTT uploader ignores fields whose 
> value is None. If you want to change this behaviour you need to modify the 
> MQTT uploader code. If you convert to ordinal compass points None values will 
> come back as a string 'N/A'.
>
> Gary
>
> On Monday, 29 May 2023 at 11:34:22 UTC+10 HoracioDos wrote:
>>
>> Hello Vince.
>> I think it should work if I want to convert to ordinal_compass. This a 
>> section from ZBX-Sender plugin where windir and winGustDir values are 
>> converted to ordinal_compass.  I get  "N/A" = None
>> My knowledge is quite limited to analize this problem in depth. I'm going to 
>> connect things again and report back.
>>
>>     def send_data(self, packet):
>>          pu = packet.get(self.unit_system)
>>          s = ""
>>          f = Formatter()
>>          for key,value in packet.items():
>>              if key == 'windDir':
>>                 vt = ValueTuple(value, 'degree_compass', 'group_direction')
>>                 new_value = f.to_ordinal_compass(vt)
>>              elif key == 'windGustDir':
>>                 vt = ValueTuple(value, 'degree_compass', 'group_direction')
>>                 new_value = f.to_ordinal_compass(vt)
>>              else:
>>                 new_value = str(value)
>>              l=self.host + " " + self.prefix+key + " " + new_value + "\n"
>>              s+=l
>>              if weewx.debug >= 1:
>>                 logdbg(l)
>>
>> Thanks!!
>>
>> On Sunday, May 28, 2023 at 10:05:15 PM UTC-3 vince wrote:
>>
>> Kinda impossible to convert 'None' to a number.  That's your issue.
>>
>> On Sunday, May 28, 2023 at 6:02:32 PM UTC-7 HoracioDos wrote:
>>
>> Hello gjr80.
>> These are loop and archive packets for a WS3080 (FineoffsetUSB driver). I 
>> replaced batteries for the external unit today and the anemometer and the 
>> vane are not connected right now. But measurements (winGustDir and winDir 
>> are there) Perhaps mqqt uploader dismisses them because of their None value, 
>> but it used to show degree_compass or ordinal_compass values.
>>
>> ........
>
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "weewx-user" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/weewx-user/kh2LOJ5b3C4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/weewx-user/bbd793aa-1010-4bcf-b1af-81df16f0a76bn%40googlegroups.com.

-- 
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/CAN4efjg2prR8hROj_sdnE-TEXv6cGocObHU%2BN2PsKDvBqwBmCQ%40mail.gmail.com.

Reply via email to