If you look at the types calculated in wxxtypes.py you'll see that they do,
in fact, call convertStd() before returning the value.

I'm not sure why they do that rather than having it done in
do_calculations() automatically. I recall having some good reason, but
can't remember it now.

I'll look into it. In the meantime, you'll have to convert the value to
whatever is used by the record.

Issue #781 <https://github.com/weewx/weewx/issues/781>.

-tk

On Mon, Jul 25, 2022 at 1:18 AM Karen K <[email protected]> wrote:

> Tom Keffer schrieb am Sonntag, 24. Juli 2022 um 13:26:04 UTC+2:
>
>> What is the context? Is the extension being used within [StdWXCalculate]?
>>
>
> Yes.
>
> part of weewx.conf:
> [StdRESTful]
>     [[MQTT]]
>         [[[inputs]]]
>             [[[[myObsType]]]]
>                 units = hPa
> [StdConvert]
>     target_unit = US
> [StdWXCalculate]
>     [[Calculations]]
>         myObsType = software
>
>
> I calculated the value using my extension and output it by MQTT for
> testing.
>
> As an example: If the value, returned by the extension, is
> (20,'hPa','group_pressure') and the database unit is US and the output
> unit of MQTT is hPa, then the output is 677 to the MQTT broker. That
> means to me, that the value of 20 is *not* recognized as hPA (as sent in
> the value tuple) but as inHG.
>
> If I add weewx.units.convertStd(...,record['usUnits']) at the end, then
> the correct value is output to MQTT. But it makes no sense to me to convert
> the value to the standard unit system if I return a value tuple. So I asked.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-development" 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-development/7c5aa511-56a1-496f-915b-89afb84fe772n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/7c5aa511-56a1-496f-915b-89afb84fe772n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" 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-development/CAPq0zEB4gz%2B68RkUYHBiuFnqshhkXMyzzv_ctdRwWG%3Dh%3DNs9Sw%40mail.gmail.com.

Reply via email to