Displaying which unit is being used, not just the label

35 views
Skip to first unread message

Lee Bell

unread,
Dec 29, 2020, 9:36:15 PM12/29/20
to weewx-user
Is there a way to make weewx print out (or a way to programmatically determine) which units are being used, not just the label? I can use $units.label.xxx to get any particular label, but those are subject to changes for different languages, etc. Basically I’m trying to figure out if I can print “The temperature is 30º F. The units being used are degree_F.” Is that possible?

gjr80

unread,
Dec 29, 2020, 10:18:56 PM12/29/20
to weewx-user
Hi,

Try using the $unit.unit_type.xxx tag, eg:

The temperature is $current.outTemp. The units being used are $unit.unit_type.outTemp.

That should result in the following output:

The temperature is 30º F. The units being used are degree_F.

provided of course it is indeed 30.0F at the moment!

Gary

Lee Bell

unread,
Dec 30, 2020, 9:24:37 AM12/30/20
to weewx-user
Thank you so much! I couldn’t for the life of me find that tag.
Reply all
Reply to author
Forward
0 new messages