Ok, so I'm switching to templates, but I'm doing something wrong, because I 
can't get that rain sum. In my case it just prints 
"$since($hour=0).rain.sum.format("%.3f")" instead of showing the value.
How did you do it?
This is my `mastodon.txt.tmpl` (there are a few errors in my template e.g I 
shouldn't add ℃C etc, but nevermind) :

```
#errorCatcher Echo
## Template file for providing data to weewx-mastodon
## https://github.com/glennmckechnie/weewx-mastodon
##
## Tag information at...
## https://weewx.com/docs/customizing.htm#Tags

Température: $current.outTemp℃C (min: $day.outTemp.min, max: 
$day.outTemp.max)<br>
Humidex: $current.heatindex (min: $day.heatindex.min, max: 
$day.heatindex.max)<br>
Humidit&eacute;: $current.outHumidity % (min: $day.outHumidity.min, max: 
$day.outHumidity.max)<br>
Pression: $current.barometer<br>
Pluie
- Aujourd'hui: $since($hour=0).rain.sum.format("%.3f")<br>
- Ann&eacute;e: $year.rain.sum<br>
Vent:<br>
- Direction: $current.windDir.ordinal_compass ($current.windDir deg)<br>
-Vitesse: $current.windSpeed (moyenne), $current.windGust (rafale)<br>
<br>
$current.dateTime.format("%d-%b-%Y %H:%M")
``

This is the generated mastodon.txt : 

Temp&eacute;rature: 23.2C&#x2103;C (min: 16.0C, max: 27.0C)<br>
Humidex: 23.4C (min: 15.6C, max: 27.9C)<br>
Humidit&eacute;: 70% % (min: 48%, max: 78%)<br>
Pression: 1008.9 hPa<br>
Pluie
- Aujourd'hui: $since($hour=0).rain.sum.format("%.3f")<br>
- Ann&eacute;e: 201.3 mm<br>
Vent:<br>
- Direction: E (97 deg)<br>
- Vitesse: 0 km/h (moyenne), 4 km/h (rafale)<br>
<br>
30-Aug-2023 18:50

On Wednesday, August 30, 2023 at 12:07:00 AM UTC+2 Glenn McKechnie wrote:

> On 30/08/2023, Invisible Man <axelle....@gmail.com> wrote:
> > Thanks to both of you for your replies.
> >
> > - since.py etc are in /usr/share/weewx/user already so indeed I can try 
> and
>
> since.py is part of the weewx-mastodon install.
>
> > use them. I tried to directly use since in the format line of
> > weewx-mastodon, but haven't succeeded yet:
> > `{since($hour=24).rain.sum:%.3f}` , `{since(hour=24).rain.sum:%.3f}`... 
> not
> > sure I can do it like that.
>
> As you found, these won't work on the raw (archive) data.
>
> > - I'll look in the template file.
>
> The example template I mentioned already uses since.py to format the
> rain value as ...
> $since($hour=9).rain.sum (Australian reporting times)
>
> According to the weewx manual at
> http://www.weewx.com/docs.html/latest/customizing.htm#Formatting_examples
> A format method to use for your example could be...
> $since($hour=9).rain.sum.format("%.3f")
> I just tested that method and it works. Apparently we've had 7.429 mm of 
> rain!
>
> > - final option is that I directly tweak wxtoot.py ...
> > I'll investigate and post back if I have a question... or with my 
> solution
> > if I succeed :)
>
> Done :)
>
> -- 
>
>
> Cheers
> Glenn
>
> rorpi - read only raspberry pi & various weewx addons
> https://github.com/glennmckechnie
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c9ac9016-3780-465f-ada5-ddbb046a4341n%40googlegroups.com.

Reply via email to