I am searching for a way to get history_stats from this week so far. The documentation (History Stats - Home Assistant) shows an example how to start from today’s day with replacing hour, minute and second with a 0, the same works for this month, since i can also replace the day with a 1. However, the datetime object returned by the now() function does not have a weekday attribute which i could reset. It sure does expose the isoweekday, but this is apparently immutable.
Make the History Stats sensor report daily stats. Then use the Utility Meter integration to report weekly stats, using the data produced by the daily History Stats sensor.
The advantage is the data for sensors produced by the Utility Meter integration is stored long-term in the database (i.e. it’s not purged regularly). Plus you can also use the Utility Meter integration to create monthly and yearly sensors.