How to fix exponential smoothing straight line with R I'm a novice in using R and in forecasting. Right now I'm using a dataset with daily precipitation(mm) data from 2001 to mid 2022.
Using STL decomposition seems to suggest the data has a yearly seasonal component:

Here is the code I am running and the resulting graph:
train <- df_zero %>%
  filter_index("2001-01-01" ~ "2019-12-31")

train %>%
  model(
    ETS = ETS(precipitacaoTotal ~ error("A") + trend("A") + season("A")),
    ) %>%
  forecast(h="3 years") %>%
  autoplot(train)


I've seen some in questions related to ARIMA that you need to say to R that you want to use an early seasonality (365), but i'm having a hard time finding out how to do it for ETS, if i'm not wrong i'm using the fable package.
So, how to fix my forecast, so it can perceive the early seasonality?

TL;DR: you can't run seasonal models with a seasonality of 365 days in ETS. Use stlf instead.

The best approach would be to specify your original time series (in your case, precipitacaoTotal) as seasonal. This is what you could do for monthly seasonality:
library(fable)
set.seed(1)
foo <- as_tsibble(ts(rnorm(1000),frequency=12))
foo %>% model(ETS(value~season(method="A"))) %>% forecast(h="3 years") %>% autoplot(foo)


Since I forced seasonality using season(method="A"), we get a (pedagogically useful, but of course nonsensical) seasonal forecast. If we let ETS decide on a model on white noise, it would of course not choose a seasonal one.
However, this will not work for longer periods. If we use the same idea with frequency=365,
set.seed(1)
as_tsibble(ts(rnorm(1000),frequency=365)) %>% model(ETS(value))

we get a rather unhelpful error message (formatted):
# A mable: 1 x 1
  `ETS(value)`
       <model>
1 <NULL model>
Warning message:
1 error encountered for ETS(value)
[1] .data contains implicit gaps in time. 
You should check your data and convert implicit gaps into explicit
missing values using `tsibble::fill_gaps()` if required.

I don't quite see where ETS sees implicit gaps, and have pinged the maintainers of fable.
However, the underlying reason is probably that ETS does not support seasonal periods longer than 24 periods: running
set.seed(1)
as_tsibble(ts(rnorm(1000))) %>% model(ETS(value~season(period=365)))

yields the much more informative warning message
# A mable: 1 x 1
  `ETS(value ~ season(period = 365))`
                              <model>
1                        <ETS(A,N,N)>
Warning message:
Seasonal periods (`period`) of length greather than 24 are not supported by ETS. 
Seasonality will be ignored. 

This is actually the same behavior as in the older forecast package. Running
library(forecast)
set.seed(1)
ets(ts(rnorm(1000),frequency=365))

yielded (among other outputs):
I can't handle data with frequency greater than 24.
Seasonality will be ignored. Try stlf() if you need seasonal forecasts.

And this actually makes a lot of sense. In exponential smoothing (whether in a state space framework or otherwise), having a seasonality of $k$ periods means you need to estimate $k$ initial conditions. 365 initial conditions is a lot. You would overfit massively. So go with stlf instead.
